I’m using Grafana v9, InfluxDB as data source, and telegraf as metrics collector.
I would like to make sure CRON service is always running on my Linux host. I have automated jobs that must run each day.
If CRON service somehow is off, I would like to trigger an alert.
This is what I currently have using procstat:
SELECT mean(“cpu_usage”) FROM “procstat” WHERE (“host” =~ /hostname/ AND “process_name” =~ /crond/) AND $timeFilter GROUP BY time($_interval), “process_name” , “host” fill(linear)
I stop the service on the linux server and I do receive an alert, but on the alert this is what I receive.
Firing
Value: [no value]
Labels:
- Host = [no value]
- Service = [no value]
- source = [no value]
Annotations:
I expect to have the host name and process name instead of “[no value]”.
I understand that since the service is off, no data will be given, but how can I make those labels work so they can be dynamic and specify which host/service is impacted?
For my notifications, I have
Host = {{ $labels.host }}
Service = {{ $labels.process_name }}
Source = {{ $labels.host }}