Search code examples
grafanainfluxdbinfluxql

How do you get age of last measurement in grafana/influxql?


A watchdog process reports host "liveness" by writing a measurement in influxdb, e.g.

watchdog,host=host_xyz alive=1

I'm interested in showing in Grafana when too much time has passed since the last measurement. Is there a way to query such information from Influx?

(A similar question was asked here also 9 months ago, but there's no answer to it: InfluxQL: age of record Is it possible that a time series database can't give the age of a record?)

Thanks!


Solution

  • In Grafana under Edit > Visualization > Value > Show: you can choose "Time of last point".

    This will show the timestamp of the last point in InfluxDB. This is how I do it.

    The downside to this is that if the timestamp is not added in real time (i.e. you add a previous of future timestamp in InfluxDB) then the data will be off. (though these cases are more rare).