Same as 'update every' config file option.", "seconds", "1"},
{'u', "System username to run as.", "username", "netdata"},
{'v', "Version of the program", NULL, NULL},
- {'W', "vendor options.", "stacksize=<size>|unittest|debug_flag", NULL},
+ {'W', "vendor options.", "stacksize=N|unittest|debug_flags=N", NULL},
};
void help(int exitcode) {
break;
case 'v':
// TODO: Outsource version to makefile which can compute version from git.
- printf("netdata 1.2.1_master\n");
+ printf("netdata 1.3.0\n");
return 0;
case 'W':
{
error("WARNING: Cannot get machine hostname.");
hostname = config_get("global", "hostname", hostnamebuf);
debug(D_OPTIONS, "hostname set to '%s'", hostname);
+ setenv("NETDATA_HOSTNAME", hostname, 1);
}
// --------------------------------------------------------------------
// this causes the threads to block signals.
sigset_t sigset;
sigfillset(&sigset);
-
- if(pthread_sigmask(SIG_BLOCK, &sigset, NULL) == -1) {
+ if(pthread_sigmask(SIG_BLOCK, &sigset, NULL) == -1)
error("Could not block signals for threads");
- }
// Catch signals which we want to use
struct sigaction sa;
- sigemptyset(&sa.sa_mask);
- sigaddset(&sa.sa_mask, SIGINT);
- sigaddset(&sa.sa_mask, SIGTERM);
- sa.sa_handler = sig_handler_exit;
sa.sa_flags = 0;
- if(sigaction(SIGINT, &sa, NULL) == -1) {
+
+ // ingore all signals while we run in a signal handler
+ sigfillset(&sa.sa_mask);
+
+ // INFO: If we add signals here we have to unblock them
+ // at popen.c when running a external plugin.
+
+ // Ignore SIGPIPE completely.
+ sa.sa_handler = SIG_IGN;
+ if(sigaction(SIGPIPE, &sa, NULL) == -1)
+ error("Failed to change signal handler for SIGPIPE");
+
+ sa.sa_handler = sig_handler_exit;
+ if(sigaction(SIGINT, &sa, NULL) == -1)
error("Failed to change signal handler for SIGINT");
- }
- if(sigaction(SIGTERM, &sa, NULL) == -1) {
+
+ sa.sa_handler = sig_handler_exit;
+ if(sigaction(SIGTERM, &sa, NULL) == -1)
error("Failed to change signal handler for SIGTERM");
- }
- sigemptyset(&sa.sa_mask);
- sigaddset(&sa.sa_mask, SIGHUP);
sa.sa_handler = sig_handler_logrotate;
- sa.sa_flags = 0;
- if(sigaction(SIGHUP, &sa, NULL) == -1) {
+ if(sigaction(SIGHUP, &sa, NULL) == -1)
error("Failed to change signal handler for SIGHUP");
- }
// save database on SIGUSR1
- sigemptyset(&sa.sa_mask);
- sigaddset(&sa.sa_mask, SIGUSR1);
sa.sa_handler = sig_handler_save;
- if(sigaction(SIGUSR1, &sa, NULL) == -1) {
+ if(sigaction(SIGUSR1, &sa, NULL) == -1)
error("Failed to change signal handler for SIGUSR1");
- }
- // Ignore SIGPIPE completely.
- // INFO: If we add signals here we have to unblock them
- // at popen.c when running a external plugin.
- sigemptyset(&sa.sa_mask);
- sigaddset(&sa.sa_mask, SIGPIPE);
- sa.sa_handler = SIG_IGN;
- if(sigaction(SIGPIPE, &sa, NULL) == -1) {
- error("Failed to change signal handler for SIGPIPE");
- }
+ // reload health configuration on SIGUSR2
+ sa.sa_handler = sig_handler_reload_health;
+ if(sigaction(SIGUSR2, &sa, NULL) == -1)
+ error("Failed to change signal handler for SIGUSR2");
// --------------------------------------------------------------------