diff options
Diffstat (limited to 'daemon/main.c')
-rw-r--r-- | daemon/main.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/daemon/main.c b/daemon/main.c index 97cd162a8..e875fa938 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -458,12 +458,8 @@ static void get_netdata_configured_variables() { netdata_configured_home_dir = config_get(CONFIG_SECTION_GLOBAL, "home directory", netdata_configured_home_dir); { - char plugins_dirs[(FILENAME_MAX * 2) + 1]; - snprintfz(plugins_dirs, FILENAME_MAX * 2, "\"%s\" \"%s/custom-plugins.d\"", PLUGINS_DIR, CONFIG_DIR); - netdata_configured_plugins_dir_base = strdupz(config_get(CONFIG_SECTION_GLOBAL, "plugins directory", plugins_dirs)); - quoted_strings_splitter(netdata_configured_plugins_dir_base, plugin_directories, PLUGINSD_MAX_DIRECTORIES, config_isspace); - netdata_configured_plugins_dir = plugin_directories[0]; - + pluginsd_initialize_plugin_directories(); + netdata_configured_primary_plugins_dir = plugin_directories[PLUGINSD_STOCK_PLUGINS_DIRECTORY_PATH]; } // ------------------------------------------------------------------------ @@ -592,7 +588,7 @@ void set_global_environment() { setenv("NETDATA_CONFIG_DIR" , verify_required_directory(netdata_configured_user_config_dir), 1); setenv("NETDATA_USER_CONFIG_DIR" , verify_required_directory(netdata_configured_user_config_dir), 1); setenv("NETDATA_STOCK_CONFIG_DIR" , verify_required_directory(netdata_configured_stock_config_dir), 1); - setenv("NETDATA_PLUGINS_DIR" , verify_required_directory(netdata_configured_plugins_dir), 1); + setenv("NETDATA_PLUGINS_DIR" , verify_required_directory(netdata_configured_primary_plugins_dir), 1); setenv("NETDATA_WEB_DIR" , verify_required_directory(netdata_configured_web_dir), 1); setenv("NETDATA_CACHE_DIR" , verify_required_directory(netdata_configured_cache_dir), 1); setenv("NETDATA_LIB_DIR" , verify_required_directory(netdata_configured_varlib_dir), 1); @@ -657,8 +653,8 @@ void send_statistics( const char *action, const char *action_result, const char char *optout_file = mallocz(sizeof(char) * (strlen(netdata_configured_user_config_dir) +strlen(".opt-out-from-anonymous-statistics") + 2)); sprintf(optout_file, "%s/%s", netdata_configured_user_config_dir, ".opt-out-from-anonymous-statistics"); if (likely(access(optout_file, R_OK) != 0)) { - as_script = mallocz(sizeof(char) * (strlen(netdata_configured_plugins_dir) + strlen("anonymous-statistics.sh") + 2)); - sprintf(as_script, "%s/%s", netdata_configured_plugins_dir, "anonymous-statistics.sh"); + as_script = mallocz(sizeof(char) * (strlen(netdata_configured_primary_plugins_dir) + strlen("anonymous-statistics.sh") + 2)); + sprintf(as_script, "%s/%s", netdata_configured_primary_plugins_dir, "anonymous-statistics.sh"); if (unlikely(access(as_script, R_OK) != 0)) { netdata_anonymous_statistics_enabled=0; info("Anonymous statistics script %s not found.",as_script); @@ -964,9 +960,6 @@ int main(int argc, char **argv) { get_netdata_configured_variables(); set_global_environment(); - netdata_anonymous_statistics_enabled=-1; - send_statistics("START","-", "-"); - // work while we are cd into config_dir // to allow the plugins refer to their config // files using relative filenames @@ -999,11 +992,9 @@ int main(int argc, char **argv) { // -------------------------------------------------------------------- // get log filenames and settings - log_init(); error_log_limit_unlimited(); - // -------------------------------------------------------------------- // setup process signals @@ -1044,6 +1035,7 @@ int main(int argc, char **argv) { user = config_get(CONFIG_SECTION_GLOBAL, "run as user", (passwd && passwd->pw_name)?passwd->pw_name:""); } + // -------------------------------------------------------------------- // create the listening sockets @@ -1056,6 +1048,8 @@ int main(int argc, char **argv) { // initialize the log files open_all_log_files(); + netdata_anonymous_statistics_enabled=-1; + send_statistics("START","-", "-"); #ifdef NETDATA_INTERNAL_CHECKS if(debug_flags != 0) { |