apps.plugin inherits NETDATA_CONFIG_DIR from netdata #133
Costa Tsaousis (ktsaou) committed
Apr 2, 2016 at 06:38 UTC
d1e6ecc0b95bf21dd91cc1667b52117842dc1220
1 file changed
+9
-1
src/apps_plugin.c
+9
-1
@@ -45,6 +45,7 @@ int update_every = 1;
45
unsigned long long file_counter = 0;
46
47
char *host_prefix = "";
48
+char *config_dir = CONFIG_DIR;
49
50
// ----------------------------------------------------------------------------
51
// memory debugger
@@ -386,7 +387,7 @@ int read_process_groups(const char *name)
387
char buffer[4096+1];
388
char filename[FILENAME_MAX + 1];
389
389
- snprintf(filename, FILENAME_MAX, "%s/apps_%s.conf", CONFIG_DIR, name);
390
+ snprintf(filename, FILENAME_MAX, "%s/apps_%s.conf", config_dir, name);
391
392
if(debug) fprintf(stderr, "apps.plugin: process groups file: '%s'\n", filename);
393
FILE *fp = fopen(filename, "r");
@@ -1947,6 +1948,13 @@ int main(int argc, char **argv)
1948
}
1949
else info("Found NETDATA_HOST_PREFIX='%s'", host_prefix);
1950
1951
+ config_dir = getenv("NETDATA_CONFIG_DIR");
1952
+ if(config_dir == NULL) {
1953
+ info("NETDATA_CONFIG_DIR is not passed from netdata");
1954
+ config_dir = CONFIG_DIR;
1955
+ }
1956
+ else info("Found NETDATA_CONFIG_DIR='%s'", config_dir);
1957
+
1958
info("starting...");
1959
1960
procfile_adaptive_initial_allocation = 1;