I would like to set up a Grafana dashboard. I’m receiving my metrics from Node Exporter and I send the query into Prometheus.
On this Dashboard I would like to monitor whether a host is down or not. Currently I’m using the following query:
up{instance="host:port", job="node-exporter"}
I’m making the assumption that in case Node Exporter is unavailable then the whole host is down or at least there’s a serious issue which we should look into. This query either returns 1
or 0
depending on whether the given job is working or not. I can set up single value boxes for this or a table or a Polystat. Anyhow: the representation of the host should turn from green to red.
However there are cases when instead of getting a 0
value I get No datapoints found.
. This obviously means that something is not right and we should do something asap, however in this case the visual representation of the host simply disappears from the Dashboard. This is something which is hard to notice and very annoying.
Is there a way to set up some sort of default value for these cases? So if No datapoints found.
just return 0
.
Example:
In an ideal case, I see this many hosts (as you can see one of the hosts is down and I get a proper 0
back instead of No data points
):
However if for some hosts I get the No datapoints found.
error, I see only this many, which is not right:
I would like to see the missing nodes turned to red instead of disappearing.
How could I do that?