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 authored and dotdc committed Jan 5, 2024
1 parent 203220e commit 5ff5277
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 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 (instance, 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 (instance, 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 (instance, cpu) (rate(node_cpu_seconds_total{mode!~\"idle|iowait|steal\", cluster=\"$cluster\"}[$__rate_interval]))) by (instance)",
"interval": "$resolution",
"legendFormat": "{{ node }}",
"refId": "A"
Expand Down Expand Up @@ -2968,6 +2968,6 @@
"timezone": "",
"title": "Kubernetes / Views / Global",
"uid": "k8s_views_global",
"version": 34,
"version": 35,
"weekStart": ""
}
6 changes: 3 additions & 3 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 Expand Up @@ -3933,6 +3933,6 @@
"timezone": "",
"title": "Kubernetes / Views / Nodes",
"uid": "k8s_views_nodes",
"version": 25,
"version": 26,
"weekStart": ""
}

0 comments on commit 5ff5277

Please sign in to comment.