Skip to content

Commit

Permalink
fix: match all non-idle cpu modes when calculating total cpu usage
Browse files Browse the repository at this point in the history
Fixes: #80
  • Loading branch information
uhthomas committed Dec 18, 2023
1 parent b25aca7 commit 7d387be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions dashboards/k8s-views-global.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "avg(1-rate(node_cpu_seconds_total{mode=\"idle\"}[$__rate_interval]))",
"expr": "avg(rate(node_cpu_seconds_total{mode!=\"idle\"}[$__rate_interval]))",
"interval": "",
"legendFormat": "Real",
"range": true,
Expand Down Expand Up @@ -694,7 +694,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "sum(1-rate(node_cpu_seconds_total{mode=\"idle\"}[$__rate_interval]))",
"expr": "sum(rate(node_cpu_seconds_total{mode!=\"idle\"}[$__rate_interval]))",
"interval": "",
"legendFormat": "Real",
"range": true,
Expand Down Expand Up @@ -1009,7 +1009,7 @@
"uid": "${datasource}"
},
"exemplar": true,
"expr": "avg(1-rate(node_cpu_seconds_total{mode=\"idle\"}[$__rate_interval]))",
"expr": "avg(rate(node_cpu_seconds_total{mode!=\"idle\"}[$__rate_interval]))",
"interval": "$resolution",
"legendFormat": "CPU usage in %",
"refId": "A"
Expand Down Expand Up @@ -1419,7 +1419,7 @@
"uid": "${datasource}"
},
"exemplar": true,
"expr": "avg(1-rate(node_cpu_seconds_total{mode=\"idle\"}[$__rate_interval])) by (instance)",
"expr": "avg(rate(node_cpu_seconds_total{mode!=\"idle\"}[$__rate_interval])) by (instance)",
"interval": "$resolution",
"legendFormat": "{{ node }}",
"refId": "A"
Expand Down
4 changes: 2 additions & 2 deletions dashboards/k8s-views-nodes.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
"uid": "${datasource}"
},
"exemplar": false,
"expr": "avg(1-rate(node_cpu_seconds_total{mode=\"idle\", instance=\"$instance\"}[$__rate_interval]))",
"expr": "avg(rate(node_cpu_seconds_total{mode!=\"idle\", instance=\"$instance\"}[$__rate_interval]))",
"instant": true,
"interval": "$resolution",
"legendFormat": "",
Expand Down Expand Up @@ -570,7 +570,7 @@
"uid": "${datasource}"
},
"exemplar": false,
"expr": "sum(1-rate(node_cpu_seconds_total{mode=\"idle\", instance=\"$instance\"}[$__rate_interval]))",
"expr": "sum(rate(node_cpu_seconds_total{mode!=\"idle\", instance=\"$instance\"}[$__rate_interval]))",
"instant": true,
"interval": "$resolution",
"legendFormat": "",
Expand Down

0 comments on commit 7d387be

Please sign in to comment.