From: Sebastian Harl Date: Fri, 17 Jun 2011 11:57:50 +0000 (+0200) Subject: Replaced 'interval_g' with 'plugin_interval' where and when necessary. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1070fdb12700f9bdba8aed05f5eae421c928b901;p=collectd.git Replaced 'interval_g' with 'plugin_interval' where and when necessary. --- diff --git a/src/cpu.c b/src/cpu.c index 666fbad5..66c093cc 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -163,7 +163,7 @@ static int init (void) DEBUG ("host_processors returned %i %s", (int) cpu_list_len, cpu_list_len == 1 ? "processor" : "processors"); INFO ("cpu plugin: Found %i processor%s.", (int) cpu_list_len, cpu_list_len == 1 ? "" : "s"); - cpu_temp_retry_max = 86400 / CDTIME_T_TO_TIME_T (interval_g); + cpu_temp_retry_max = 86400 / CDTIME_T_TO_TIME_T ((plugin_interval > 0) ? plugin_interval : interval_g); /* #endif PROCESSOR_CPU_LOAD_INFO */ #elif defined(HAVE_LIBKSTAT) diff --git a/src/dns.c b/src/dns.c index 9e868911..7974ed05 100644 --- a/src/dns.c +++ b/src/dns.c @@ -228,7 +228,7 @@ static void *dns_child_loop (__attribute__((unused)) void *dummy) pcap_obj = pcap_open_live ((pcap_device != NULL) ? pcap_device : "any", PCAP_SNAPLEN, 0 /* Not promiscuous */, - (int) CDTIME_T_TO_MS (interval_g / 2), + (int) CDTIME_T_TO_MS (((plugin_interval > 0) ? plugin_interval : interval_g) / 2), pcap_error); if (pcap_obj == NULL) { diff --git a/src/exec.c b/src/exec.c index 1da2bdd0..0229b12b 100644 --- a/src/exec.c +++ b/src/exec.c @@ -270,14 +270,15 @@ static void set_environment (void) /* {{{ */ char buffer[1024]; #ifdef HAVE_SETENV - ssnprintf (buffer, sizeof (buffer), "%.3f", CDTIME_T_TO_DOUBLE (interval_g)); + ssnprintf (buffer, sizeof (buffer), "%.3f", + CDTIME_T_TO_DOUBLE ((plugin_interval > 0) ? plugin_interval : interval_g)); setenv ("COLLECTD_INTERVAL", buffer, /* overwrite = */ 1); ssnprintf (buffer, sizeof (buffer), "%s", hostname_g); setenv ("COLLECTD_HOSTNAME", buffer, /* overwrite = */ 1); #else ssnprintf (buffer, sizeof (buffer), "COLLECTD_INTERVAL=%.3f", - CDTIME_T_TO_DOUBLE (interval_g)); + CDTIME_T_TO_DOUBLE ((plugin_interval > 0) ? plugin_interval : interval_g)); putenv (buffer); ssnprintf (buffer, sizeof (buffer), "COLLECTD_HOSTNAME=%s", hostname_g); diff --git a/src/ipmi.c b/src/ipmi.c index 3ec25ea6..3297729a 100644 --- a/src/ipmi.c +++ b/src/ipmi.c @@ -664,7 +664,7 @@ static int c_ipmi_init (void) int status; /* Don't send `ADD' notifications during startup (~ 1 minute) */ - time_t iv = CDTIME_T_TO_TIME_T (interval_g); + time_t iv = CDTIME_T_TO_TIME_T ((plugin_interval > 0) ? plugin_interval : interval_g); c_ipmi_init_in_progress = 1 + (60 / iv); c_ipmi_active = 1; diff --git a/src/libvirt.c b/src/libvirt.c index 95b46143..bd7ff1dc 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -139,7 +139,7 @@ init_value_list (value_list_t *vl, virDomainPtr dom) const char *name; char uuid[VIR_UUID_STRING_BUFLEN]; - vl->interval = interval_g; + vl->interval = plugin_interval; sstrncpy (vl->plugin, "libvirt", sizeof (vl->plugin)); diff --git a/src/memcached.c b/src/memcached.c index 6ae4843c..228beada 100644 --- a/src/memcached.c +++ b/src/memcached.c @@ -177,13 +177,15 @@ static int memcached_query_daemon (char *buffer, int buffer_size) /* {{{ */ p.revents = 0; status = poll (&p, /* nfds = */ 1, - /* timeout = */ CDTIME_T_TO_MS (interval_g)); + /* timeout = */ CDTIME_T_TO_MS ((plugin_interval > 0) + ? plugin_interval : interval_g)); if (status <= 0) { if (status == 0) { ERROR ("memcached: poll(2) timed out after %.3f seconds.", - CDTIME_T_TO_DOUBLE (interval_g)); + CDTIME_T_TO_DOUBLE ((plugin_interval > 0) + ? plugin_interval : interval_g)); } else { diff --git a/src/modbus.c b/src/modbus.c index 5b3bc1cb..13ed755b 100644 --- a/src/modbus.c +++ b/src/modbus.c @@ -237,7 +237,7 @@ static int mb_submit (mb_host_t *host, mb_slave_t *slave, /* {{{ */ return (EINVAL); if (host->interval <= 0) - host->interval = interval_g; + host->interval = (plugin_interval > 0) ? plugin_interval : interval_g; if (slave->instance[0] == 0) ssnprintf (slave->instance, sizeof (slave->instance), "slave_%i", diff --git a/src/network.c b/src/network.c index 1d6708d5..d1d973fd 100644 --- a/src/network.c +++ b/src/network.c @@ -3225,7 +3225,7 @@ static int network_stats_read (void) /* {{{ */ vl.values = values; vl.values_len = 2; vl.time = 0; - vl.interval = interval_g; + vl.interval = plugin_interval; sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "network", sizeof (vl.plugin)); diff --git a/src/powerdns.c b/src/powerdns.c index ae74b437..53d7b84b 100644 --- a/src/powerdns.c +++ b/src/powerdns.c @@ -364,7 +364,7 @@ static int powerdns_get_data_dgram (list_item_t *item, /* {{{ */ break; } - cdt_timeout = interval_g * 3 / 4; + cdt_timeout = ((plugin_interval > 0) ? plugin_interval : interval_g) * 3 / 4; if (cdt_timeout < TIME_T_TO_CDTIME_T (2)) cdt_timeout = TIME_T_TO_CDTIME_T (2); diff --git a/src/snmp.c b/src/snmp.c index 9e3143b7..667238ab 100644 --- a/src/snmp.c +++ b/src/snmp.c @@ -1527,7 +1527,7 @@ static int csnmp_read_host (user_data_t *ud) host = ud->data; if (host->interval == 0) - host->interval = interval_g; + host->interval = (plugin_interval > 0) ? plugin_interval : interval_g; time_start = cdtime ();