简体   繁体   中英

Report a metric to Prometheus every hour, or every day

I'm using Prometheus to report metrics about my system. I wanted to ask what is the best way to report a counter which is an output of an hourly/daily job.

For example I have an hourly job with a numeric output and I would like to monitor the number and raise an alert if it is under a specific threshold.

Thanks, Ori

I think what you are looking for is inside the node_exporter collector, if you read the doc you will see a textfile collector option inside it.

If you use cron job, I suggest you store the attended result inside a file and use this collector to get the datas.

You will find a bit more detail about how to do it here: https://www.robustperception.io/using-the-textfile-collector-from-a-shell-script

You can use push gateway and push the metrics into prometheus at end of your hourly / daily job (if it is not running as a service). If it is running as a service i hope you are aware of scrape interval configuration.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM