diff options
author | Emmanuel Vasilakis <mrzammler@mm.st> | 2022-01-13 19:04:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-13 19:04:27 +0200 |
commit | ad6992e96886af03c85fb808a2f9becbb7ce8682 (patch) | |
tree | 4e2d21694d10ca604944934b4abaaea7606678f1 | |
parent | 5cfaf0146fee88883ac064d5211212025403b222 (diff) |
Find host and pass health_enabled to cloud health log message (#11960)
-rw-r--r-- | database/sqlite/sqlite_aclk_alert.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/database/sqlite/sqlite_aclk_alert.c b/database/sqlite/sqlite_aclk_alert.c index 819baacb56..de6f729b0b 100644 --- a/database/sqlite/sqlite_aclk_alert.c +++ b/database/sqlite/sqlite_aclk_alert.c @@ -321,6 +321,21 @@ void aclk_push_alarm_health_log(struct aclk_database_worker_config *wc, struct a if (unlikely(!claim_id)) return; + RRDHOST *host = wc->host; + if (unlikely(!host)) { + rrd_wrlock(); + host = find_host_by_node_id(wc->node_id); + rrd_unlock(); + + if (unlikely(!host)) { + log_access( + "AC [%s (N/A)]: ACLK synchronization thread for %s is not yet linked to HOST.", + wc->node_id, + wc->host_guid); + return; + } + } + uint64_t first_sequence = 0; uint64_t last_sequence = 0; struct timeval first_timestamp; @@ -370,7 +385,7 @@ void aclk_push_alarm_health_log(struct aclk_database_worker_config *wc, struct a alarm_log.node_id = wc->node_id; alarm_log.log_entries = log_entries; alarm_log.status = wc->alert_updates == 0 ? 2 : 1; - alarm_log.enabled = 1; + alarm_log.enabled = (int)host->health_enabled; wc->alert_sequence_id = last_sequence; |