X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fcollectd.c;h=4e18fd6e2280edcce9b1190777c846bdfa11dd3f;hb=0a57b248543e5adbfd38b65dabbf93870df77a07;hp=9f3c62b7e17cec657a94df111544892c137d39c3;hpb=39d723f4cb1d50b7ebb90c3251f0ebabad576412;p=collectd.git diff --git a/src/collectd.c b/src/collectd.c index 9f3c62b7..4e18fd6e 100644 --- a/src/collectd.c +++ b/src/collectd.c @@ -23,9 +23,9 @@ #include "collectd.h" #include "common.h" -#include "network.h" #include "plugin.h" #include "configfile.h" +#include "types_list.h" /* * Global variables @@ -70,7 +70,7 @@ static int init_global_variables (void) str = global_option_get ("Interval"); if (str == NULL) - str = COLLECTD_STEP; + str = "10"; interval_g = atoi (str); if (interval_g <= 0) { @@ -114,7 +114,7 @@ static int change_basedir (const char *orig_dir) if (mkdir (orig_dir, 0755) == -1) { char errbuf[1024]; - ERROR ("mkdir (%s): %s", orig_dir, + ERROR ("change_basedir: mkdir (%s): %s", orig_dir, sstrerror (errno, errbuf, sizeof (errbuf))); return (-1); @@ -187,11 +187,6 @@ static void exit_usage (char *name) " Config-File "CONFIGFILE"\n" " PID-File "PIDFILE"\n" " Data-Directory "PKGLOCALSTATEDIR"\n" -#if COLLECT_DEBUG - " Log-File "LOGFILE"\n" -#endif - " Step "COLLECTD_STEP" seconds\n" - " Heartbeat "COLLECTD_HEARTBEAT" seconds\n" "\n"PACKAGE" "VERSION", http://collectd.org/\n" "by Florian octo Forster \n" "for contributions see `AUTHORS'\n"); @@ -219,6 +214,7 @@ static int do_init (void) } #endif + read_types_list (); plugin_init_all (); return (0); @@ -324,6 +320,7 @@ int main (int argc, char **argv) struct sigaction sigIntAction; struct sigaction sigTermAction; char *configfile = CONFIGFILE; + int test_config = 0; const char *basedir; #if COLLECT_DAEMON struct sigaction sigChldAction; @@ -336,7 +333,7 @@ int main (int argc, char **argv) { int c; - c = getopt (argc, argv, "hC:" + c = getopt (argc, argv, "htC:" #if COLLECT_DAEMON "fP:" #endif @@ -350,6 +347,9 @@ int main (int argc, char **argv) case 'C': configfile = optarg; break; + case 't': + test_config = 1; + break; #if COLLECT_DAEMON case 'P': global_option_set ("PIDFile", optarg); @@ -401,6 +401,9 @@ int main (int argc, char **argv) if (init_global_variables () != 0) return (1); + if (test_config) + return (0); + #if COLLECT_DAEMON /* * fork off child