Show "no data" as 0 with multiple time series

  • What Grafana version and what operating system are you using?

  • What are you trying to achieve?
    I have some SNMP data in Prometheus that sometimes returns “no data” for the up metric and I want to count those as 0 instead, to visualize in Grafana stat panel.

  • How are you trying to achieve it?
    For a single time series I can achieve this by adding OR on() vector(0) to the end of the PromQL query. But this doesn’t work when the query returns multiple series.

  • What happened?
    Here’s an example stat panel that should show 1 all the time, but it’s flapping to 0 when the target reports no data. I’ve tried playing around with lots of different query options, but I’m out of ideas.

This is how the raw data looks in Prometheus. Of these 3 series, 2 are always up and the other one flaps between 0 and “no data”.

1 Like

Logically it should be ** or on() group_left vector(0), but grouping is not supported for set operators.