I have a singlestat panel that I repeat for all hosts. Currently I check for the last(system.n_cpus) field over the past 2 minutes and map any positive result to Up and null to Down. This works in terms of displaying Up and Down for a host that is up or down, respectively. However with a colour mapping of 1,1 I can only get Up to display in green, Down does not display in red as null is not a mappable value. I cannot figure out an influxdb query to get an actual result if there is no data in the query (i.e. host is down). I have reviewed several posts and see no solution.
How do I write an influxdb query in Grafana using singlestat panel (or similar) and show Down in red? Remember, Down will only be displayed if there had been no data for the past 2 minutes, and influxdb does not seem to ever return 0 as count() - just an empty series which is not colour mappable in singlestat panel. I even considered calculating the age of the last timestamp but cannot figure out an influxdb query to do this.