From 05b7b7e327b01a33da39f5550694294fd0d29849 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Mon, 26 Mar 2007 18:44:27 +0200 Subject: [PATCH] Removed the `LOGFILE' and `COLLECT_{STEP,HEARTBEAT,XFF,RRAROWS}' defines. --- configure.in | 40 +--------------------------------------- src/Makefile.am | 14 -------------- src/collectd.c | 7 +------ src/collectd.conf.in | 6 ------ src/collectd.conf.pod | 21 +++++++-------------- src/collectd.h | 20 -------------------- src/configfile.c | 1 - src/disk.c | 19 ++++--------------- src/dns.c | 2 +- src/mysql.c | 6 +----- src/ping.c | 7 ++----- src/plugin.c | 19 ++++++------------- src/unixsock.c | 2 +- 13 files changed, 24 insertions(+), 140 deletions(-) diff --git a/configure.in b/configure.in index 27a6ec48..f380ca2b 100644 --- a/configure.in +++ b/configure.in @@ -1082,42 +1082,6 @@ else fi AM_CONDITIONAL(BUILD_WITH_LIBIPTC, test "x$with_libiptc" = "xyes") -# Define `step' and `hearbeat' values.. -declare -i collectd_step=10 -declare -i collectd_heartbeat=25 -AC_ARG_WITH(step, [AS_HELP_STRING([--with-step=SECONDS], [Interval in which plugins are queried.])], -[ - if test "x$withval" != "xno" -a "x$withval" != "xyes" - then - declare -i tmp_collectd_step="$withval" - if test $tmp_collectd_step -gt 0 - then - collectd_step=$tmp_collectd_step - let "collectd_heartbeat=$collectd_step*2" - fi - fi -], []) -AC_ARG_WITH(heartbeat, [AS_HELP_STRING([--with-heartbeat=SECONDS], [Heartbeat of the DS in generated RRD files.])], -[ - if test "x$withval" != "xno" -a "x$withval" != "xyes" - then - declare -i tmp_collectd_heartbeat="$withval" - if test $tmp_collectd_heartbeat -gt 0 - then - collectd_heartbeat=$tmp_collectd_heartbeat - fi - fi -], []) - -if test $collectd_step -ne 10 -then - AC_DEFINE_UNQUOTED(COLLECTD_STEP, "$collectd_step", [Interval in which plugins are queried.]) -fi -if test $collectd_heartbeat -ne 25 -then - AC_DEFINE_UNQUOTED(COLLECTD_HEARTBEAT, "$collectd_heartbeat", [Interval in which plugins are queried.]) -fi - # Check for enabled/disabled features # @@ -1248,8 +1212,6 @@ Configuration: Features: debug . . . . . . . $enable_debug daemon mode . . . . $enable_daemon - step . . . . . . . $collectd_step seconds - heartbeat . . . . . $collectd_heartbeat seconds Modules: apache . . . . . . $enable_apache @@ -1270,6 +1232,7 @@ Configuration: iptables . . . . . $enable_iptables irq . . . . . . . . $enable_irq load . . . . . . . $enable_load + logfile . . . . . . $enable_logfile mbmon . . . . . . . $enable_mbmon memory . . . . . . $enable_memory multimeter . . . . $enable_multimeter @@ -1281,7 +1244,6 @@ Configuration: processes . . . . . $enable_processes sensors . . . . . . $enable_sensors serial . . . . . . $enable_serial - logfile . . . . . . $enable_logfile swap . . . . . . . $enable_swap syslog . . . . . . $enable_syslog tape . . . . . . . $enable_tape diff --git a/src/Makefile.am b/src/Makefile.am index bcbeedf1..44445fb8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -26,9 +26,6 @@ if BUILD_FEATURE_DAEMON collectd_CPPFLAGS += -DPIDFILE='"${localstatedir}/run/${PACKAGE_NAME}.pid"' endif collectd_CPPFLAGS += -DPLUGINDIR='"${pkglibdir}"' -if BUILD_FEATURE_DEBUG -collectd_CPPFLAGS += -DLOGFILE='"${localstatedir}/log/${PACKAGE_NAME}/collectd.log"' -endif # Link to these libraries.. collectd_LDFLAGS = -export-dynamic @@ -214,17 +211,6 @@ collectd_LDADD += "-dlopen" exec.la collectd_DEPENDENCIES += exec.la endif -#if BUILD_MODULE_QUOTA -#pkglib_LTLIBRARIES += quota.la -#quota_la_SOURCES = quota_plugin.c quota_plugin.h -#quota_la_SOURCES += quota_fs.c quota_fs.h -#quota_la_SOURCES += quota_mnt.c quota_mnt.h -#quota_la_LDFLAGS = -module -avoid-version -#quota_la_CFLAGS = -Werror -#collectd_LDADD += "-dlopen" quota.la -#collectd_DEPENDENCIES += quota.la -#endif - if BUILD_MODULE_HDDTEMP pkglib_LTLIBRARIES += hddtemp.la hddtemp_la_SOURCES = hddtemp.c diff --git a/src/collectd.c b/src/collectd.c index 9f3c62b7..f8f2fcc5 100644 --- a/src/collectd.c +++ b/src/collectd.c @@ -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) { @@ -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"); diff --git a/src/collectd.conf.in b/src/collectd.conf.in index 7ea2a1a7..dcd87eea 100644 --- a/src/collectd.conf.in +++ b/src/collectd.conf.in @@ -4,12 +4,6 @@ # http://collectd.org/ # -# Set the IP-address(es) and UDP-port(s) to send packets to. `Listen' can be -# used as a synonym for `Server' to make the config file more readable when in -# server mode. The port option is optional. -#Server ff18::efc0:4a42 25826 -#Server 239.192.74.66 25826 - #BaseDir "/opt/collectd/var/lib/collectd" #PIDFile "/opt/collectd/var/run/collectd.pid" #PluginDir "/opt/collectd/lib/collectd" diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index b47fdc1d..3aaf03eb 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -54,18 +54,11 @@ Sets where to write the PID file to. This file is overwritten when it exists and deleted when the program ist stopped. Some init-scripts might override this setting using the B<-P> commandline option. -=item B I - -Sets the file to write debugging output to. This is only used if compiled with -debugging enabled. It's ignored otherwise. - =item B I Configures the interval in which to query the read plugins. Obviously smaller values lead to a higher system load produces by collectd, while higher values -lead to more coarse statistics. Please note that changing this value may render -your RRD-files unuseable, if you use the C. You have been -warned. +lead to more coarse statistics. =back @@ -372,9 +365,9 @@ smaller. If unsure, don't set this option. =item B I -Sets the heartbeat of newly created RRD-files. Ideally (and per default) this -setting is bigger than the B-setting. If unsure, don't set this -option. +Sets the heartbeat of newly created RRD-files. Ideally this setting is bigger +than the B-setting, by default it's twice the B-setting. If +unsure, don't set this option. =item B I @@ -388,12 +381,12 @@ So for each timespan, it calculates how many PDPs need to be consolidated into one CDP by calculating: number of PDPs = timespan / (stepsize * rrarows) -Bottom line is, set this no smaller than the width of you graphs in pixels. +Bottom line is, set this no smaller than the width of you graphs in pixels. The +default is 1200. =item B I -Set the "XFiles Factor". This is mostly interesting if you set B -bigger than B. If unsure, don't set this option. +Set the "XFiles Factor". The default is 0.1. If unsure, don't set this option. =item B I diff --git a/src/collectd.h b/src/collectd.h index 0e8f6f7c..e1ce97c1 100644 --- a/src/collectd.h +++ b/src/collectd.h @@ -187,10 +187,6 @@ #define PIDFILE PREFIX "/var/run/" PACKAGE_NAME ".pid" #endif -#ifndef LOGFILE -#define LOGFILE PREFIX"/var/log/"PACKAGE_NAME"/"PACKAGE_NAME".log" -#endif - #ifndef PLUGINDIR #define PLUGINDIR PREFIX "/lib/" PACKAGE_NAME #endif @@ -204,22 +200,6 @@ # define COLLECTD_GRP_NAME "collectd" #endif -#ifndef COLLECTD_STEP -# define COLLECTD_STEP "10" -#endif - -#ifndef COLLECTD_HEARTBEAT -# define COLLECTD_HEARTBEAT "25" -#endif - -#ifndef COLLECTD_ROWS -# define COLLECTD_ROWS "1200" -#endif - -#ifndef COLLECTD_XFF -# define COLLECTD_XFF 0.1 -#endif - #define STATIC_ARRAY_LEN(array) (sizeof (array) / sizeof ((array)[0])) extern char hostname_g[]; diff --git a/src/configfile.c b/src/configfile.c index 3cc0379b..d636c8c7 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -77,7 +77,6 @@ static int cf_value_map_num = STATIC_ARRAY_LEN (cf_value_map); static cf_global_option_t cf_global_options[] = { {"BaseDir", NULL, PKGLOCALSTATEDIR}, - {"LogFile", NULL, LOGFILE}, {"PIDFile", NULL, PIDFILE}, {"Hostname", NULL, NULL}, {"Interval", NULL, "10"} diff --git a/src/disk.c b/src/disk.c index 36d7b4fa..2a5b713b 100644 --- a/src/disk.c +++ b/src/disk.c @@ -126,7 +126,6 @@ typedef struct diskstats } diskstats_t; static diskstats_t *disklist; -static int min_poll_count; /* #endif KERNEL_LINUX */ #elif HAVE_LIBKSTAT @@ -159,17 +158,7 @@ static int disk_init (void) /* #endif HAVE_IOKIT_IOKITLIB_H */ #elif KERNEL_LINUX - int step; - int heartbeat; - - step = atoi (COLLECTD_STEP); - heartbeat = atoi (COLLECTD_HEARTBEAT); - - assert (step > 0); - assert (heartbeat >= step); - - min_poll_count = 1 + (heartbeat / step); - DEBUG ("min_poll_count = %i;", min_poll_count); + /* do nothing */ /* #endif KERNEL_LINUX */ #elif HAVE_LIBKSTAT @@ -537,10 +526,10 @@ static int disk_read (void) /* Don't write to the RRDs if we've just started.. */ ds->poll_count++; - if (ds->poll_count <= min_poll_count) + if (ds->poll_count <= 2) { - DEBUG ("(ds->poll_count = %i) <= (min_poll_count = %i); => Not writing.", - ds->poll_count, min_poll_count); + DEBUG ("(ds->poll_count = %i) <= (min_poll_count = 2); => Not writing.", + ds->poll_count); continue; } diff --git a/src/dns.c b/src/dns.c index 255d1760..473003a7 100644 --- a/src/dns.c +++ b/src/dns.c @@ -256,7 +256,7 @@ static void *dns_child_loop (void *dummy) pcap_obj = pcap_open_live (pcap_device, PCAP_SNAPLEN, 0 /* Not promiscuous */, - atoi (COLLECTD_STEP), + interval_g, pcap_error); if (pcap_obj == NULL) { diff --git a/src/mysql.c b/src/mysql.c index f622d3d6..92b49bff 100644 --- a/src/mysql.c +++ b/src/mysql.c @@ -113,8 +113,6 @@ static MYSQL *getconnection (void) static int wait_for = 0; static int wait_increase = 60; - int step; - if (state != 0) { int err; @@ -130,11 +128,9 @@ static MYSQL *getconnection (void) } } - step = atoi (COLLECTD_STEP); - if (wait_for > 0) { - wait_for -= step; + wait_for -= interval_g; return (NULL); } diff --git a/src/ping.c b/src/ping.c index 3ac7aaba..7c30a25e 100644 --- a/src/ping.c +++ b/src/ping.c @@ -71,8 +71,6 @@ static void add_hosts (void) hostlist_t *hl_this; hostlist_t *hl_prev; - int step = atoi (COLLECTD_STEP); - hl_this = hosts; hl_prev = NULL; while (hl_this != NULL) @@ -104,7 +102,7 @@ static void add_hosts (void) } else { - hl_this->wait_left -= step; + hl_this->wait_left -= interval_g; } if (hl_this != NULL) @@ -139,7 +137,6 @@ static int ping_config (const char *key, const char *value) { hostlist_t *hl; char *host; - int step = atoi (COLLECTD_STEP); if ((hl = (hostlist_t *) malloc (sizeof (hostlist_t))) == NULL) { @@ -160,7 +157,7 @@ static int ping_config (const char *key, const char *value) } hl->host = host; - hl->wait_time = 2 * step; + hl->wait_time = 2 * interval_g; hl->wait_left = 0; hl->next = hosts; hosts = hl; diff --git a/src/plugin.c b/src/plugin.c index 74a6e5eb..85a54edf 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -260,7 +260,7 @@ int plugin_register_read (const char *name, } memset (rf, '\0', sizeof (read_func_t)); - rf->wait_time = atoi (COLLECTD_STEP); + rf->wait_time = interval_g; rf->wait_left = 0; rf->callback = callback; @@ -365,20 +365,17 @@ void plugin_read_all (const int *loop) llentry_t *le; read_func_t *rf; int status; - int step; if (list_read == NULL) return; - step = atoi (COLLECTD_STEP); - le = llist_head (list_read); while ((*loop == 0) && (le != NULL)) { rf = (read_func_t *) le->value; if (rf->wait_left > 0) - rf->wait_left -= step; + rf->wait_left -= interval_g; if (rf->wait_left > 0) { le = le->next; @@ -400,7 +397,7 @@ void plugin_read_all (const int *loop) else { rf->wait_left = 0; - rf->wait_time = step; + rf->wait_time = interval_g; } le = le->next; @@ -497,7 +494,6 @@ void plugin_complain (int level, complain_t *c, const char *format, ...) { char message[512]; va_list ap; - int step; if (c->delay > 0) { @@ -505,18 +501,15 @@ void plugin_complain (int level, complain_t *c, const char *format, ...) return; } - step = atoi (COLLECTD_STEP); - assert (step > 0); - - if (c->interval < step) - c->interval = step; + if (c->interval < interval_g) + c->interval = interval_g; else c->interval *= 2; if (c->interval > 86400) c->interval = 86400; - c->delay = c->interval / step; + c->delay = c->interval / interval_g; va_start (ap, format); vsnprintf (message, 512, format, ap); diff --git a/src/unixsock.c b/src/unixsock.c index bea8a4ff..4cf3c134 100644 --- a/src/unixsock.c +++ b/src/unixsock.c @@ -880,7 +880,7 @@ static int us_shutdown (void) static int us_write (const data_set_t *ds, const value_list_t *vl) { cache_update (ds, vl); - cache_flush (2 * atoi (COLLECTD_STEP)); + cache_flush (2 * interval_g); return (0); } -- 2.11.0