summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d5ba2cb)
raw | patch | inline | side by side (parent: d5ba2cb)
author | Sebastian Harl <sh@tokkee.org> | |
Sun, 14 Oct 2012 14:37:18 +0000 (16:37 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sun, 14 Oct 2012 14:37:18 +0000 (16:37 +0200) |
Rather, use plugin_get_interval () in order to honor any plugin specific
interval settings.
interval settings.
16 files changed:
src/amqp.c | patch | blob | history | |
src/cpu.c | patch | blob | history | |
src/dns.c | patch | blob | history | |
src/exec.c | patch | blob | history | |
src/ipmi.c | patch | blob | history | |
src/libvirt.c | patch | blob | history | |
src/memcached.c | patch | blob | history | |
src/modbus.c | patch | blob | history | |
src/network.c | patch | blob | history | |
src/plugin.c | patch | blob | history | |
src/plugin.h | patch | blob | history | |
src/postgresql.c | patch | blob | history | |
src/powerdns.c | patch | blob | history | |
src/snmp.c | patch | blob | history | |
src/utils_cmd_putval.c | patch | blob | history | |
src/utils_complain.c | patch | blob | history |
diff --git a/src/amqp.c b/src/amqp.c
index adf4792b534b85f3219b6d5423bcc3c7c18a140a..30a85810139fd489d2e440ad5e39fce220d1bbec 100644 (file)
--- a/src/amqp.c
+++ b/src/amqp.c
camqp_config_t *conf = user_data;
int status;
+ cdtime_t interval = plugin_get_interval ();
+
while (subscriber_threads_running)
{
amqp_frame_t frame;
{
ERROR ("amqp plugin: camqp_connect failed. "
"Will sleep for %.3f seconds.",
- CDTIME_T_TO_DOUBLE (interval_g));
- sleep (interval_g);
+ CDTIME_T_TO_DOUBLE (interval));
+ sleep (interval);
continue;
}
{
ERROR ("amqp plugin: amqp_simple_wait_frame failed. "
"Will sleep for %.3f seconds.",
- CDTIME_T_TO_DOUBLE (interval_g));
+ CDTIME_T_TO_DOUBLE (interval));
camqp_close_connection (conf);
- sleep (interval_g);
+ sleep (interval);
continue;
}
diff --git a/src/cpu.c b/src/cpu.c
index 12071a2ca8bae25cf86f25782a682ad1bf898846..5448003a52b3fc8a6777002ba5ede168dd6ff500 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
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_get_interval ());
/* #endif PROCESSOR_CPU_LOAD_INFO */
#elif defined(HAVE_LIBKSTAT)
diff --git a/src/dns.c b/src/dns.c
index 95797f543ea67138e23c967645905354991e408e..08a036924b77d07bf1b4e3a0ec818ca1291e26c8 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
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_get_interval () / 2),
pcap_error);
if (pcap_obj == NULL)
{
diff --git a/src/exec.c b/src/exec.c
index 4f6f9dfb9871000a0e4e7084fb451204f9857c8a..6dfdfe6a16b5ff357e689564cabcf3b9e3213053 100644 (file)
--- a/src/exec.c
+++ b/src/exec.c
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_get_interval ()));
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_get_interval ()));
putenv (buffer);
ssnprintf (buffer, sizeof (buffer), "COLLECTD_HOSTNAME=%s", hostname_g);
diff --git a/src/ipmi.c b/src/ipmi.c
index f341320ddec54ed9135f6cec34759f30eb74ecd7..7eafea866240c9f790d9e5139a7eef6c096da1eb 100644 (file)
--- a/src/ipmi.c
+++ b/src/ipmi.c
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_get_interval ());
c_ipmi_init_in_progress = 1 + (60 / iv);
c_ipmi_active = 1;
diff --git a/src/libvirt.c b/src/libvirt.c
index 774067cdf016a09e1c9279f9ec2e86d987a3fd0b..e076891c5a32833c982539025c26365ba96503bd 100644 (file)
--- a/src/libvirt.c
+++ b/src/libvirt.c
const char *name;
char uuid[VIR_UUID_STRING_BUFLEN];
- vl->interval = interval_g;
-
sstrncpy (vl->plugin, "libvirt", sizeof (vl->plugin));
vl->host[0] = '\0';
diff --git a/src/memcached.c b/src/memcached.c
index ee3dbe12d67c4998b3ac65ede2f808016370023f..eda1b03bd6da941ffce7a388e8d8de4ede8e511c 100644 (file)
--- a/src/memcached.c
+++ b/src/memcached.c
p.revents = 0;
status = poll (&p, /* nfds = */ 1,
- /* timeout = */ CDTIME_T_TO_MS (interval_g));
+ /* timeout = */ CDTIME_T_TO_MS (plugin_get_interval ()));
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_get_interval ()));
}
else
{
diff --git a/src/modbus.c b/src/modbus.c
index 19848b0b330c056b71a82b92888631c0f1b59830..8a9fe93fd83eaf3b6a32221ea9c92598c225802a 100644 (file)
--- a/src/modbus.c
+++ b/src/modbus.c
return (EINVAL);
if (host->interval <= 0)
- host->interval = interval_g;
+ host->interval = plugin_get_interval ();
if (slave->instance[0] == 0)
ssnprintf (slave->instance, sizeof (slave->instance), "slave_%i",
diff --git a/src/network.c b/src/network.c
index 840577f5b49509f1d197c734666b91341d7b7eb8..59c2be7c034c773778cfa546e00c42c240285374 100644 (file)
--- a/src/network.c
+++ b/src/network.c
vl.values = values;
vl.values_len = 2;
vl.time = 0;
- vl.interval = interval_g;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "network", sizeof (vl.plugin));
diff --git a/src/plugin.c b/src/plugin.c
index 002955d5164f96fb66096d0d1224350fd83c4399..9c2af5d7b8c6b3617512df94ee5dc27c1fbd380b 100644 (file)
--- a/src/plugin.c
+++ b/src/plugin.c
{
now = cdtime ();
- CDTIME_T_TO_TIMESPEC (interval_g, &rf->rf_interval);
+ CDTIME_T_TO_TIMESPEC (plugin_get_interval (), &rf->rf_interval);
rf->rf_effective_interval = rf->rf_interval;
int status;
if (ctx.interval != 0) {
- /* If ctx.interval is not zero (== use interval_g), we need to
- * use the "complex" read callback, because only that allows to
- * specify a different interval. Wrap the callback using
- * read_cb_wrapper(). */
+ /* If ctx.interval is not zero (== use the plugin or global
+ * interval), we need to use the "complex" read callback,
+ * because only that allows to specify a different interval.
+ * Wrap the callback using read_cb_wrapper(). */
struct timespec interval;
user_data_t user_data;
diff --git a/src/plugin.h b/src/plugin.h
index e147a938c433222a04fd919b60faa62703f95f9b..3f2d98cb057957bc30224a057598244a22cfccac 100644 (file)
--- a/src/plugin.h
+++ b/src/plugin.h
};
typedef struct value_list_s value_list_t;
-#define VALUE_LIST_INIT { NULL, 0, 0, \
- (plugin_interval > 0) ? plugin_interval : interval_g, \
+#define VALUE_LIST_INIT { NULL, 0, 0, plugin_get_interval (), \
"localhost", "", "", "", "", NULL }
#define VALUE_LIST_STATIC { NULL, 0, 0, 0, "localhost", "", "", "", "", NULL }
diff --git a/src/postgresql.c b/src/postgresql.c
index a8812e2158327bf86153689894e8eada7e620022..953bcd83e6a3f2f2feae58768670e42d3dd4b47a 100644 (file)
--- a/src/postgresql.c
+++ b/src/postgresql.c
case C_PSQL_PARAM_INTERVAL:
ssnprintf (interval, sizeof (interval), "%.3f",
(db->interval > 0)
- ? CDTIME_T_TO_DOUBLE (db->interval) : interval_g);
+ ? CDTIME_T_TO_DOUBLE (db->interval)
+ : plugin_get_interval ());
params[i] = interval;
break;
default:
diff --git a/src/powerdns.c b/src/powerdns.c
index a1b23555bec080592a261f91e1d6e02ae769bd6a..a140a126a98380b5277ed352d1adee51c9e2bf49 100644 (file)
--- a/src/powerdns.c
+++ b/src/powerdns.c
break;
}
- cdt_timeout = interval_g * 3 / 4;
+ cdt_timeout = plugin_get_interval () * 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 7a8485113289f16923a14f491537c16b2aa5ac79..35f51b322abfe224fc416d9dd914ac267dbbfdd5 100644 (file)
--- a/src/snmp.c
+++ b/src/snmp.c
host = ud->data;
if (host->interval == 0)
- host->interval = interval_g;
+ host->interval = plugin_get_interval ();
time_start = cdtime ();
diff --git a/src/utils_cmd_putval.c b/src/utils_cmd_putval.c
index dd43337ee01390eb3c703a5d8c473bc93eb7ea90..4cbc2f1d96d5a2237946fa69f9c4fabad709e78c 100644 (file)
--- a/src/utils_cmd_putval.c
+++ b/src/utils_cmd_putval.c
buffer_ident,
(vl->interval > 0)
? CDTIME_T_TO_DOUBLE (vl->interval)
- : CDTIME_T_TO_DOUBLE (interval_g),
+ : CDTIME_T_TO_DOUBLE (plugin_get_interval ()),
buffer_values);
return (0);
diff --git a/src/utils_complain.c b/src/utils_complain.c
index 9074b183307671ae78286abe61de3148f6be1f7c..328a6ab6077113cb562ad0ae57a5abffc05d4d01 100644 (file)
--- a/src/utils_complain.c
+++ b/src/utils_complain.c
c->last = now;
- if (c->interval < interval_g)
- c->interval = interval_g;
+ if (c->interval < plugin_get_interval ())
+ c->interval = plugin_get_interval ();
else
c->interval *= 2;