"Stat" dashboard with date value using procstat telegraf plugin

Hi,

I use telegraf with procstat plugin to retrieve the date/time of the start of a process. (data are sent with an intervall of 10 seconds)

So inside my dashboard i run the query below:


from(bucket: "HOME")
  |> range(start: -1m)
  |> filter(fn: (r) => r["_measurement"] == "procstat")
  |> filter(fn: (r) => r["_field"] == "created_at")
  |> filter(fn: (r) => r["exe"] == "myprocess")
  |> last()
  |> map(fn: (r) => ({ r with _value: time(v: r._value ) }))
  |> yield(name: "mean")

When i run this query, if there is a data existing less than one minute it return a table with:
_time = the date / time for the measure
_value = the last date / time when the process has been executed (created_at)

If data are more old than one minute, the query return no data.

The query for me is working, but my problem is when i would like to create a dashboard as “stat” type which display the “created_at” date/time with a green background when the data existing in the last minute, and display something like “No Data” in red background when there is no data since more thane one minute.

I’ve tried a lot of things in the configuration like “Transform” and the configuration of “stat” type but i never success.

If i remove this line from the query , it’s working fine (i convert the timestamp into a date / time type):
|> map(fn: (r) => ({ r with _value: time(v: r._value ) }))

Thanks for your help.