diff options
author | Costa Tsaousis <costa@netdata.cloud> | 2024-05-07 23:26:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-08 01:26:26 +0300 |
commit | 9628f80713820ff77a6154339f3728e1b1e8401f (patch) | |
tree | 0cf64bcec05dc81caad2e0f08cf29a9829b5430c /src/health | |
parent | 8719db26411886eb9d0dd8da2fa002b6eb1b9dbb (diff) |
reset health when children disconnect (#17612)
* reset health when children disconnect
* cleanup when health is enabled somehow
* fix cleanup
* fix cleanup
* reset health flags on disconnect
* cleanup obsolete states
* use the host variable
* set health variables on every chart update
Diffstat (limited to 'src/health')
-rw-r--r-- | src/health/health_event_loop.c | 1 | ||||
-rw-r--r-- | src/health/rrdcalc.c | 11 | ||||
-rw-r--r-- | src/health/rrdcalc.h | 2 |
3 files changed, 14 insertions, 0 deletions
diff --git a/src/health/health_event_loop.c b/src/health/health_event_loop.c index 6a142cac07..2a1dd721b4 100644 --- a/src/health/health_event_loop.c +++ b/src/health/health_event_loop.c @@ -287,6 +287,7 @@ static void health_event_loop(void) { if (unlikely(rc->rrdset && rc->status != RRDCALC_STATUS_REMOVED && rrdset_flag_check(rc->rrdset, RRDSET_FLAG_OBSOLETE) && now > (rc->rrdset->last_collected_time.tv_sec + 60))) { + if (!rrdcalc_isrepeating(rc)) { worker_is_busy(WORKER_HEALTH_JOB_ALARM_LOG_ENTRY); time_t now_tmp = now_realtime_sec(); diff --git a/src/health/rrdcalc.c b/src/health/rrdcalc.c index 445e61b808..e16c118991 100644 --- a/src/health/rrdcalc.c +++ b/src/health/rrdcalc.c @@ -463,6 +463,17 @@ void rrdcalc_delete_all(RRDHOST *host) { dictionary_flush(host->rrdcalc_root_index); } +void rrdcalc_child_disconnected(RRDHOST *host) { + rrdcalc_delete_all(host); + + rrdhost_flag_clear(host, RRDHOST_FLAG_PENDING_HEALTH_INITIALIZATION); + RRDSET *st; + rrdset_foreach_read(st, host) { + rrdset_flag_clear(st, RRDSET_FLAG_PENDING_HEALTH_INITIALIZATION); + } + rrdset_foreach_done(st); +} + void rrd_alert_match_cleanup(struct rrd_alert_match *am) { if(am->is_template) string_freez(am->on.context); diff --git a/src/health/rrdcalc.h b/src/health/rrdcalc.h index 5c998b310d..f8a58aad5f 100644 --- a/src/health/rrdcalc.h +++ b/src/health/rrdcalc.h @@ -143,4 +143,6 @@ void rrdcalc_unlink_and_delete(RRDHOST *host, RRDCALC *rc, bool having_ll_wrlock #define RRDCALC_VAR_LABEL "${label:" #define RRDCALC_VAR_LABEL_LEN (sizeof(RRDCALC_VAR_LABEL)-1) +void rrdcalc_child_disconnected(RRDHOST *host); + #endif //NETDATA_RRDCALC_H |