summaryrefslogtreecommitdiffstats
path: root/health
diff options
context:
space:
mode:
authorthiagoftsm <thiagoftsm@gmail.com>2023-07-06 15:46:48 +0000
committerGitHub <noreply@github.com>2023-07-06 15:46:48 +0000
commite0f388c43f3144abb871cce2a7b44e85a36de48f (patch)
treecf41e5ae11ae7d0ad5ec0b49f5f4ac4531189eb3 /health
parent3cc220ff5e38ef5cd96a64596c7e0c370d0fa074 (diff)
Rename generic `error` function (#15296)
Diffstat (limited to 'health')
-rw-r--r--health/health.c21
-rw-r--r--health/health_config.c210
2 files changed, 119 insertions, 112 deletions
diff --git a/health/health.c b/health/health.c
index e3ad833e73..3a206afcc9 100644
--- a/health/health.c
+++ b/health/health.c
@@ -289,20 +289,20 @@ static void health_silencers_init(void) {
json_parse(str, NULL, health_silencers_json_read_callback);
netdata_log_info("Parsed health silencers file %s", silencers_filename);
} else {
- error("Cannot read the data from health silencers file %s", silencers_filename);
+ netdata_log_error("Cannot read the data from health silencers file %s", silencers_filename);
}
freez(str);
}
} else {
- error(
- "Health silencers file %s has the size %" PRId64 " that is out of range[ 1 , %d ]. Aborting read.",
- silencers_filename,
- (int64_t)length,
- HEALTH_SILENCERS_MAX_FILE_LEN);
+ netdata_log_error("Health silencers file %s has the size %" PRId64 " that is out of range[ 1 , %d ]. Aborting read.",
+ silencers_filename,
+ (int64_t)length,
+ HEALTH_SILENCERS_MAX_FILE_LEN);
}
fclose(fd);
} else {
- netdata_log_info("Cannot open the file %s, so Netdata will work with the default health configuration.",silencers_filename);
+ netdata_log_info("Cannot open the file %s, so Netdata will work with the default health configuration.",
+ silencers_filename);
}
}
@@ -589,7 +589,7 @@ static inline void health_alarm_execute(RRDHOST *host, ALARM_ENTRY *ae) {
enqueue_alarm_notify_in_progress(ae);
health_alarm_log_save(host, ae);
} else {
- error("Failed to format command arguments");
+ netdata_log_error("Failed to format command arguments");
}
buffer_free(wb);
@@ -803,7 +803,10 @@ static void initialize_health(RRDHOST *host)
long n = config_get_number(CONFIG_SECTION_HEALTH, "in memory max health log entries", host->health_log.max);
if(n < 10) {
- error("Host '%s': health configuration has invalid max log entries %ld. Using default %u", rrdhost_hostname(host), n, host->health_log.max);
+ netdata_log_error("Host '%s': health configuration has invalid max log entries %ld. Using default %u",
+ rrdhost_hostname(host),
+ n,
+ host->health_log.max);
config_set_number(CONFIG_SECTION_HEALTH, "in memory max health log entries", (long)host->health_log.max);
}
else
diff --git a/health/health_config.c b/health/health_config.c
index 92c26d1f6f..a900f67eac 100644
--- a/health/health_config.c
+++ b/health/health_config.c
@@ -61,36 +61,36 @@ static inline int health_parse_delay(
if(!strcasecmp(key, "up")) {
if (!config_parse_duration(value, delay_up_duration)) {
- error("Health configuration at line %zu of file '%s': invalid value '%s' for '%s' keyword",
- line, filename, value, key);
+ netdata_log_error("Health configuration at line %zu of file '%s': invalid value '%s' for '%s' keyword",
+ line, filename, value, key);
}
else given_up = 1;
}
else if(!strcasecmp(key, "down")) {
if (!config_parse_duration(value, delay_down_duration)) {
- error("Health configuration at line %zu of file '%s': invalid value '%s' for '%s' keyword",
- line, filename, value, key);
+ netdata_log_error("Health configuration at line %zu of file '%s': invalid value '%s' for '%s' keyword",
+ line, filename, value, key);
}
else given_down = 1;
}
else if(!strcasecmp(key, "multiplier")) {
*delay_multiplier = strtof(value, NULL);
if(isnan(*delay_multiplier) || isinf(*delay_multiplier) || islessequal(*delay_multiplier, 0)) {
- error("Health configuration at line %zu of file '%s': invalid value '%s' for '%s' keyword",
- line, filename, value, key);
+ netdata_log_error("Health configuration at line %zu of file '%s': invalid value '%s' for '%s' keyword",
+ line, filename, value, key);
}
else given_multiplier = 1;
}
else if(!strcasecmp(key, "max")) {
if (!config_parse_duration(value, delay_max_duration)) {
- error("Health configuration at line %zu of file '%s': invalid value '%s' for '%s' keyword",
- line, filename, value, key);
+ netdata_log_error("Health configuration at line %zu of file '%s': invalid value '%s' for '%s' keyword",
+ line, filename, value, key);
}
else given_max = 1;
}
else {
- error("Health configuration at line %zu of file '%s': unknown keyword '%s'",
- line, filename, key);
+ netdata_log_error("Health configuration at line %zu of file '%s': unknown keyword '%s'",
+ line, filename, key);
}
}
@@ -136,7 +136,7 @@ static inline uint32_t health_parse_options(const char *s) {
if(!strcasecmp(buf, "no-clear-notification") || !strcasecmp(buf, "no-clear"))
options |= RRDCALC_OPTION_NO_CLEAR_NOTIFICATION;
else
- error("Ignoring unknown alarm option '%s'", buf);
+ netdata_log_error("Ignoring unknown alarm option '%s'", buf);
}
}
@@ -171,14 +171,14 @@ static inline int health_parse_repeat(
}
if(!strcasecmp(key, "warning")) {
if (!config_parse_duration(value, (int*)warn_repeat_every)) {
- error("Health configuration at line %zu of file '%s': invalid value '%s' for '%s' keyword",
- line, file, value, key);
+ netdata_log_error("Health configuration at line %zu of file '%s': invalid value '%s' for '%s' keyword",
+ line, file, value, key);
}
}
else if(!strcasecmp(key, "critical")) {
if (!config_parse_duration(value, (int*)crit_repeat_every)) {
- error("Health configuration at line %zu of file '%s': invalid value '%s' for '%s' keyword",
- line, file, value, key);
+ netdata_log_error("Health configuration at line %zu of file '%s': invalid value '%s' for '%s' keyword",
+ line, file, value, key);
}
}
}
@@ -326,14 +326,14 @@ static inline int health_parse_db_lookup(
while(*s && !isspace(*s)) s++;
while(*s && isspace(*s)) *s++ = '\0';
if(!*s) {
- error("Health configuration invalid chart calculation at line %zu of file '%s': expected group method followed by the 'after' time, but got '%s'",
- line, filename, key);
+ netdata_log_error("Health configuration invalid chart calculation at line %zu of file '%s': expected group method followed by the 'after' time, but got '%s'",
+ line, filename, key);
return 0;
}
if((*group_method = time_grouping_parse(key, RRDR_GROUPING_UNDEFINED)) == RRDR_GROUPING_UNDEFINED) {
- error("Health configuration at line %zu of file '%s': invalid group method '%s'",
- line, filename, key);
+ netdata_log_error("Health configuration at line %zu of file '%s': invalid group method '%s'",
+ line, filename, key);
return 0;
}
@@ -343,8 +343,8 @@ static inline int health_parse_db_lookup(
while(*s && isspace(*s)) *s++ = '\0';
if(!config_parse_duration(key, after)) {
- error("Health configuration at line %zu of file '%s': invalid duration '%s' after group method",
- line, filename, key);
+ netdata_log_error("Health configuration at line %zu of file '%s': invalid duration '%s' after group method",
+ line, filename, key);
return 0;
}
@@ -364,8 +364,8 @@ static inline int health_parse_db_lookup(
while(*s && isspace(*s)) *s++ = '\0';
if (!config_parse_duration(value, before)) {
- error("Health configuration at line %zu of file '%s': invalid duration '%s' for '%s' keyword",
- line, filename, value, key);
+ netdata_log_error("Health configuration at line %zu of file '%s': invalid duration '%s' for '%s' keyword",
+ line, filename, value, key);
}
}
else if(!strcasecmp(key, HEALTH_EVERY_KEY)) {
@@ -374,8 +374,8 @@ static inline int health_parse_db_lookup(
while(*s && isspace(*s)) *s++ = '\0';
if (!config_parse_duration(value, every)) {
- error("Health configuration at line %zu of file '%s': invalid duration '%s' for '%s' keyword",
- line, filename, value, key);
+ netdata_log_error("Health configuration at line %zu of file '%s': invalid duration '%s' for '%s' keyword",
+ line, filename, value, key);
}
}
else if(!strcasecmp(key, "absolute") || !strcasecmp(key, "abs") || !strcasecmp(key, "absolute_sum")) {
@@ -422,8 +422,8 @@ static inline int health_parse_db_lookup(
break;
}
else {
- error("Health configuration at line %zu of file '%s': unknown keyword '%s'",
- line, filename, key);
+ netdata_log_error("Health configuration at line %zu of file '%s': unknown keyword '%s'",
+ line, filename, key);
}
}
@@ -574,7 +574,7 @@ static int health_readfile(const char *filename, void *data) {
FILE *fp = fopen(filename, "r");
if(!fp) {
- error("Health configuration cannot read file '%s'.", filename);
+ netdata_log_error("Health configuration cannot read file '%s'.", filename);
return 0;
}
@@ -598,7 +598,8 @@ static int health_readfile(const char *filename, void *data) {
if(append < HEALTH_CONF_MAX_LINE)
continue;
else {
- error("Health configuration has too long multi-line at line %zu of file '%s'.", line, filename);
+ netdata_log_error("Health configuration has too long multi-line at line %zu of file '%s'.",
+ line, filename);
}
}
append = 0;
@@ -606,7 +607,8 @@ static int health_readfile(const char *filename, void *data) {
char *key = s;
while(*s && *s != ':') s++;
if(!*s) {
- error("Health configuration has invalid line %zu of file '%s'. It does not contain a ':'. Ignoring it.", line, filename);
+ netdata_log_error("Health configuration has invalid line %zu of file '%s'. It does not contain a ':'. Ignoring it.",
+ line, filename);
continue;
}
*s = '\0';
@@ -617,12 +619,14 @@ static int health_readfile(const char *filename, void *data) {
value = trim_all(value);
if(!key) {
- error("Health configuration has invalid line %zu of file '%s'. Keyword is empty. Ignoring it.", line, filename);
+ netdata_log_error("Health configuration has invalid line %zu of file '%s'. Keyword is empty. Ignoring it.",
+ line, filename);
continue;
}
if(!value) {
- error("Health configuration has invalid line %zu of file '%s'. value is empty. Ignoring it.", line, filename);
+ netdata_log_error("Health configuration has invalid line %zu of file '%s'. value is empty. Ignoring it.",
+ line, filename);
continue;
}
@@ -654,7 +658,7 @@ static int health_readfile(const char *filename, void *data) {
{
char *tmp = strdupz(value);
if(rrdvar_fix_name(tmp))
- error("Health configuration renamed alarm '%s' to '%s'", value, tmp);
+ netdata_log_error("Health configuration renamed alarm '%s' to '%s'", value, tmp);
rc->name = string_strdupz(tmp);
freez(tmp);
@@ -704,7 +708,7 @@ static int health_readfile(const char *filename, void *data) {
{
char *tmp = strdupz(value);
if(rrdvar_fix_name(tmp))
- error("Health configuration renamed template '%s' to '%s'", value, tmp);
+ netdata_log_error("Health configuration renamed template '%s' to '%s'", value, tmp);
rt->name = string_strdupz(tmp);
freez(tmp);
@@ -766,8 +770,8 @@ static int health_readfile(const char *filename, void *data) {
alert_cfg->on = string_strdupz(value);
if(rc->chart) {
if(strcmp(rrdcalc_chart_name(rc), value) != 0)
- error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
- line, filename, rrdcalc_name(rc), key, rrdcalc_chart_name(rc), value, value);
+ netdata_log_error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
+ line, filename, rrdcalc_name(rc), key, rrdcalc_chart_name(rc), value, value);
string_freez(rc->chart);
}
@@ -779,8 +783,8 @@ static int health_readfile(const char *filename, void *data) {
alert_cfg->classification = string_strdupz(value);
if(rc->classification) {
if(strcmp(rrdcalc_classification(rc), value) != 0)
- error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
- line, filename, rrdcalc_name(rc), key, rrdcalc_classification(rc), value, value);
+ netdata_log_error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
+ line, filename, rrdcalc_name(rc), key, rrdcalc_classification(rc), value, value);
string_freez(rc->classification);
}
@@ -792,7 +796,7 @@ static int health_readfile(const char *filename, void *data) {
alert_cfg->component = string_strdupz(value);
if(rc->component) {
if(strcmp(rrdcalc_component(rc), value) != 0)
- error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
+ netdata_log_error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
line, filename, rrdcalc_name(rc), key, rrdcalc_component(rc), value, value);
string_freez(rc->component);
@@ -805,8 +809,8 @@ static int health_readfile(const char *filename, void *data) {
alert_cfg->type = string_strdupz(value);
if(rc->type) {
if(strcmp(rrdcalc_type(rc), value) != 0)
- error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
- line, filename, rrdcalc_name(rc), key, rrdcalc_type(rc), value, value);
+ netdata_log_error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
+ line, filename, rrdcalc_name(rc), key, rrdcalc_type(rc), value, value);
string_freez(rc->type);
}
@@ -834,8 +838,8 @@ static int health_readfile(const char *filename, void *data) {
else if(hash == hash_every && !strcasecmp(key, HEALTH_EVERY_KEY)) {
alert_cfg->every = string_strdupz(value);
if(!config_parse_duration(value, &rc->update_every))
- error("Health configuration at line %zu of file '%s' for alarm '%s' at key '%s' cannot parse duration: '%s'.",
- line, filename, rrdcalc_name(rc), key, value);
+ netdata_log_error("Health configuration at line %zu of file '%s' for alarm '%s' at key '%s' cannot parse duration: '%s'.",
+ line, filename, rrdcalc_name(rc), key, value);
alert_cfg->p_update_every = rc->update_every;
}
else if(hash == hash_green && !strcasecmp(key, HEALTH_GREEN_KEY)) {
@@ -843,8 +847,8 @@ static int health_readfile(const char *filename, void *data) {
char *e;
rc->green = str2ndd(value, &e);
if(e && *e) {
- error("Health configuration at line %zu of file '%s' for alarm '%s' at key '%s' leaves this string unmatched: '%s'.",
- line, filename, rrdcalc_name(rc), key, e);
+ netdata_log_error("Health configuration at line %zu of file '%s' for alarm '%s' at key '%s' leaves this string unmatched: '%s'.",
+ line, filename, rrdcalc_name(rc), key, e);
}
}
else if(hash == hash_red && !strcasecmp(key, HEALTH_RED_KEY)) {
@@ -852,8 +856,8 @@ static int health_readfile(const char *filename, void *data) {
char *e;
rc->red = str2ndd(value, &e);
if(e && *e) {
- error("Health configuration at line %zu of file '%s' for alarm '%s' at key '%s' leaves this string unmatched: '%s'.",
- line, filename, rrdcalc_name(rc), key, e);
+ netdata_log_error("Health configuration at line %zu of file '%s' for alarm '%s' at key '%s' leaves this string unmatched: '%s'.",
+ line, filename, rrdcalc_name(rc), key, e);
}
}
else if(hash == hash_calc && !strcasecmp(key, HEALTH_CALC_KEY)) {
@@ -862,8 +866,8 @@ static int health_readfile(const char *filename, void *data) {
int error = 0;
rc->calculation = expression_parse(value, &failed_at, &error);
if(!rc->calculation) {
- error("Health configuration at line %zu of file '%s' for alarm '%s' at key '%s' has unparse-able expression '%s': %s at '%s'",
- line, filename, rrdcalc_name(rc), key, value, expression_strerror(error), failed_at);
+ netdata_log_error("Health configuration at line %zu of file '%s' for alarm '%s' at key '%s' has unparse-able expression '%s': %s at '%s'",
+ line, filename, rrdcalc_name(rc), key, value, expression_strerror(error), failed_at);
}
parse_variables_and_store_in_health_rrdvars(value, HEALTH_CONF_MAX_LINE);
}
@@ -873,8 +877,8 @@ static int health_readfile(const char *filename, void *data) {
int error = 0;
rc->warning = expression_parse(value, &failed_at, &error);
if(!rc->warning) {
- error("Health configuration at line %zu of file '%s' for alarm '%s' at key '%s' has unparse-able expression '%s': %s at '%s'",
- line, filename, rrdcalc_name(rc), key, value, expression_strerror(error), failed_at);
+ netdata_log_error("Health configuration at line %zu of file '%s' for alarm '%s' at key '%s' has unparse-able expression '%s': %s at '%s'",
+ line, filename, rrdcalc_name(rc), key, value, expression_strerror(error), failed_at);
}
parse_variables_and_store_in_health_rrdvars(value, HEALTH_CONF_MAX_LINE);
}
@@ -884,8 +888,8 @@ static int health_readfile(const char *filename, void *data) {
int error = 0;
rc->critical = expression_parse(value, &failed_at, &error);
if(!rc->critical) {
- error("Health configuration at line %zu of file '%s' for alarm '%s' at key '%s' has unparse-able expression '%s': %s at '%s'",
- line, filename, rrdcalc_name(rc), key, value, expression_strerror(error), failed_at);
+ netdata_log_error("Health configuration at line %zu of file '%s' for alarm '%s' at key '%s' has unparse-able expression '%s': %s at '%s'",
+ line, filename, rrdcalc_name(rc), key, value, expression_strerror(error), failed_at);
}
parse_variables_and_store_in_health_rrdvars(value, HEALTH_CONF_MAX_LINE);
}
@@ -893,8 +897,8 @@ static int health_readfile(const char *filename, void *data) {
alert_cfg->exec = string_strdupz(value);
if(rc->exec) {
if(strcmp(rrdcalc_exec(rc), value) != 0)
- error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
- line, filename, rrdcalc_name(rc), key, rrdcalc_exec(rc), value, value);
+ netdata_log_error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
+ line, filename, rrdcalc_name(rc), key, rrdcalc_exec(rc), value, value);
string_freez(rc->exec);
}
@@ -904,8 +908,8 @@ static int health_readfile(const char *filename, void *data) {
alert_cfg->to = string_strdupz(value);
if(rc->recipient) {
if(strcmp(rrdcalc_recipient(rc), value) != 0)
- error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
- line, filename, rrdcalc_name(rc), key, rrdcalc_recipient(rc), value, value);
+ netdata_log_error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
+ line, filename, rrdcalc_name(rc), key, rrdcalc_recipient(rc), value, value);
string_freez(rc->recipient);
}
@@ -917,8 +921,8 @@ static int health_readfile(const char *filename, void *data) {
alert_cfg->units = string_strdupz(value);
if(rc->units) {
if(strcmp(rrdcalc_units(rc), value) != 0)
- error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
- line, filename, rrdcalc_name(rc), key, rrdcalc_units(rc), value, value);
+ netdata_log_error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
+ line, filename, rrdcalc_name(rc), key, rrdcalc_units(rc), value, value);
string_freez(rc->units);
}
@@ -930,8 +934,8 @@ static int health_readfile(const char *filename, void *data) {
alert_cfg->info = string_strdupz(value);
if(rc->info) {
if(strcmp(rrdcalc_info(rc), value) != 0)
- error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
- line, filename, rrdcalc_name(rc), key, rrdcalc_info(rc), value, value);
+ netdata_log_error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
+ line, filename, rrdcalc_name(rc), key, rrdcalc_info(rc), value, value);
string_freez(rc->info);
string_freez(rc->original_info);
@@ -957,8 +961,8 @@ static int health_readfile(const char *filename, void *data) {
alert_cfg->host_labels = string_strdupz(value);
if(rc->host_labels) {
if(strcmp(rrdcalc_host_labels(rc), value) != 0)
- error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'.",
- line, filename, rrdcalc_name(rc), key, value, value);
+ netdata_log_error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'.",
+ line, filename, rrdcalc_name(rc), key, value, value);
string_freez(rc->host_labels);
simple_pattern_free(rc->host_labels_pattern);
@@ -992,8 +996,8 @@ static int health_readfile(const char *filename, void *data) {
alert_cfg->chart_labels = string_strdupz(value);
if(rc->chart_labels) {
if(strcmp(rrdcalc_chart_labels(rc), value) != 0)
- error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'.",
- line, filename, rrdcalc_name(rc), key, value, value);
+ netdata_log_error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'.",
+ line, filename, rrdcalc_name(rc), key, value, value);
string_freez(rc->chart_labels);
simple_pattern_free(rc->chart_labels_pattern);
@@ -1010,8 +1014,8 @@ static int health_readfile(const char *filename, void *data) {
true);
}
else {
- error("Health configuration at line %zu of file '%s' for alarm '%s' has unknown key '%s'.",
- line, filename, rrdcalc_name(rc), key);
+ netdata_log_error("Health configuration at line %zu of file '%s' for alarm '%s' has unknown key '%s'.",
+ line, filename, rrdcalc_name(rc), key);
}
}
else if(rt) {
@@ -1019,8 +1023,8 @@ static int health_readfile(const char *filename, void *data) {
alert_cfg->on = string_strdupz(value);
if(rt->context) {
if(strcmp(string2str(rt->context), value) != 0)
- error("Health configuration at line %zu of file '%s' for template '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
- line, filename, rrdcalctemplate_name(rt), key, string2str(rt->context), value, value);
+ netdata_log_error("Health configuration at line %zu of file '%s' for template '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
+ line, filename, rrdcalctemplate_name(rt), key, string2str(rt->context), value, value);
string_freez(rt->context);
}
@@ -1032,8 +1036,8 @@ static int health_readfile(const char *filename, void *data) {
alert_cfg->classification = string_strdupz(value);
if(rt->classification) {
if(strcmp(rrdcalctemplate_classification(rt), value) != 0)
- error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
- line, filename, rrdcalctemplate_name(rt), key, rrdcalctemplate_classification(rt), value, value);
+ netdata_log_error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
+ line, filename, rrdcalctemplate_name(rt), key, rrdcalctemplate_classification(rt), value, value);
string_freez(rt->classification);
}
@@ -1045,8 +1049,8 @@ static int health_readfile(const char *filename, void *data) {
alert_cfg->component = string_strdupz(value);
if(rt->component) {
if(strcmp(rrdcalctemplate_component(rt), value) != 0)
- error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
- line, filename, rrdcalctemplate_name(rt), key, rrdcalctemplate_component(rt), value, value);
+ netdata_log_error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
+ line, filename, rrdcalctemplate_name(rt), key, rrdcalctemplate_component(rt), value, value);
string_freez(rt->component);
}
@@ -1058,8 +1062,8 @@ static int health_readfile(const char *filename, void *data) {
alert_cfg->type = string_strdupz(value);
if(rt->type) {
if(strcmp(rrdcalctemplate_type(rt), value) != 0)
- error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
- line, filename, rrdcalctemplate_name(rt), key, rrdcalctemplate_type(rt), value, value);
+ netdata_log_error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
+ line, filename, rrdcalctemplate_name(rt), key, rrdcalctemplate_type(rt), value, value);
string_freez(rt->type);
}
@@ -1125,8 +1129,8 @@ static int health_readfile(const char *filename, void *data) {
else if(hash == hash_every && !strcasecmp(key, HEALTH_EVERY_KEY)) {
alert_cfg->every = string_strdupz(value);
if(!config_parse_duration(value, &rt->update_every))
- error("Health configuration at line %zu of file '%s' for template '%s' at key '%s' cannot parse duration: '%s'.",
- line, filename, rrdcalctemplate_name(rt), key, value);
+ netdata_log_error("Health configuration at line %zu of file '%s' for template '%s' at key '%s' cannot parse duration: '%s'.",
+ line, filename, rrdcalctemplate_name(rt), key, value);
alert_cfg->p_update_every = rt->update_every;
}
else if(hash == hash_green && !strcasecmp(key, HEALTH_GREEN_KEY)) {
@@ -1134,8 +1138,8 @@ static int health_readfile(const char *filename, void *data) {
char *e;
rt->green = str2ndd(value, &e);
if(e && *e) {
- error("Health configuration at line %zu of file '%s' for template '%s' at key '%s' leaves this string unmatched: '%s'.",
- line, filename, rrdcalctemplate_name(rt), key, e);
+ netdata_log_error("Health configuration at line %zu of file '%s' for template '%s' at key '%s' leaves this string unmatched: '%s'.",
+ line, filename, rrdcalctemplate_name(rt), key, e);
}
}
else if(hash == hash_red && !strcasecmp(key, HEALTH_RED_KEY)) {
@@ -1143,8 +1147,8 @@ static int health_readfile(const char *filename, void *data) {
char *e;
rt->red = str2ndd(value, &e);
if(e && *e) {
- error("Health configuration at line %zu of file '%s' for template '%s' at key '%s' leaves this string unmatched: '%s'.",
- line, filename, rrdcalctemplate_name(rt), key, e);
+ netdata_log_error("Health configuration at line %zu of file '%s' for template '%s' at key '%s' leaves this string unmatched: '%s'.",
+ line, filename, rrdcalctemplate_name(rt), key, e);
}
}
else if(hash == hash_calc && !strcasecmp(key, HEALTH_CALC_KEY)) {
@@ -1153,8 +1157,8 @@ static int health_readfile(const char *filename, void *data) {
int error = 0;
rt->calculation = expression_parse(value, &failed_at, &error);
if(!rt->calculation) {
- error("Health configuration at line %zu of file '%s' for template '%s' at key '%s' has unparse-able expression '%s': %s at '%s'",
- line, filename, rrdcalctemplate_name(rt), key, value, expression_strerror(error), failed_at);
+ netdata_log_error("Health configuration at line %zu of file '%s' for template '%s' at key '%s' has unparse-able expression '%s': %s at '%s'",
+ line, filename, rrdcalctemplate_name(rt), key, value, expression_strerror(error), failed_at);
}
parse_variables_and_store_in_health_rrdvars(value, HEALTH_CONF_MAX_LINE);
}
@@ -1164,8 +1168,8 @@ static int health_readfile(const char *filename, void *data) {
int error = 0;
rt->warning = expression_parse(value, &failed_at, &error);
if(!rt->warning) {
- error("Health configuration at line %zu of file '%s' for template '%s' at key '%s' has unparse-able expression '%s': %s at '%s'",
- line, filename, rrdcalctemplate_name(rt), key, value, expression_strerror(error), failed_at);
+ netdata_log_error("Health configuration at line %zu of file '%s' for template '%s' at key '%s' has unparse-able expression '%s': %s at '%s'",
+ line, filename, rrdcalctemplate_name(rt), key, value, expression_strerror(error), failed_at);
}
parse_variables_and_store_in_health_rrdvars(value, HEALTH_CONF_MAX_LINE);
}
@@ -1175,8 +1179,8 @@ static int health_readfile(const char *filename, void *data) {
int error = 0;
rt->critical = expression_parse(value, &failed_at, &error);
if(!rt->critical) {
- error("Health configuration at line %zu of file '%s' for template '%s' at key '%s' has unparse-able expression '%s': %s at '%s'",
- line, filename, rrdcalctemplate_name(rt), key, value, expression_strerror(error), failed_at);
+ netdata_log_error("Health configuration at line %zu of file '%s' for template '%s' at key '%s' has unparse-able expression '%s': %s at '%s'",
+ line, filename, rrdcalctemplate_name(rt), key, value, expression_strerror(error), failed_at);
}
parse_variables_and_store_in_health_rrdvars(value, HEALTH_CONF_MAX_LINE);
}
@@ -1184,8 +1188,8 @@ static int health_readfile(const char *filename, void *data) {
alert_cfg->exec = string_strdupz(value);
if(rt->exec) {
if(strcmp(rrdcalctemplate_exec(rt), value) != 0)
- error("Health configuration at line %zu of file '%s' for template '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
- line, filename, rrdcalctemplate_name(rt), key, rrdcalctemplate_exec(rt), value, value);
+ netdata_log_error("Health configuration at line %zu of file '%s' for template '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
+ line, filename, rrdcalctemplate_name(rt), key, rrdcalctemplate_exec(rt), value, value);
string_freez(rt->exec);
}
@@ -1195,8 +1199,8 @@ static int health_readfile(const char *filename, void *data) {
alert_cfg->to = string_strdupz(value);
if(rt->recipient) {
if(strcmp(rrdcalctemplate_recipient(rt), value) != 0)
- error("Health configuration at line %zu of file '%s' for template '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
- line, filename, rrdcalctemplate_name(rt), key, rrdcalctemplate_recipient(rt), value, value);
+ netdata_log_error("Health configuration at line %zu of file '%s' for template '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
+ line, filename, rrdcalctemplate_name(rt), key, rrdcalctemplate_recipient(rt), value, value);
string_freez(rt->recipient);
}
@@ -1208,8 +1212,8 @@ static int health_readfile(const char *filename, void *data) {
alert_cfg->units = string_strdupz(value);
if(rt->units) {
if(strcmp(rrdcalctemplate_units(rt), value) != 0)
- error("Health configuration at line %zu of file '%s' for template '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
- line, filename, rrdcalctemplate_name(rt), key, rrdcalctemplate_units(rt), value, value);
+ netdata_log_error("Health configuration at line %zu of file '%s' for template '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
+ line, filename, rrdcalctemplate_name(rt), key, rrdcalctemplate_units(rt), value, value);
string_freez(rt->units);
}
@@ -1221,8 +1225,8 @@ static int health_readfile(const char *filename, void *data) {
alert_cfg->info = string_strdupz(value);
if(rt->info) {
if(strcmp(rrdcalctemplate_info(rt), value) != 0)
- error("Health configuration at line %zu of file '%s' for template '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
- line, filename, rrdcalctemplate_name(rt), key, rrdcalctemplate_info(rt), value, value);
+ netdata_log_error("Health configuration at line %zu of file '%s' for template '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
+ line, filename, rrdcalctemplate_name(rt), key, rrdcalctemplate_info(rt), value, value);
string_freez(rt->info);
}
@@ -1246,8 +1250,8 @@ static int health_readfile(const char *filename, void *data) {
alert_cfg->host_labels = string_strdupz(value);
if(rt->host_labels) {
if(strcmp(rrdcalctemplate_host_labels(rt), value) != 0)
- error("Health configuration at line %zu of file '%s' for template '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
- line, filename, rrdcalctemplate_name(rt), key, rrdcalctemplate_host_labels(rt), value, value);
+ netdata_log_error("Health configuration at line %zu of file '%s' for template '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').",
+ line, filename, rrdcalctemplate_name(rt), key, rrdcalctemplate_host_labels(rt), value, value);
string_freez(rt->host_labels);
simple_pattern_free(rt->host_labels_pattern);
@@ -1266,8 +1270,8 @@ static int health_readfile(const char *filename, void *data) {