i just scraped values of uptime from UptimeKuma using Prometheus with a query like this (monitor_status{monitor_name=“Example-Server”}). How can I calculate the total count of values that are 2 ?

If I have a bunch of data with 2’s in it:

you can use couple of transformations: 1st filter out the values equal to 2, then divide the 2’s by themselves to get 1’s, then add up all the 1’s

1 Like

If I want to calculate the total value that contains 0, how do I do it?

you can’t divide by zero, so in that step, add a 1 instead…