ncabatoff / process-exporter

Prometheus exporter that mines /proc to report on selected processes
MIT License
1.7k stars 269 forks source link

Not getting CPU Metrics #261

Open sumitsharma16 opened 1 year ago

sumitsharma16 commented 1 year ago

Query

topk(5,(rate(namedprocess_namegroup_cpu_user_seconds_total{groupname=~"$processes",instance=~"$host"}[$interval]) + rate(namedprocess_namegroup_cpu_system_seconds_total{groupname=~"$processes",instance=~"$host"}[$interval])) or (irate(namedprocess_namegroup_cpu_user_seconds_total{groupname=~"$processes",instance=~"$host"}[5m]) + irate(namedprocess_namegroup_cpu_system_seconds_total{groupname=~"$processes",instance=~"$host"}[5m])))

As checked on /metrics it is not able to find

namedprocess_namegroup_cpu_user_seconds_total namedprocess_namegroup_cpu_system_seconds_total

Screenshot FYR:

image

Please let us know if the metrics name is changed. I am getting all the metrics except this one.

sumitsharma16 commented 1 year ago

Hi Team any update on this?

sumitsharma16 commented 1 year ago

any update?

steinbrueckri commented 1 year ago

@sumitsharma16 Can you provide some information about your System the version you are using and past also your config file? Without this information is impossible to help you at all. Also, see writing-a-proper-github-issue.

b0yanchuk commented 1 year ago

@sumitsharma16 try use:

topk(5,(rate(namedprocess_namegroup_cpu_seconds_total{groupname=~"$processes",instance=~"$host"}[$interval]) 
+
rate(namedprocess_namegroup_thread_cpu_seconds_total{groupname=~"$processes",instance=~"$host"}[$interval]))
or 
(irate(namedprocess_namegroup_cpu_seconds_total{groupname=~"$processes",instance=~"$host"}[5m])
+
irate(namedprocess_namegroup_cpu_seconds_total{groupname=~"$processes",instance=~"$host"}[5m])))

It's work for me

flakrat commented 1 year ago

The OP is referencing the Grafana dashboard System Process Metrics #8378

There are 2 graphs at the top that don't work, while all of the other graphs do have data. I'm exporting from 2 clients; Ubuntu 22.04 and RHEL 7 using the following install packages on the clients:

topk(5,(rate(namedprocess_namegroup_cpu_user_seconds_total{groupname=~".+",instance=~"$host"}[1m]) 
+
rate(namedprocess_namegroup_cpu_system_seconds_total{groupname=~".+",instance=~"$host"}[1m]))
or 
(irate(namedprocess_namegroup_cpu_user_seconds_total{groupname=~".+",instance=~"$host"}[5m])
+
irate(namedprocess_namegroup_cpu_system_seconds_total{groupname=~".+",instance=~"$host"}[5m])))
topk(5,
rate(namedprocess_namegroup_cpu_system_seconds_total{groupname=~".+",instance=~"$host"}[1m])
or 
(
irate(namedprocess_namegroup_cpu_system_seconds_total{groupname=~".+",instance=~"$host"}[5m])))

The namedprocess_namegroup_cpu_user_seconds_total and namedprocess_namegroup_cpu_system_seconds_total metrics don't exist in the output on either of my clients

> curl http://localhost:9256/metrics | grep -E 'namedprocess_namegroup_cpu_user_seconds_total|namedprocess_namegroup_cpu_system_seconds_total'

...nothing returned...

I'm using the following client side config file /etc/process-exporter/all.yaml

process_names:
  - name: "{{.ExeBase}};{{.Username}}"
    cmdline:
    - '.+'

Could this be an issue with the client side config?

flakrat commented 1 year ago

And the above client config comes from this blog: https://vimalselvam.com/post/prometheus-capturing-username-in-process-exporter/

flakrat commented 1 year ago

@sumitsharma16 try use:

topk(5,(rate(namedprocess_namegroup_cpu_seconds_total{groupname=~"$processes",instance=~"$host"}[$interval]) 
+
rate(namedprocess_namegroup_thread_cpu_seconds_total{groupname=~"$processes",instance=~"$host"}[$interval]))
or 
(irate(namedprocess_namegroup_cpu_seconds_total{groupname=~"$processes",instance=~"$host"}[5m])
+
irate(namedprocess_namegroup_cpu_seconds_total{groupname=~"$processes",instance=~"$host"}[5m])))

It's work for me Thanks, editing the query in graph "Process CPU Usage" with your suggestion fixed it.

Now I'm on to graph 2 "Top processes by System CPU cores used"

flakrat commented 1 year ago

This appears to work

topk(5,
rate(namedprocess_namegroup_cpu_seconds_total{groupname=~"$processes",instance=~"$host"}[$interval])
or 
(
irate(namedprocess_namegroup_cpu_seconds_total{groupname=~"$processes",instance=~"$host"}[5m])))