Simple cpu usage graph

Hey, I want to make a graph that shows cpu utilisation. Just one line between 0-100% showing the cpu utilisation. I’ve seen some cpu utilisation graphs, but they have 6 or something lines in them. I’m searching for a one-line solution. Kind of like the line in taskmanager in windows:
image
Just one line between 0-100%.

I have prometheus and node exporter. How can i do that?
thanks

I have a bar panel with a % CPU load using this “Instant” metric:

100 - (avg(irate(node_cpu_seconds_total{mode="idle"}[30m])) * 100)

I have to admit I don’t really know how accurate this is or exactly what it is measuring but I found it somewhere and it seems to work for my purposes. You may be able to use something similar for a time graph.

2 Likes

I tested it and it works perfectly. Comparing the graph with the output op top, I can say that it’s very accurate. Thanks

Iam facing a big issue i want to map all my three nodes CPU Usage in one graph so which query leads to that can anyone help me

1 Like

To see total CPU utilization in one graph, we have to add two cpu_usage_user & cpu_usage_system

cpu_usage_user{host=~“(hostname-.)“}+cpu_usage_system{host=~”(hostname-.)”}

or

cpu_usage_user{host=“hostname”}+cpu_usage_system{host=“hostname”}