summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorFederico Ceratto <federico.ceratto@gmail.com>2016-11-23 15:49:10 +0000
committerFederico Ceratto <federico.ceratto@gmail.com>2016-11-23 15:49:10 +0000
commit87649cf32bd0e14d5a903fb85b01e9f41a253540 (patch)
treebbefda6dac074aeb87529592e8e5064f69cbe024 /src/main.c
parentImported Upstream version 1.3.0+dfsg (diff)
downloadnetdata-87649cf32bd0e14d5a903fb85b01e9f41a253540.tar.xz
netdata-87649cf32bd0e14d5a903fb85b01e9f41a253540.zip
New upstream version 1.4.0+dfsgupstream/1.4.0+dfsg
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/src/main.c b/src/main.c
index 4d55a1425..3e6aa5046 100644
--- a/src/main.c
+++ b/src/main.c
@@ -276,20 +276,16 @@ static const char *verify_required_directory(const char *dir) {
int main(int argc, char **argv)
{
+ char *hostname = "localhost";
int i, check_config = 0;
int config_loaded = 0;
int dont_fork = 0;
size_t wanted_stacksize = 0, stacksize = 0;
pthread_attr_t attr;
- // global initialization
- get_HZ();
-
// set the name for logging
program_name = "netdata";
- // parse command line.
-
// parse depercated options
// TODO: Remove this block with the next major release.
{
@@ -378,7 +374,7 @@ int main(int argc, char **argv)
break;
case 'v':
// TODO: Outsource version to makefile which can compute version from git.
- printf("netdata 1.3.0\n");
+ printf("netdata %s\n", VERSION);
return 0;
case 'W':
{
@@ -411,6 +407,16 @@ int main(int argc, char **argv)
load_config(NULL, 0);
{
+ char *pmax = config_get("global", "glibc malloc arena max for plugins", "1");
+ if(pmax && *pmax)
+ setenv("MALLOC_ARENA_MAX", pmax, 1);
+
+#if defined(HAVE_C_MALLOPT)
+ int i = config_get_number("global", "glibc malloc arena max for netdata", 1);
+ if(i > 0)
+ mallopt(M_ARENA_MAX, 1);
+#endif
+
char *config_dir = config_get("global", "config directory", CONFIG_DIR);
// prepare configuration environment variables for the plugins
@@ -471,13 +477,18 @@ int main(int argc, char **argv)
global_host_prefix = config_get("global", "host access prefix", "");
setenv("NETDATA_HOST_PREFIX", global_host_prefix, 1);
+ get_system_HZ();
+ get_system_cpus();
+ get_system_pid_max();
+
// --------------------------------------------------------------------
stdout_filename = config_get("global", "debug log", LOG_DIR "/debug.log");
stderr_filename = config_get("global", "error log", LOG_DIR "/error.log");
stdaccess_filename = config_get("global", "access log", LOG_DIR "/access.log");
- error_log_throttle_period = config_get_number("global", "errors flood protection period", error_log_throttle_period);
+ error_log_throttle_period_backup =
+ error_log_throttle_period = config_get_number("global", "errors flood protection period", error_log_throttle_period);
setenv("NETDATA_ERRORS_THROTTLE_PERIOD", config_get("global", "errors flood protection period" , ""), 1);
error_log_errors_per_period = (unsigned long)config_get_number("global", "errors to trigger flood protection", error_log_errors_per_period);
@@ -488,6 +499,7 @@ int main(int argc, char **argv)
error_log_throttle_period = 0;
error_log_errors_per_period = 0;
}
+ error_log_limit_unlimited();
// --------------------------------------------------------------------
@@ -647,6 +659,11 @@ int main(int argc, char **argv)
}
// ------------------------------------------------------------------------
+ // initialize rrd host
+
+ rrdhost_init(hostname);
+
+ // ------------------------------------------------------------------------
// initialize the registry
registry_init();
@@ -660,6 +677,11 @@ int main(int argc, char **argv)
exit(1);
// ------------------------------------------------------------------------
+ // enable log flood protection
+
+ error_log_limit_reset();
+
+ // ------------------------------------------------------------------------
// spawn the threads
web_server_threading_selection();