[Promql] How do I know if a value hasn't changed in a while?

16 views
Skip to first unread message

Adso Castro

unread,
Apr 11, 2020, 7:05:56 PM4/11/20
to Prometheus Users
That's the question, there's a metric: jobs_sent 1728
I want to know if that value hasn't changed in 1h for example.
How do I do that?

Thank you

Christian Hoffmann

unread,
Apr 12, 2020, 2:53:05 AM4/12/20
to Adso Castro, Prometheus Users
Hi,

On 4/12/20 1:05 AM, Adso Castro wrote:
> That's the question, there's a metric: *jobs_sent 1728*
> I want to know if that value hasn't changed in 1h for example.
> How do I do that?

changes(jobs_sent[1h]) == 0 could do the trick.

In many cases it might be easier to add an additional metric with the
timestamp of the last change (as they node_exporter's textfile collector
and the pushgateway do). This is easier / more explicit to alert on.

Kind regards,
Christian

Adso Castro

unread,
Apr 12, 2020, 9:02:59 AM4/12/20
to Christian Hoffmann, Prometheus Users
That did the magic, thank you very much Christian!

Have a nice one!
--
Adso Castro
55+ 11 95368 4969
Reply all
Reply to author
Forward
0 new messages