How can I get top 10 cpu usage processes ? The instance_cpu_time_ns metric missed

Skip to first unread message

Apr 25, 2017, 4:33:25 AM4/25/17
to Prometheus Users

I would like gather data about top 10 cpu usage processes on the Linux host.

I read in a documentation that it's possible using the instance_cpu_time_ns metric.

But when I try find what collector, in the node_exporter component, exposes that metric  I see that it's not implemented (?).

Do you have any suggestion how can I achieve it? Thank you!


Ben Kochie

Apr 25, 2017, 4:58:10 AM4/25/17
to, Prometheus Users
This is not something we recommend tracking with Prometheus.

The problem is that tracking individual processes is going to be an infinite namespace.  You would need to have a label for the PID, and the process name, in order to maintain uniqueness.  Some systems can generate thousands of processes per second, which is far too much cardinality churn for Prometheus.

If you use a supervisor like systemd or docker, you can use cAdvisor to expose container CPU usage metrics.  This would reduce the cardinality to container names, which would be much more possible to track.

You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
To view this discussion on the web visit
For more options, visit

Jan 20, 2019, 1:28:32 PM1/20/19
to Prometheus Users

I am looking into similar check of top 3 cpu and memory and not using docker /containerization. Just would like to know how you implemented these checks ?

Jan 25, 2019, 7:16:45 AM1/25/19
to Prometheus Users
yes, you can do it using process exporter and the use aggregation to plot your graphs in grafana. 

Refer below link to set up process exporter.

then use aggregation like, topk(3,cpu_system_seconds_total counter)

this query will give you top 3 cpu consuming processes.

Jan 25, 2019, 4:09:23 PM1/25/19
to Prometheus Users
Thank you, Deependra. I will try it out.
Reply all
Reply to author
0 new messages