From 13bb54f08ff30eba12e4e54a77b52998f91707e7 Mon Sep 17 00:00:00 2001 From: David Calvert Date: Mon, 29 Apr 2024 13:30:46 +0200 Subject: [PATCH] fix: job label on k8s-views-global.json (#110) Signed-off-by: David Calvert --- dashboards/k8s-views-global.json | 67 ++++++++++++++++++++++---------- 1 file changed, 47 insertions(+), 20 deletions(-) diff --git a/dashboards/k8s-views-global.json b/dashboards/k8s-views-global.json index 7f5585d..45e3c8d 100644 --- a/dashboards/k8s-views-global.json +++ b/dashboards/k8s-views-global.json @@ -152,7 +152,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "avg(sum by (instance, cpu) (rate(node_cpu_seconds_total{mode!~\"idle|iowait|steal\", cluster=\"$cluster\"}[$__rate_interval])))", + "expr": "avg(sum by (instance, cpu) (rate(node_cpu_seconds_total{mode!~\"idle|iowait|steal\", cluster=\"$cluster\", job=\"$job\"}[$__rate_interval])))", "interval": "", "legendFormat": "Real Linux", "range": true, @@ -301,7 +301,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "sum(node_memory_MemTotal_bytes{cluster=\"$cluster\"} - node_memory_MemAvailable_bytes{cluster=\"$cluster\"}) / sum(node_memory_MemTotal_bytes{cluster=\"$cluster\"})", + "expr": "sum(node_memory_MemTotal_bytes{cluster=\"$cluster\", job=\"$job\"} - node_memory_MemAvailable_bytes{cluster=\"$cluster\", job=\"$job\"}) / sum(node_memory_MemTotal_bytes{cluster=\"$cluster\", job=\"$job\"})", "hide": false, "interval": "", "legendFormat": "Real Linux", @@ -809,7 +809,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "sum(rate(node_cpu_seconds_total{mode!~\"idle|iowait|steal\", cluster=\"$cluster\"}[$__rate_interval]))", + "expr": "sum(rate(node_cpu_seconds_total{mode!~\"idle|iowait|steal\", cluster=\"$cluster\", job=\"$job\"}[$__rate_interval]))", "interval": "", "legendFormat": "Real Linux", "range": true, @@ -964,7 +964,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "sum(node_memory_MemTotal_bytes{cluster=\"$cluster\"} - node_memory_MemAvailable_bytes{cluster=\"$cluster\"})", + "expr": "sum(node_memory_MemTotal_bytes{cluster=\"$cluster\", job=\"$job\"} - node_memory_MemAvailable_bytes{cluster=\"$cluster\", job=\"$job\"})", "interval": "", "legendFormat": "Real Linux", "range": true, @@ -1236,7 +1236,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "avg(sum by (instance, cpu) (rate(node_cpu_seconds_total{mode!~\"idle|iowait|steal\", cluster=\"$cluster\"}[$__rate_interval])))", + "expr": "avg(sum by (instance, cpu) (rate(node_cpu_seconds_total{mode!~\"idle|iowait|steal\", cluster=\"$cluster\", job=\"$job\"}[$__rate_interval])))", "interval": "$resolution", "legendFormat": "Linux", "range": true, @@ -1370,7 +1370,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "sum(node_memory_MemTotal_bytes{cluster=\"$cluster\"} - node_memory_MemAvailable_bytes{cluster=\"$cluster\"}) / sum(node_memory_MemTotal_bytes{cluster=\"$cluster\"})", + "expr": "sum(node_memory_MemTotal_bytes{cluster=\"$cluster\", job=\"$job\"} - node_memory_MemAvailable_bytes{cluster=\"$cluster\", job=\"$job\"}) / sum(node_memory_MemTotal_bytes{cluster=\"$cluster\", job=\"$job\"})", "interval": "$resolution", "legendFormat": "Linux", "range": true, @@ -1716,7 +1716,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "avg(sum by (instance, cpu) (rate(node_cpu_seconds_total{mode!~\"idle|iowait|steal\", cluster=\"$cluster\"}[$__rate_interval]))) by (instance)", + "expr": "avg(sum by (instance, cpu) (rate(node_cpu_seconds_total{mode!~\"idle|iowait|steal\", cluster=\"$cluster\", job=\"$job\"}[$__rate_interval]))) by (instance)", "interval": "$resolution", "legendFormat": "{{ node }}", "range": true, @@ -1834,7 +1834,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "sum(node_memory_MemTotal_bytes{cluster=\"$cluster\"} - node_memory_MemAvailable_bytes{cluster=\"$cluster\"}) by (instance)", + "expr": "sum(node_memory_MemTotal_bytes{cluster=\"$cluster\", job=\"$job\"} - node_memory_MemAvailable_bytes{cluster=\"$cluster\", job=\"$job\"}) by (instance)", "hide": false, "interval": "$resolution", "legendFormat": "{{ instance }}", @@ -2067,7 +2067,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "sum(rate(node_cpu_core_throttles_total{cluster=\"$cluster\"}[$__rate_interval])) by (instance)", + "expr": "sum(rate(node_cpu_core_throttles_total{cluster=\"$cluster\", job=\"$job\"}[$__rate_interval])) by (instance)", "interval": "$resolution", "legendFormat": "{{ instance }}", "range": true, @@ -2626,7 +2626,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "sum(rate(node_network_receive_bytes_total{device!~\"(veth|azv|lxc).*\", cluster=\"$cluster\"}[$__rate_interval])) by (device)", + "expr": "sum(rate(node_network_receive_bytes_total{device!~\"(veth|azv|lxc).*\", cluster=\"$cluster\", job=\"$job\"}[$__rate_interval])) by (device)", "interval": "$resolution", "legendFormat": "Received : {{ device }}", "range": true, @@ -2639,7 +2639,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "- sum(rate(node_network_transmit_bytes_total{device!~\"(veth|azv|lxc).*\", cluster=\"$cluster\"}[$__rate_interval])) by (device)", + "expr": "- sum(rate(node_network_transmit_bytes_total{device!~\"(veth|azv|lxc).*\", cluster=\"$cluster\", job=\"$job\"}[$__rate_interval])) by (device)", "interval": "$resolution", "legendFormat": "Transmitted : {{ device }}", "range": true, @@ -2765,7 +2765,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "sum(rate(node_network_receive_drop_total{cluster=\"$cluster\"}[$__rate_interval]))", + "expr": "sum(rate(node_network_receive_drop_total{cluster=\"$cluster\", job=\"$job\"}[$__rate_interval]))", "interval": "$resolution", "legendFormat": "Linux Packets dropped (receive)", "range": true, @@ -2778,7 +2778,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "- sum(rate(node_network_transmit_drop_total{cluster=\"$cluster\"}[$__rate_interval]))", + "expr": "- sum(rate(node_network_transmit_drop_total{cluster=\"$cluster\", job=\"$job\"}[$__rate_interval]))", "interval": "$resolution", "legendFormat": "Linux Packets dropped (transmit)", "range": true, @@ -3060,7 +3060,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "sum(rate(node_network_receive_bytes_total{cluster=\"$cluster\"}[$__rate_interval])) by (instance)", + "expr": "sum(rate(node_network_receive_bytes_total{cluster=\"$cluster\", job=\"$job\"}[$__rate_interval])) by (instance)", "interval": "$resolution", "legendFormat": "Received bytes in {{ instance }}", "range": true, @@ -3072,7 +3072,7 @@ "uid": "${datasource}" }, "editorMode": "code", - "expr": "- sum(rate(node_network_transmit_bytes_total{cluster=\"$cluster\"}[$__rate_interval])) by (instance)", + "expr": "- sum(rate(node_network_transmit_bytes_total{cluster=\"$cluster\", job=\"$job\"}[$__rate_interval])) by (instance)", "hide": false, "interval": "$resolution", "legendFormat": "Transmitted bytes in {{ instance }}", @@ -3199,7 +3199,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "sum(rate(node_network_receive_bytes_total{device!~\"(veth|azv|lxc|lo).*\", cluster=\"$cluster\"}[$__rate_interval])) by (instance)", + "expr": "sum(rate(node_network_receive_bytes_total{device!~\"(veth|azv|lxc|lo).*\", cluster=\"$cluster\", job=\"$job\"}[$__rate_interval])) by (instance)", "interval": "$resolution", "legendFormat": "Received bytes in {{ instance }}", "range": true, @@ -3211,7 +3211,7 @@ "uid": "${datasource}" }, "editorMode": "code", - "expr": "- sum(rate(node_network_transmit_bytes_total{device!~\"(veth|azv|lxc|lo).*\", cluster=\"$cluster\"}[$__rate_interval])) by (instance)", + "expr": "- sum(rate(node_network_transmit_bytes_total{device!~\"(veth|azv|lxc|lo).*\", cluster=\"$cluster\", job=\"$job\"}[$__rate_interval])) by (instance)", "hide": false, "interval": "$resolution", "legendFormat": "Transmitted bytes in {{ instance }}", @@ -3339,7 +3339,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "sum(rate(node_network_receive_bytes_total{device=\"lo\", cluster=\"$cluster\"}[$__rate_interval])) by (instance)", + "expr": "sum(rate(node_network_receive_bytes_total{device=\"lo\", cluster=\"$cluster\", job=\"$job\"}[$__rate_interval])) by (instance)", "interval": "$resolution", "legendFormat": "Received bytes in {{ instance }}", "range": true, @@ -3351,7 +3351,7 @@ "uid": "${datasource}" }, "editorMode": "code", - "expr": "- sum(rate(node_network_transmit_bytes_total{device=\"lo\", cluster=\"$cluster\"}[$__rate_interval])) by (instance)", + "expr": "- sum(rate(node_network_transmit_bytes_total{device=\"lo\", cluster=\"$cluster\", job=\"$job\"}[$__rate_interval])) by (instance)", "hide": false, "interval": "$resolution", "legendFormat": "Transmitted bytes in {{ instance }}", @@ -3458,6 +3458,33 @@ "queryValue": "", "skipUrlSync": false, "type": "custom" + }, + { + "current": { + "selected": false, + "text": "", + "value": "" + }, + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "definition": "label_values(node_cpu_seconds_total{cluster=\"$cluster\"},job)", + "hide": 0, + "includeAll": false, + "multi": true, + "name": "job", + "options": [], + "query": { + "qryType": 1, + "query": "label_values(node_cpu_seconds_total{cluster=\"$cluster\"},job)", + "refId": "PrometheusVariableQueryEditor-VariableQuery" + }, + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 1, + "type": "query" } ] }, @@ -3469,6 +3496,6 @@ "timezone": "", "title": "Kubernetes / Views / Global", "uid": "k8s_views_global", - "version": 38, + "version": 39, "weekStart": "" }