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;
}
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)
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)
{
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);
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;
const char *name;
char uuid[VIR_UUID_STRING_BUFLEN];
- vl->interval = interval_g;
-
sstrncpy (vl->plugin, "libvirt", sizeof (vl->plugin));
vl->host[0] = '\0';
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
{
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",
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));
{
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;
};
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 }
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:
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);
host = ud->data;
if (host->interval == 0)
- host->interval = interval_g;
+ host->interval = plugin_get_interval ();
time_start = cdtime ();
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);
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;