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
On Wed, Mar 10, 2021, 06:38 saipradeep bojja <[email protected]>
wrote:
> 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.
> On Saturday, 6 March 2021 at 14:08:10 UTC+5:30 [email protected]
> wrote:
>
>> I am not sure I understand what percentage you mean … can you explain
>> more what you want to measure?
>>
>> /MR
>>
>> On Fri, Mar 5, 2021, 15:13 saipradeep bojja <[email protected]>
>> wrote:
>>
>>> 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.
>>>
>>> --
>>> 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 [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/prometheus-users/f6fb33e7-1c00-4809-9774-8ae59b47e792n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/prometheus-users/f6fb33e7-1c00-4809-9774-8ae59b47e792n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/prometheus-users/377aa6e6-ae46-4f24-8c59-3a418dbd9df7n%40googlegroups.com
> <https://groups.google.com/d/msgid/prometheus-users/377aa6e6-ae46-4f24-8c59-3a418dbd9df7n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/prometheus-users/CAMV%3D_ga5rBLztYGkXZbNqV-oJZnxwET%3D9wH5%2BxfLtNXZsu%2B%2Bqw%40mail.gmail.com.