Search code examples
grafanaprometheusprometheus-node-exporter

Trigger alert in prometheus/grafana for timestamp from node-exporter too old


We've got node_exporter running, and I am using the textfile collector to let me put in a timestamp of a file modified by a job.

The metrics output:

# HELP job_timestamp_file Metric read from /usr/local/etc/node_exporter/job-timestamp.prom
# TYPE job_timestamp_file untyped
job_timestamp_file 1.567657381e+09

So we've successfully collected that in prometheus. What my prom guy and I are having problems with, both being pretty new to prometheus and grafana, is how to write the query to trigger an alert if

current-epoch-time - job_timestamp_file > 86400

Which really seems like it ought to be easy...


Solution

  • time() - job_timestamp_file > 86400

    The node exporter also exposes the mtime of the files it reads via the textfile collector.