Calculate the percentage for process process exporter

205 views
Skip to first unread message

saipradeep bojja

unread,
Mar 5, 2021, 9:13:44 AM3/5/21
to Prometheus Users
Hi
 We have installed the process exporter in Linux machines to monitor the processes in Prometheus. We are monitoring the processess using  "namedprocess_namegroup_num_procs" and "namedprocess_namegroup_states".

We are getting the values more than 1 for each processess. So that we are not able to calculate the the values in percentage.

Solution 
Solution that we have tried is "avg_over_time(namedprocess_namegroup_num_procs{job=~"Appops_.*"} [$__interval]) >bool 0 "
to make the value either 0 or 1 So that it will be easy to calculate in percentage. But we are not getting the correct values in percentage.   
 
Please help us on the Calculating the percentage for the processess.

Matthias Rampke

unread,
Mar 6, 2021, 3:38:10 AM3/6/21
to saipradeep bojja, Prometheus Users
I am not sure I understand what percentage you mean … can you explain more what you want to measure?

/MR

--
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 prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/f6fb33e7-1c00-4809-9774-8ae59b47e792n%40googlegroups.com.

saipradeep bojja

unread,
Mar 10, 2021, 12:38:38 AM3/10/21
to Prometheus Users
Hi,

Here we are trying to calculate availability percentage of the processes of the linux which we are getting from the metric name "namedprocess_namegroup_num_procs" in process exporter. So depending upon the thread count the values will be like(5 or 13 or 545). 
We are trying get the Availability report in percentage. 

My question is How can we get percentage of process as value is  not 1 or 0?

Solution that we have tried is "avg_over_time(namedprocess_namegroup_num_procs{job=~"Appops_.*"} [$__interval]) >bool 0 "
to make the value either 0 or 1 So that it will be easy to calculate in percentage. But we are not getting the correct values in percentage.

Matthias Rampke

unread,
Mar 11, 2021, 1:27:45 AM3/11/21
to saipradeep bojja, Prometheus Users
Ah, I see. You are on the right track, but you need to apply the "> bool 0" directly to the metric and only then take the average:

avg_over_time( ( namedprocess_namegroup_num_procs{job=~"Appops_.*"} > bool 0 )[$__interval:])

or make a recording rule for

namedprocess_namegroup_num_procs{job=~"Appops_.*"} > bool 0

and average the recorded metric over time.

/MR


Reply all
Reply to author
Forward
0 new messages