Uptime should not depend on grafana current time range

Hi all,
I am trying to display the Uptime of my targets using Grafana and prometheus
I added 2 dashboard:
First is a graph displaying :

node_time_seconds{instance=“$node”,job=“$job”} - node_boot_time_seconds{instance=“$node”,job=“$job”}

Second is a text field displaying exact same metric, but as a Text and option Show=Current.

When I change ‘grafana current time range’ to successive values : Last 5min, Last 15m, … Last 24h,… Last 7d. The value displayed by the Graph always seem to be correct but the value displayed by the Text Dashboard depends on current time range and sometimes is completely incorrect, I tried selecting ‘Show=Time of last point’ & ‘Show=Max’ but the problem is the same: The Uptime displayed by my Text dashboard is wrong and depends on ‘current range time’ when it should not (as long as ‘current range time’ = Last …whatever…)

Hi @ynoblanc ,

I am using this great node exporter dashboard and the uptime feature works like a dream. I would recommend trying it rather than rewriting all those queries yourself. Here is the query they are using for uptime:

sum(time() - node_boot_time_seconds{origin_prometheus=~"$origin_prometheus",job=~"$job"})by(instance)

This topic was automatically closed after 365 days. New replies are no longer allowed.