diff options
author | Emmanuel Vasilakis <mrzammler@mm.st> | 2022-02-21 09:41:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-21 09:41:46 +0200 |
commit | df1d24063a47e40104d375aeebd9f70ca12c69f1 (patch) | |
tree | df844a47a51b9b8ee303c3bdb13e14f8cf3a4318 /health | |
parent | 4cb5435b8d16c6b117ef1774dcf324c75b5bab9d (diff) |
Create a removed alert event if chart is obsolete (#12021)
Diffstat (limited to 'health')
-rw-r--r-- | health/health.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/health/health.c b/health/health.c index 06df691183..e8c41ec294 100644 --- a/health/health.c +++ b/health/health.c @@ -745,6 +745,30 @@ void *health_main(void *ptr) { if (update_disabled_silenced(host, rc)) continue; + if (unlikely(rc->rrdset && rc->status != RRDCALC_STATUS_REMOVED && + rrdset_flag_check(rc->rrdset, RRDSET_FLAG_OBSOLETE))) { + if (!rrdcalc_isrepeating(rc)) { + 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->family, rc->classification, rc->component, rc->type, rc->exec, rc->recipient, now - rc->last_status_change, + rc->value, NAN, rc->status, RRDCALC_STATUS_REMOVED, rc->source, rc->units, rc->info, 0, 0); + if (ae) { + health_alarm_log(host, ae); + rc->old_status = rc->status; + rc->status = RRDCALC_STATUS_REMOVED; + rc->last_status_change = now; + rc->last_updated = now; + rc->value = NAN; +#if defined(ENABLE_ACLK) && defined(ENABLE_NEW_CLOUD_PROTOCOL) + if (netdata_cloud_setting && likely(!aclk_alert_reloaded)) + sql_queue_removed_alerts_to_aclk(host); +#endif + } + } + continue; + } + if (unlikely(!rrdcalc_isrunnable(rc, now, &next_run))) { if (unlikely(rc->rrdcalc_flags & RRDCALC_FLAG_RUNNABLE)) rc->rrdcalc_flags &= ~RRDCALC_FLAG_RUNNABLE; |