Created
December 5, 2025 11:27
-
-
Save buzztaiki/d2b02d50b80617b05815a649211d46ae to your computer and use it in GitHub Desktop.
grafana-table-dashboard.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "annotations": { | |
| "list": [ | |
| { | |
| "builtIn": 1, | |
| "datasource": { | |
| "type": "grafana", | |
| "uid": "-- Grafana --" | |
| }, | |
| "enable": true, | |
| "hide": true, | |
| "iconColor": "rgba(0, 211, 255, 1)", | |
| "name": "Annotations & Alerts", | |
| "type": "dashboard" | |
| } | |
| ] | |
| }, | |
| "editable": true, | |
| "fiscalYearStartMonth": 0, | |
| "graphTooltip": 0, | |
| "id": 0, | |
| "links": [], | |
| "panels": [ | |
| { | |
| "datasource": { | |
| "type": "prometheus", | |
| "uid": "${datasource}" | |
| }, | |
| "fieldConfig": { | |
| "defaults": { | |
| "color": { | |
| "mode": "thresholds" | |
| }, | |
| "custom": { | |
| "align": "auto", | |
| "cellOptions": { | |
| "type": "auto" | |
| }, | |
| "footer": { | |
| "reducers": [] | |
| }, | |
| "inspect": false | |
| }, | |
| "mappings": [], | |
| "thresholds": { | |
| "mode": "absolute", | |
| "steps": [ | |
| { | |
| "color": "green", | |
| "value": 0 | |
| }, | |
| { | |
| "color": "red", | |
| "value": 80 | |
| } | |
| ] | |
| } | |
| }, | |
| "overrides": [ | |
| { | |
| "matcher": { | |
| "id": "byName", | |
| "options": "Value #POD_COUNT" | |
| }, | |
| "properties": [ | |
| { | |
| "id": "displayName", | |
| "value": "Pod数" | |
| }, | |
| { | |
| "id": "thresholds", | |
| "value": { | |
| "mode": "absolute", | |
| "steps": [ | |
| { | |
| "color": "green", | |
| "value": 0 | |
| }, | |
| { | |
| "color": "red", | |
| "value": 80 | |
| } | |
| ] | |
| } | |
| } | |
| ] | |
| }, | |
| { | |
| "matcher": { | |
| "id": "byName", | |
| "options": "Value #CPU_USAGE" | |
| }, | |
| "properties": [ | |
| { | |
| "id": "displayName", | |
| "value": "CPU使用率" | |
| }, | |
| { | |
| "id": "decimals", | |
| "value": 2 | |
| } | |
| ] | |
| }, | |
| { | |
| "matcher": { | |
| "id": "byName", | |
| "options": "Value #CPU_REQ" | |
| }, | |
| "properties": [ | |
| { | |
| "id": "displayName", | |
| "value": "CPU要求" | |
| }, | |
| { | |
| "id": "decimals", | |
| "value": 2 | |
| } | |
| ] | |
| }, | |
| { | |
| "matcher": { | |
| "id": "byName", | |
| "options": "Value #CPU_REQ%" | |
| }, | |
| "properties": [ | |
| { | |
| "id": "displayName", | |
| "value": "CPU要求%" | |
| }, | |
| { | |
| "id": "unit", | |
| "value": "percentunit" | |
| }, | |
| { | |
| "id": "decimals", | |
| "value": 2 | |
| }, | |
| { | |
| "id": "custom.cellOptions", | |
| "value": { | |
| "mode": "lcd", | |
| "type": "gauge" | |
| } | |
| }, | |
| { | |
| "id": "max", | |
| "value": 1 | |
| }, | |
| { | |
| "id": "thresholds", | |
| "value": { | |
| "mode": "absolute", | |
| "steps": [ | |
| { | |
| "color": "green", | |
| "value": 0 | |
| }, | |
| { | |
| "color": "red", | |
| "value": 0.8 | |
| } | |
| ] | |
| } | |
| } | |
| ] | |
| }, | |
| { | |
| "matcher": { | |
| "id": "byName", | |
| "options": "workload" | |
| }, | |
| "properties": [ | |
| { | |
| "id": "links", | |
| "value": [ | |
| { | |
| "targetBlank": true, | |
| "title": "Workload dashboard", | |
| "url": "/d/a164a7f0339f99e89cea5cb47e9be617/kubernetes-compute-resources-workload?&var-namespace=${__data.fields.namespace:percentencode}&var-type=${__data.fields.workload_type:percentencode}&var-workload=${__data.fields.workload:percentencode}" | |
| } | |
| ] | |
| } | |
| ] | |
| }, | |
| { | |
| "matcher": { | |
| "id": "byName", | |
| "options": "namespace" | |
| }, | |
| "properties": [ | |
| { | |
| "id": "links", | |
| "value": [ | |
| { | |
| "targetBlank": true, | |
| "title": "Namespace dashboard", | |
| "url": "/d/a87fb0d919ec0ea5f6543124e16c42a5/kubernetes-compute-resources-namespace-workloads?${datasource:queryparam}&var-namespace=${__data.fields.namespace:percentencode}" | |
| } | |
| ] | |
| } | |
| ] | |
| } | |
| ] | |
| }, | |
| "gridPos": { | |
| "h": 22, | |
| "w": 24, | |
| "x": 0, | |
| "y": 0 | |
| }, | |
| "id": 1, | |
| "options": { | |
| "cellHeight": "sm", | |
| "showHeader": true | |
| }, | |
| "pluginVersion": "12.3.0", | |
| "targets": [ | |
| { | |
| "datasource": { | |
| "type": "prometheus", | |
| "uid": "${datasource}" | |
| }, | |
| "editorMode": "code", | |
| "exemplar": false, | |
| "expr": "count(namespace_workload_pod:kube_pod_owner:relabel{namespace=~\"$namespace\"}) by (namespace, workload, workload_type)", | |
| "format": "table", | |
| "instant": true, | |
| "legendFormat": "__auto", | |
| "range": false, | |
| "refId": "POD_COUNT" | |
| }, | |
| { | |
| "datasource": { | |
| "type": "prometheus", | |
| "uid": "${datasource}" | |
| }, | |
| "editorMode": "code", | |
| "exemplar": false, | |
| "expr": "sum(\r\n max by (namespace, pod, container)(rate(container_cpu_usage_seconds_total{namespace=~\"$namespace\", image!=\"\"} [5m]))\r\n * on(namespace, pod)\r\n group_left(workload, workload_type) namespace_workload_pod:kube_pod_owner:relabel{namespace=~\"$namespace\"}\r\n) by (namespace, workload, workload_type)\r\n", | |
| "format": "table", | |
| "hide": false, | |
| "instant": true, | |
| "legendFormat": "__auto", | |
| "range": false, | |
| "refId": "CPU_USAGE" | |
| }, | |
| { | |
| "datasource": { | |
| "type": "prometheus", | |
| "uid": "${datasource}" | |
| }, | |
| "editorMode": "code", | |
| "exemplar": false, | |
| "expr": "sum(\r\n max by (namespace, pod, container)(kube_pod_container_resource_requests{namespace=~\"$namespace\", resource=\"cpu\"})\r\n * on(namespace, pod)\r\n group_left(workload, workload_type) namespace_workload_pod:kube_pod_owner:relabel{namespace=~\"$namespace\"}\r\n) by (namespace, workload, workload_type)\r\n", | |
| "format": "table", | |
| "hide": false, | |
| "instant": true, | |
| "legendFormat": "__auto", | |
| "range": false, | |
| "refId": "CPU_REQ" | |
| }, | |
| { | |
| "datasource": { | |
| "type": "prometheus", | |
| "uid": "${datasource}" | |
| }, | |
| "editorMode": "code", | |
| "exemplar": false, | |
| "expr": "sum(\r\n max by (namespace, pod, container)(rate(container_cpu_usage_seconds_total{namespace=~\"$namespace\", image!=\"\"} [5m]))\r\n * on(namespace, pod)\r\n group_left(workload, workload_type) namespace_workload_pod:kube_pod_owner:relabel{namespace=~\"$namespace\"}\r\n) by (namespace, workload, workload_type)\r\n/\r\nsum(\r\n max by (namespace, pod, container)(kube_pod_container_resource_requests{namespace=~\"$namespace\", resource=\"cpu\"})\r\n * on(namespace, pod)\r\n group_left(workload, workload_type) namespace_workload_pod:kube_pod_owner:relabel{namespace=~\"$namespace\"}\r\n) by (namespace, workload, workload_type)\r\n", | |
| "format": "table", | |
| "hide": false, | |
| "instant": true, | |
| "legendFormat": "__auto", | |
| "range": false, | |
| "refId": "CPU_REQ%" | |
| } | |
| ], | |
| "title": "Table", | |
| "transformations": [ | |
| { | |
| "id": "merge", | |
| "options": {} | |
| } | |
| ], | |
| "type": "table" | |
| } | |
| ], | |
| "preload": false, | |
| "schemaVersion": 42, | |
| "tags": [], | |
| "templating": { | |
| "list": [ | |
| { | |
| "allowCustomValue": false, | |
| "current": { | |
| "text": "Prometheus", | |
| "value": "prometheus" | |
| }, | |
| "name": "datasource", | |
| "options": [], | |
| "query": "prometheus", | |
| "refresh": 1, | |
| "regex": "", | |
| "type": "datasource" | |
| }, | |
| { | |
| "current": { | |
| "text": "All", | |
| "value": [ | |
| "$__all" | |
| ] | |
| }, | |
| "datasource": { | |
| "type": "prometheus", | |
| "uid": "${datasource}" | |
| }, | |
| "definition": "label_values(kube_pod_info,namespace)", | |
| "includeAll": true, | |
| "multi": true, | |
| "name": "namespace", | |
| "options": [], | |
| "query": { | |
| "qryType": 1, | |
| "query": "label_values(kube_pod_info,namespace)", | |
| "refId": "PrometheusVariableQueryEditor-VariableQuery" | |
| }, | |
| "refresh": 1, | |
| "regex": "", | |
| "type": "query" | |
| } | |
| ] | |
| }, | |
| "time": { | |
| "from": "now-6h", | |
| "to": "now" | |
| }, | |
| "timepicker": {}, | |
| "timezone": "browser", | |
| "title": "Grafana Table", | |
| "uid": "grafana-table-dashboard", | |
| "version": 6 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment