Hello! New user to Grafana here, trying to set up a stat panel that renders a simple UP or DOWN string depending on the value of a particular metric returned by a Prometheus data source.
To this end, I set up the query to instant
so that the very last data point is returned but, when the query does not return a value – say because the server is down and/or no scraping took place – the stat panel produces no data
.
In the screenshot below, you can see that I added two queries, A and B, but only A is shown in the stat panel and only because it uses the special function absent
. If I use any other function for the A query or disable it altogether, the panel renders “no data”. I can’t get the B query to produce a value no matter which function I use or reduction I apply.
How do I configure/build the query so that it returns a 0 (or nulls/NaN/something) instead when the query returns an empty dataset so I can do something with it?
This is infuriating.