diff options
author | Emmanuel Vasilakis <mrzammler@mm.st> | 2023-11-15 14:36:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-15 14:36:27 +0200 |
commit | db86eb91b78fe584752afe44e2a362539b4d5ee2 (patch) | |
tree | 45a7052295d6abec3b6cc6b9d9b8b568c656644a | |
parent | 183a7fb84f85885a3d91f8e28d4e9780f964f659 (diff) |
Don't print errors from reading filtered alerts (#16417)
-rw-r--r-- | health/health_config.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/health/health_config.c b/health/health_config.c index 1a730ab91b..f33207b5c8 100644 --- a/health/health_config.c +++ b/health/health_config.c @@ -583,6 +583,7 @@ static int health_readfile(const char *filename, void *data) { struct alert_config *alert_cfg = NULL; int ignore_this = 0; + bool filtered_config = false; size_t line = 0, append = 0; char *s; while((s = fgets(&buffer[append], (int)(HEALTH_CONF_MAX_LINE - append), fp)) || append) { @@ -680,8 +681,10 @@ static int health_readfile(const char *filename, void *data) { alert_cfg->alarm = string_dup(rc->name); alert_cfg->source = health_source_file(line, filename); ignore_this = 0; + filtered_config = false; } else { rc = NULL; + filtered_config = true; } } else if(hash == hash_template && !strcasecmp(key, HEALTH_TEMPLATE_KEY)) { @@ -727,8 +730,10 @@ static int health_readfile(const char *filename, void *data) { alert_cfg->template_key = string_dup(rt->name); alert_cfg->source = health_source_file(line, filename); ignore_this = 0; + filtered_config = false; } else { rt = NULL; + filtered_config = true; } } else if(hash == hash_os && !strcasecmp(key, HEALTH_OS_KEY)) { @@ -1320,8 +1325,8 @@ static int health_readfile(const char *filename, void *data) { } } else { - netdata_log_error("Health configuration at line %zu of file '%s' has unknown key '%s'. Expected either '" HEALTH_ALARM_KEY "' or '" HEALTH_TEMPLATE_KEY "'.", - line, filename, key); + if (!filtered_config) + netdata_log_error("Health configuration at line %zu of file '%s' has unknown key '%s'. Expected either '" HEALTH_ALARM_KEY "' or '" HEALTH_TEMPLATE_KEY "'.", line, filename, key); } } |