Coloration based on date with thresholds/overrides

Dear all,

I’m using prometheus as data source and one of the metrics is the last success backup in seconds from 1970 (epoch / unix timestamp).

I can easily graph that on Grafana 7.2:

The query is last_success_backup{url="$my_site"} * 1000 and Filed / Options / Unit is “Datetime ISO”.

I’m looking for a way to add an hidden value (i.e. time() - last_success_backup{url="$my_site"}) that would be used to color the panel with thresolds if the value is higher than 86400 (a day) or more.

I’ve looked into thresholds, overrides, transform (Add field from calculation) and I want to believe that I’m close to find the correct way to achieve that but I’m sure that I’m missing something.

Is there a way to add hidden value that can be used as threshold/override ?

Thanks for any leads,

PS: my question is related to 20025 while for Grafana 7.2

I do not believe there is a way to do this.

Well, I did find an acceptable solution:

  1. Query = time() - last_success_backup{url="$my_site"}
  2. Field > Options > Unit = seconds (s)
  3. Thresholds level in seconds:
    • one day: 86400
    • 2 days: 172800
    • 3 days: 259200

While it’s not done with a ISO date, it’s still useable, colorable and the unit will change accordingly (btw it would be great to have a ‘s’ to “hours” when more than one).

This is an example of coloration:

I would be interested in any other way to achieve that, but for now I will go with it.

1 Like

I’m also interested in this, but unfortunately have not been able to get something like this working with Graphite as a source :(.