summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthiagoftsm <thiagoftsm@gmail.com>2021-02-11 12:45:05 +0000
committerGitHub <noreply@github.com>2021-02-11 12:45:05 +0000
commitfb2d4be0f2f54f541f797fe2d1ce958f81ab1120 (patch)
tree729f03435131767c1acc7f1791891c3957ab80ae
parentb7543176283b6e555aab14c131cccb4c54767725 (diff)
Disable stock alarms (#10617)
Bring new option to disable stock alarms when it is necessary
-rw-r--r--health/health_config.c8
-rw-r--r--libnetdata/libnetdata.c2
2 files changed, 9 insertions, 1 deletions
diff --git a/health/health_config.c b/health/health_config.c
index a200a0dbf8..1acf369335 100644
--- a/health/health_config.c
+++ b/health/health_config.c
@@ -1023,5 +1023,13 @@ void health_readdir(RRDHOST *host, const char *user_path, const char *stock_path
return;
}
+ int stock_enabled = (int)config_get_boolean(CONFIG_SECTION_HEALTH, "enable stock health configuration",
+ CONFIG_BOOLEAN_YES);
+
+ if (!stock_enabled) {
+ info("Netdata will not load stock alarms.");
+ stock_path = user_path;
+ }
+
recursive_config_double_dir_load(user_path, stock_path, subpath, health_readfile, (void *) host, 0);
}
diff --git a/libnetdata/libnetdata.c b/libnetdata/libnetdata.c
index c9b7ab1983..325df3f765 100644
--- a/libnetdata/libnetdata.c
+++ b/libnetdata/libnetdata.c
@@ -1406,7 +1406,7 @@ void recursive_config_double_dir_load(const char *user_path, const char *stock_p
if (!dir) {
error("CONFIG cannot open stock config directory '%s'.", sdir);
}
- else {
+ else if (strcmp(udir, sdir)) {
struct dirent *de = NULL;
while((de = readdir(dir))) {
if(de->d_type == DT_DIR || de->d_type == DT_LNK) {