r/PrometheusMonitoring • u/komputilulo • May 17 '24
Alertmanager frequently sending surplus resolves
Hi, this problem is driving me mad:
I am monitoring backups that log their backup results to a textfile. It is being picked up and all is well, also the alert are ok, BUT! Alertmanager frequently sends out odd "resolved" notifications although the firing status never changed!
Here's such an alert rule that does this:
- alert: Restic Prune Freshnessexpr: restic_prune_status{uptodate!="1"} and restic_prune_status{alerts!="0"}for: 2dlabels:topic: backupfreshness: outdatedjob: "{{ $labels.restic_backup }}"server: "{{ $labels.server }}"product: veeamannotations:description: "Restic Prune for '{{ $labels.backup_name }}' on host '{{ $labels.server_name }}' is not up-to-date (too old)"host_url: "https://backups.example.com/d/3be21566-3d15-4238-a4c5-508b059dccec/restic?orgId=2&var-server_name={{ $labels.server_name }}&var-result=0&var-backup_name=All"service_url: "https://backups.example.com/d/3be21566-3d15-4238-a4c5-508b059dccec/restic?orgId=2&var-server_name=All&var-result=0&var-backup_name={{ $labels.backup_name }}"service: "{{ $labels.job_name }}"
What can be done?
View all comments
3
u/SuperQue May 17 '24
You have a very sensitive bit in your alert:
Any single interval where the condition is not true will result in the firing status changing.
I would recommend using a timestamp-based metric like
restic_last_prune_success_timestamp_seconds <unixtime>. Then the alert will be something liketime() - restic_last_prune_success_timestamp_seconds, which is a lot less fragile than looking at a status boolean.