diff options
author | Emmanuel Vasilakis <mrzammler@mm.st> | 2022-10-25 11:33:03 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-25 11:33:03 +0300 |
commit | d7346bcfe453beba3345fe55462992e3b3a41b12 (patch) | |
tree | 6403d39250ffa46a319dd0aa6010664f2a2d06a5 /database/rrdcalc.c | |
parent | 52263275d79f4188df9b8a5a416e072473db03f4 (diff) |
Don't create a REMOVED alert event after a REMOVED. (#13871)
dont create REMOVED after a REMOVED
Diffstat (limited to 'database/rrdcalc.c')
-rw-r--r-- | database/rrdcalc.c | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/database/rrdcalc.c b/database/rrdcalc.c index bd92c7a700..41c62e4f6e 100644 --- a/database/rrdcalc.c +++ b/database/rrdcalc.c @@ -289,33 +289,35 @@ static void rrdcalc_unlink_from_rrdset(RRDCALC *rc, bool having_ll_wrlock) { time_t now = now_realtime_sec(); - ALARM_ENTRY *ae = health_create_alarm_entry( - host, - rc->id, - rc->next_event_id++, - rc->config_hash_id, - now, - rc->name, - rc->rrdset->id, - rc->rrdset->context, - rc->rrdset->family, - rc->classification, - rc->component, - rc->type, - rc->exec, - rc->recipient, - now - rc->last_status_change, - rc->old_value, - rc->value, - rc->status, - RRDCALC_STATUS_REMOVED, - rc->source, - rc->units, - rc->info, - 0, - 0); - - health_alarm_log_add_entry(host, ae); + if (likely(rc->status != RRDCALC_STATUS_REMOVED)) { + ALARM_ENTRY *ae = health_create_alarm_entry( + host, + rc->id, + rc->next_event_id++, + rc->config_hash_id, + now, + rc->name, + rc->rrdset->id, + rc->rrdset->context, + rc->rrdset->family, + rc->classification, + rc->component, + rc->type, + rc->exec, + rc->recipient, + now - rc->last_status_change, + rc->old_value, + rc->value, + rc->status, + RRDCALC_STATUS_REMOVED, + rc->source, + rc->units, + rc->info, + 0, + 0); + + health_alarm_log_add_entry(host, ae); + } debug(D_HEALTH, "Health unlinking alarm '%s.%s' from chart '%s' of host '%s'", rrdcalc_chart_name(rc), rrdcalc_name(rc), rrdset_id(st), rrdhost_hostname(host)); |