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
Fixes: #86
  • Loading branch information
uhthomas committed Dec 20, 2023
1 parent 604720b commit e04a0b9
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 @@ -150,7 +150,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "avg(1-rate(node_cpu_seconds_total{mode=\"idle\", cluster=\"$cluster\"}[$__rate_interval]))",
"expr": "avg(sum by (cpu) (rate(node_cpu_seconds_total{mode!~\"idle|iowait|steal\", cluster=\"$cluster\"}[$__rate_interval])))",
"interval": "",
"legendFormat": "Real",
"range": true,
Expand Down Expand Up @@ -701,7 +701,7 @@
},
"editorMode": "code",
"exemplar": true,
"expr": "sum(1-rate(node_cpu_seconds_total{mode=\"idle\", cluster=\"$cluster\"}[$__rate_interval]))",
"expr": "sum(rate(node_cpu_seconds_total{mode!~\"idle|iowait|steal\", cluster=\"$cluster\"}[$__rate_interval]))",
"interval": "",
"legendFormat": "Real",
"range": true,
Expand Down Expand Up @@ -1020,7 +1020,7 @@
"uid": "${datasource}"
},
"exemplar": true,
"expr": "avg(1-rate(node_cpu_seconds_total{mode=\"idle\", cluster=\"$cluster\"}[$__rate_interval]))",
"expr": "avg(sum by (cpu) (rate(node_cpu_seconds_total{mode!~\"idle|iowait|steal\", cluster=\"$cluster\"}[$__rate_interval])))",
"interval": "$resolution",
"legendFormat": "CPU usage in %",
"refId": "A"
Expand Down Expand Up @@ -1435,7 +1435,7 @@
"uid": "${datasource}"
},
"exemplar": true,
"expr": "avg(1-rate(node_cpu_seconds_total{mode=\"idle\", cluster=\"$cluster\"}[$__rate_interval])) by (instance)",
"expr": "avg(sum by (cpu, instance) (rate(node_cpu_seconds_total{mode!~\"idle|iowait|steal\", cluster=\"$cluster\"}[$__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 @@ -156,7 +156,7 @@
"uid": "${datasource}"
},
"exemplar": false,
"expr": "avg(1-rate(node_cpu_seconds_total{mode=\"idle\", instance=\"$instance\", cluster=\"$cluster\"}[$__rate_interval]))",
"expr": "avg(sum by (cpu) (rate(node_cpu_seconds_total{mode!~\"idle|iowait|steal\", instance=\"$instance\", cluster=\"$cluster\"}[$__rate_interval])))",
"instant": true,
"interval": "$resolution",
"legendFormat": "",
Expand Down Expand Up @@ -576,7 +576,7 @@
"uid": "${datasource}"
},
"exemplar": false,
"expr": "sum(1-rate(node_cpu_seconds_total{mode=\"idle\", instance=\"$instance\", cluster=\"$cluster\"}[$__rate_interval]))",
"expr": "sum(rate(node_cpu_seconds_total{mode!~\"idle|iowait|steal\", instance=\"$instance\", cluster=\"$cluster\"}[$__rate_interval]))",
"instant": true,
"interval": "$resolution",
"legendFormat": "",
Expand Down

0 comments on commit e04a0b9

Please sign in to comment.