Add a column of "time difference from now" in Grafana table plugin

I use Grafana table plugin to load a list of alarms stored on InfluxDB onto my Grafana dashboard as shown above. I want to add another column to this table to show how much time has passed since each alarm. I tried the followings on InfluxDB:

  • Execute a select statement like “select now() - time from alarms”
    • there’s no function now() in InfluxDB
  • Getting the latest time from _internal.runtime and use the last time instead of now()
    • cannot use select statement from two measurements

Is it possible only using InfluxQL? Otherwise, should I modify Grafana table plugin to achieve the goal?

InfluxDB does have a now function: https://docs.influxdata.com/influxdb/v1.3/concepts/glossary/#now

and it looks your query should be possible. See example here adding 180w onto now:

SELECT MEAN(“boards”) FROM “hillvalley” WHERE time >= ‘2015-09-18T21:30:00Z’ AND time <= now() + 180w GROUP BY time(12m) fill(none)

You have used the now() function in the where clause and not in the select statement. Is it possible to use the now() function with some arithmetic operation in the select clause. Something like now()-4h.

No idea. Have you asked on the InfluxDB community site? https://community.influxdata.com/

I agree with you; now() is not supported in the select clause.

I need to ask to InfluxDB community instead :wink:

Did you find any solution for this? I’m also trying to do same