From 1684aa9e77ad2d81ede30da1d43dd5c7d20f518a Mon Sep 17 00:00:00 2001 From: Thomas Lemarchand Date: Wed, 11 Jan 2023 09:48:51 +0100 Subject: [PATCH] fix: dashboard showing metrics from nodes outside of kubernetes cluster --- dashboards/k8s-views-global.json | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/dashboards/k8s-views-global.json b/dashboards/k8s-views-global.json index 297c819..7aff32d 100644 --- a/dashboards/k8s-views-global.json +++ b/dashboards/k8s-views-global.json @@ -148,7 +148,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "avg(1-rate(node_cpu_seconds_total{mode=\"idle\"}[$__rate_interval]))", + "expr": "avg(1-rate(node_cpu_seconds_total{mode=\"idle\", job=\"node-exporter\"}[$__rate_interval]))", "interval": "", "legendFormat": "Real", "range": true, @@ -244,7 +244,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "sum(node_memory_MemTotal_bytes - node_memory_MemAvailable_bytes) / sum(node_memory_MemTotal_bytes)", + "expr": "sum(node_memory_MemTotal_bytes{job=\"node-exporter\"} - node_memory_MemAvailable_bytes{job=\"node-exporter\"}) / sum(node_memory_MemTotal_bytes{job=\"node-exporter\"})", "interval": "", "legendFormat": "Real", "range": true, @@ -690,7 +690,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "sum(1-rate(node_cpu_seconds_total{mode=\"idle\"}[$__rate_interval]))", + "expr": "sum(1-rate(node_cpu_seconds_total{mode=\"idle\", job=\"node-exporter\"}[$__rate_interval]))", "interval": "", "legendFormat": "Real", "range": true, @@ -789,7 +789,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "sum(node_memory_MemTotal_bytes - node_memory_MemAvailable_bytes)", + "expr": "sum(node_memory_MemTotal_bytes{job=\"node-exporter\"} - node_memory_MemAvailable_bytes{job=\"node-exporter\"})", "interval": "", "legendFormat": "Real", "range": true, @@ -1005,7 +1005,7 @@ "uid": "${datasource}" }, "exemplar": true, - "expr": "avg(1-rate(node_cpu_seconds_total{mode=\"idle\"}[$__rate_interval]))", + "expr": "avg(1-rate(node_cpu_seconds_total{mode=\"idle\", job=\"node-exporter\"}[$__rate_interval]))", "interval": "$resolution", "legendFormat": "CPU usage in %", "refId": "A" @@ -1109,7 +1109,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "sum(node_memory_MemTotal_bytes - node_memory_MemAvailable_bytes) / sum(node_memory_MemTotal_bytes)", + "expr": "sum(node_memory_MemTotal_bytes{job=\"node-exporter\"} - node_memory_MemAvailable_bytes{job=\"node-exporter\"}) / sum(node_memory_MemTotal_bytes{job=\"node-exporter\"})", "interval": "$resolution", "legendFormat": "Memory usage in %", "range": true, @@ -1415,7 +1415,7 @@ "uid": "${datasource}" }, "exemplar": true, - "expr": "avg(1-rate(node_cpu_seconds_total{mode=\"idle\"}[$__rate_interval])) by (instance)", + "expr": "avg(1-rate(node_cpu_seconds_total{mode=\"idle\", job=\"node-exporter\"}[$__rate_interval])) by (instance)", "interval": "$resolution", "legendFormat": "{{ node }}", "refId": "A" @@ -1516,7 +1516,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "sum(node_memory_MemTotal_bytes - node_memory_MemAvailable_bytes) by (instance)", + "expr": "sum(node_memory_MemTotal_bytes{job=\"node-exporter\"} - node_memory_MemAvailable_bytes{job=\"node-exporter\"}) by (instance)", "interval": "$resolution", "legendFormat": "{{ node}}", "range": true, @@ -1629,7 +1629,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "sum(rate(node_network_receive_bytes_total[$__rate_interval]))", + "expr": "sum(rate(node_network_receive_bytes_total{job=\"node-exporter\"}[$__rate_interval]))", "interval": "$resolution", "legendFormat": "Total received bytes", "range": true, @@ -1642,7 +1642,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "- sum(rate(node_network_transmit_bytes_total[$__rate_interval]))", + "expr": "- sum(rate(node_network_transmit_bytes_total{job=\"node-exporter\"}[$__rate_interval]))", "interval": "$resolution", "legendFormat": "Total transmitted bytes", "range": true, @@ -1738,7 +1738,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "sum(rate(node_network_receive_drop_total[$__rate_interval]))", + "expr": "sum(rate(node_network_receive_drop_total{job=\"node-exporter\"}[$__rate_interval]))", "interval": "$resolution", "legendFormat": "Packets dropped (receive)", "range": true, @@ -1751,7 +1751,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "- sum(rate(node_network_transmit_drop_total[$__rate_interval]))", + "expr": "- sum(rate(node_network_transmit_drop_total{job=\"node-exporter\"}[$__rate_interval]))", "interval": "$resolution", "legendFormat": "Packets dropped (transmit)", "range": true, @@ -1956,7 +1956,7 @@ }, "editorMode": "code", "exemplar": true, - "expr": "sum(rate(node_network_receive_bytes_total[$__rate_interval])) by (instance)", + "expr": "sum(rate(node_network_receive_bytes_total{job=\"node-exporter\"}[$__rate_interval])) by (instance)", "interval": "$resolution", "legendFormat": "Received bytes in {{ instance }}", "range": true, @@ -1968,7 +1968,7 @@ "uid": "${datasource}" }, "editorMode": "code", - "expr": "- sum(rate(node_network_transmit_bytes_total[$__rate_interval])) by (instance)", + "expr": "- sum(rate(node_network_transmit_bytes_total{job=\"node-exporter\"}[$__rate_interval])) by (instance)", "hide": false, "interval": "$resolution", "legendFormat": "Transmitted bytes in {{ instance }}",