]> arthur.barton.de Git - netdata.git/blobdiff - src/plugins_d.c
lower the memory footprint of dimensions by 1.5KB
[netdata.git] / src / plugins_d.c
index 4b83b5281616058afa2d26b7e22c32b1a60f8ea1..4ddcc20d036adcb3262406298dad2e8508e83ed7 100644 (file)
@@ -316,9 +316,9 @@ void *pluginsd_worker_thread(void *arg)
                     rd = rrddim_add(st, id, name, multiplier, divisor, rrddim_algorithm_id(algorithm));
                     rd->flags = 0x00000000;
                     if(options && *options) {
-                        if(strstr(options, "hidden") != NULL) rd->flags |= RRDDIM_FLAG_HIDDEN;
-                        if(strstr(options, "noreset") != NULL) rd->flags |= RRDDIM_FLAG_DONT_DETECT_RESETS_OR_OVERFLOWS;
-                        if(strstr(options, "nooverflow") != NULL) rd->flags |= RRDDIM_FLAG_DONT_DETECT_RESETS_OR_OVERFLOWS;
+                        if(strstr(options, "hidden") != NULL) rrddim_flag_set(rd, RRDDIM_FLAG_HIDDEN);
+                        if(strstr(options, "noreset") != NULL) rrddim_flag_set(rd, RRDDIM_FLAG_DONT_DETECT_RESETS_OR_OVERFLOWS);
+                        if(strstr(options, "nooverflow") != NULL) rrddim_flag_set(rd, RRDDIM_FLAG_DONT_DETECT_RESETS_OR_OVERFLOWS);
                     }
                 }
                 else if(unlikely(st->debug)) debug(D_PLUGINSD, "PLUGINSD: dimension %s/%s already exists. Not adding it again.", st->id, id);
@@ -442,7 +442,6 @@ void *pluginsd_main(void *ptr) {
     if(pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) != 0)
         error("Cannot set pthread cancel state to ENABLE.");
 
-    char *dir_name = config_get("plugins", "plugins directory", PLUGINS_DIR);
     int automatic_run = config_get_boolean("plugins", "enable running new plugins", 1);
     int scan_frequency = (int) config_get_number("plugins", "check for new plugins every", 60);
     DIR *dir = NULL;
@@ -457,9 +456,9 @@ void *pluginsd_main(void *ptr) {
     for(;;) {
         if(unlikely(netdata_exit)) break;
 
-        dir = opendir(dir_name);
+        dir = opendir(netdata_configured_plugins_dir);
         if(unlikely(!dir)) {
-            error("Cannot open directory '%s'.", dir_name);
+            error("Cannot open directory '%s'.", netdata_configured_plugins_dir);
             goto cleanup;
         }
 
@@ -503,7 +502,7 @@ void *pluginsd_main(void *ptr) {
                 snprintfz(cd->id, CONFIG_MAX_NAME, "plugin:%s", pluginname);
 
                 strncpyz(cd->filename, file->d_name, FILENAME_MAX);
-                snprintfz(cd->fullfilename, FILENAME_MAX, "%s/%s", dir_name, cd->filename);
+                snprintfz(cd->fullfilename, FILENAME_MAX, "%s/%s", netdata_configured_plugins_dir, cd->filename);
 
                 cd->enabled = enabled;
                 cd->update_every = (int) config_get_number(cd->id, "update every", rrd_update_every);