@cryptotaxi247 / netdata-1 / commits / df1d24063

Create a removed alert event if chart is obsolete (#12021)

Emmanuel Vasilakis committed Feb 21, 2022 at 09:41 UTC df1d24063a47e40104d375aeebd9f70ca12c69f1
1 file changed +24
health/health.c
+24
@@ -745,6 +745,30 @@ void *health_main(void *ptr) {
745 if (update_disabled_silenced(host, rc))
746 continue;
747
748 + if (unlikely(rc->rrdset && rc->status != RRDCALC_STATUS_REMOVED &&
749 + rrdset_flag_check(rc->rrdset, RRDSET_FLAG_OBSOLETE))) {
750 + if (!rrdcalc_isrepeating(rc)) {
751 + time_t now = now_realtime_sec();
752 + ALARM_ENTRY *ae = health_create_alarm_entry(
753 + host, rc->id, rc->next_event_id++, rc->config_hash_id, now, rc->name, rc->rrdset->id,
754 + rc->rrdset->family, rc->classification, rc->component, rc->type, rc->exec, rc->recipient, now - rc->last_status_change,
755 + rc->value, NAN, rc->status, RRDCALC_STATUS_REMOVED, rc->source, rc->units, rc->info, 0, 0);
756 + if (ae) {
757 + health_alarm_log(host, ae);
758 + rc->old_status = rc->status;
759 + rc->status = RRDCALC_STATUS_REMOVED;
760 + rc->last_status_change = now;
761 + rc->last_updated = now;
762 + rc->value = NAN;
763 +#if defined(ENABLE_ACLK) && defined(ENABLE_NEW_CLOUD_PROTOCOL)
764 + if (netdata_cloud_setting && likely(!aclk_alert_reloaded))
765 + sql_queue_removed_alerts_to_aclk(host);
766 +#endif
767 + }
768 + }
769 + continue;
770 + }
771 +
772 if (unlikely(!rrdcalc_isrunnable(rc, now, &next_run))) {
773 if (unlikely(rc->rrdcalc_flags & RRDCALC_FLAG_RUNNABLE))
774 rc->rrdcalc_flags &= ~RRDCALC_FLAG_RUNNABLE;