summaryrefslogtreecommitdiffstats
path: root/database/rrdcalc.c
diff options
context:
space:
mode:
authorEmmanuel Vasilakis <mrzammler@mm.st>2021-09-19 14:11:17 +0300
committerGitHub <noreply@github.com>2021-09-19 14:11:17 +0300
commitb87473c481283bbd936661fb15c3bd63fa74dbca (patch)
tree62743e2236957dbb5ed3a0c1076ce6f89b76098d /database/rrdcalc.c
parent686e5782d109fe79f2c5ec6aa44850f3e449b679 (diff)
Use sqlite to store the health log and alert configurations. (#11399)
* Rebased * use sql health log if it exists * store alert config in sqlite * move unlock before loop * fix warnings * remove hash message * check return from counting health log * remove check of hostname when reading log * try to create the health log table to catch accidental removals of it * fix warnings, cast values, report config_hash_id * use snprintfz, add info logging * remove unnecessary strdup and free * check if stored config hash is null * return if prepare statement fails * replace with static variables * remove replace info, free edit_command * remove setting cfg entries to NULL * change uuid_copy * check return of uuid_parse, and exit if its not valid * also free cfg * use address * removed health_alarm_entry_sql2json and sql_health_alarm_log_select_all * remove check for is_valid_alarm_id * replace lengths with GUID_LEN * use uuid_unparse_lower_fix * removed web api endopoint to get alert config * check for non null values for name, chart and family * include a date_updated field in alert_hash * for config hash, digest NULL string if value to digest is null * Use empty string instead of null
Diffstat (limited to 'database/rrdcalc.c')
-rw-r--r--database/rrdcalc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/database/rrdcalc.c b/database/rrdcalc.c
index 85b9efb75c..1b1a149603 100644
--- a/database/rrdcalc.c
+++ b/database/rrdcalc.c
@@ -87,6 +87,7 @@ static void rrdsetcalc_link(RRDSET *st, RRDCALC *rc) {
host,
rc->id,
rc->next_event_id++,
+ rc->config_hash_id,
now,
rc->name,
rc->rrdset->id,
@@ -164,6 +165,7 @@ inline void rrdsetcalc_unlink(RRDCALC *rc) {
host,
rc->id,
rc->next_event_id++,
+ rc->config_hash_id,
now,
rc->name,
rc->rrdset->id,
@@ -398,6 +400,7 @@ inline RRDCALC *rrdcalc_create_from_template(RRDHOST *host, RRDCALCTEMPLATE *rt,
rc->hash = simple_hash(rc->name);
rc->chart = strdupz(chart);
rc->hash_chart = simple_hash(rc->chart);
+ uuid_copy(rc->config_hash_id, rt->config_hash_id);
rc->id = rrdcalc_get_unique_id(host, rc->chart, rc->name, &rc->next_event_id);
@@ -513,6 +516,7 @@ inline RRDCALC *rrdcalc_create_from_rrdcalc(RRDCALC *rc, RRDHOST *host, const ch
newrc->hash = simple_hash(newrc->name);
newrc->chart = strdupz(rc->chart);
newrc->hash_chart = simple_hash(rc->chart);
+ uuid_copy(newrc->config_hash_id, *((uuid_t *) &rc->config_hash_id));
newrc->dimensions = strdupz(dimension);
newrc->foreachdim = NULL;