diff options
author | Emmanuel Vasilakis <mrzammler@mm.st> | 2022-03-11 10:49:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-11 10:49:21 +0200 |
commit | 4566c0835e99d1b00542ddbc1600450eb61a6a70 (patch) | |
tree | e3fed3b41fdcc53f59b2248ac08d5c50da02aeab /database/sqlite | |
parent | d752b3e8b74ecf9f384b3e72e1284826d4ceb72a (diff) |
Only store alert hashes once per health config iteration (#12292)
* only store alert hashes when iterated from localhost
* store hashes on start and health reload, at least for one pass of a host
Diffstat (limited to 'database/sqlite')
-rw-r--r-- | database/sqlite/sqlite_health.c | 6 | ||||
-rw-r--r-- | database/sqlite/sqlite_health.h | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/database/sqlite/sqlite_health.c b/database/sqlite/sqlite_health.c index 27c67c3aa5..67b3a5913e 100644 --- a/database/sqlite/sqlite_health.c +++ b/database/sqlite/sqlite_health.c @@ -900,7 +900,8 @@ int sql_store_alert_config_hash(uuid_t *hash_id, struct alert_config *cfg) #endif int alert_hash_and_store_config( uuid_t hash_id, - struct alert_config *cfg) + struct alert_config *cfg, + int store_hash) { #if !defined DISABLE_CLOUD && defined ENABLE_HTTPS EVP_MD_CTX *evpctx; @@ -946,7 +947,8 @@ int alert_hash_and_store_config( uuid_copy(hash_id, *((uuid_t *)&hash_value)); /* store everything, so it can be recreated when not in memory or just a subset ? */ - (void)sql_store_alert_config_hash( (uuid_t *)&hash_value, cfg); + if (store_hash) + (void)sql_store_alert_config_hash( (uuid_t *)&hash_value, cfg); #else UNUSED(hash_id); UNUSED(cfg); diff --git a/database/sqlite/sqlite_health.h b/database/sqlite/sqlite_health.h index 3b94608975..ef837894a2 100644 --- a/database/sqlite/sqlite_health.h +++ b/database/sqlite/sqlite_health.h @@ -12,6 +12,6 @@ extern void sql_health_alarm_log_update(RRDHOST *host, ALARM_ENTRY *ae); extern void sql_health_alarm_log_insert(RRDHOST *host, ALARM_ENTRY *ae); extern void sql_health_alarm_log_save(RRDHOST *host, ALARM_ENTRY *ae); extern void sql_health_alarm_log_cleanup(RRDHOST *host); -extern int alert_hash_and_store_config(uuid_t hash_id, struct alert_config *cfg); +extern int alert_hash_and_store_config(uuid_t hash_id, struct alert_config *cfg, int store_hash); extern void sql_aclk_alert_clean_dead_entries(RRDHOST *host); #endif //NETDATA_SQLITE_HEALTH_H |