summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 30d9db0)
raw | patch | inline | side by side (parent: 30d9db0)
author | Sebastian Harl <sh@tokkee.org> | |
Fri, 17 Jun 2011 08:53:24 +0000 (10:53 +0200) | ||
committer | Sebastian Harl <sh@teamix.net> | |
Mon, 19 Sep 2011 07:47:12 +0000 (09:47 +0200) |
This is the basic support for configuring custom intervals on a per-plugin
basis. The following API changes have been introduced:
- Each plugin's 'module_register()' function is now required to accept and
respect an argument passing the custom interval (if configured). This is
done by passing a pointer to a struct 'plugin_loaddata_t' which (currently)
contains a single cdtime_t member storing the custom interval (0 if none
has been configured).
- A new plugin-global variable, 'plugin_interval', has been introduced. It is
defined in 'plugin.h', and, thus, defined and available in all plugins.
- A new macro, 'PLUGIN_INIT_INTERVAL', has been introduced to initialize
'plugin_interval' in 'module_register'. It requires the passed loaddata
object as argument. In order for this mechanism to work, this macro has to
be used in all plugins.
- The macro 'VALUE_LIST_INIT' now requires the default interval as an
argument. In most cases 'plugin_interval' should be used.
- 'plugin_register_read' now requires a third argument specifying the
interval. Usually, 'plugin_interval' should be passed.
- The <LoadPlugin> block now accepts an option 'Interval' to configure the
custom interval.
basis. The following API changes have been introduced:
- Each plugin's 'module_register()' function is now required to accept and
respect an argument passing the custom interval (if configured). This is
done by passing a pointer to a struct 'plugin_loaddata_t' which (currently)
contains a single cdtime_t member storing the custom interval (0 if none
has been configured).
- A new plugin-global variable, 'plugin_interval', has been introduced. It is
defined in 'plugin.h', and, thus, defined and available in all plugins.
- A new macro, 'PLUGIN_INIT_INTERVAL', has been introduced to initialize
'plugin_interval' in 'module_register'. It requires the passed loaddata
object as argument. In order for this mechanism to work, this macro has to
be used in all plugins.
- The macro 'VALUE_LIST_INIT' now requires the default interval as an
argument. In most cases 'plugin_interval' should be used.
- 'plugin_register_read' now requires a third argument specifying the
interval. Usually, 'plugin_interval' should be passed.
- The <LoadPlugin> block now accepts an option 'Interval' to configure the
custom interval.
117 files changed:
diff --git a/src/amqp.c b/src/amqp.c
index adf4792b534b85f3219b6d5423bcc3c7c18a140a..1da9e5b2994b3a301cdc4a53b99b42ea21b42941 100644 (file)
--- a/src/amqp.c
+++ b/src/amqp.c
if (strcasecmp ("text/collectd", content_type) == 0)
{
- status = handle_putval (stderr, body);
+ status = handle_putval (stderr, body, /* default_interval = */ interval_g);
if (status != 0)
ERROR ("amqp plugin: handle_putval failed with status %i.",
status);
return (0);
} /* }}} int camqp_config */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_complex_config ("amqp", camqp_config);
plugin_register_shutdown ("amqp", camqp_shutdown);
} /* void module_register */
diff --git a/src/apache.c b/src/apache.c
index c31dd8752cd37c6570fa16503d6dc4a0bfe2ac20..db73ea35aa84775bd4e12fc9af8aa1e808ae7e69 100644 (file)
--- a/src/apache.c
+++ b/src/apache.c
{
user_data_t ud;
char callback_name[3*DATA_MAX_NAME_LEN];
+ struct timespec callback_interval;
memset (&ud, 0, sizeof (ud));
ud.data = st;
ud.free_func = (void *) apache_free;
+ CDTIME_T_TO_TIMESPEC (plugin_interval, &callback_interval);
+
memset (callback_name, 0, sizeof (callback_name));
ssnprintf (callback_name, sizeof (callback_name),
"apache/%s/%s",
status = plugin_register_complex_read (/* group = */ NULL,
/* name = */ callback_name,
/* callback = */ apache_read_host,
- /* interval = */ NULL,
+ /* interval = */ (plugin_interval != 0)
+ ? &callback_interval : NULL,
/* user_data = */ &ud);
}
static void submit_value (const char *type, const char *type_instance,
value_t value, apache_t *st)
{
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
vl.values = &value;
vl.values_len = 1;
return (0);
} /* }}} int apache_read_host */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_complex_config ("apache", config);
} /* void module_register */
diff --git a/src/apcups.c b/src/apcups.c
index a0629d5f6ae0a87e13b08f1e53f6d69b0c1a85f3..0c2331b7d73c7af696dbeee85fc35cc3a5eefe78 100644 (file)
--- a/src/apcups.c
+++ b/src/apcups.c
static void apc_submit_generic (char *type, char *type_inst, double value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value;
return (0);
} /* apcups_read */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_config ("apcups", apcups_config, config_keys,
config_keys_num);
- plugin_register_read ("apcups", apcups_read);
+ plugin_register_read ("apcups", apcups_read, plugin_interval);
plugin_register_shutdown ("apcups", apcups_shutdown);
} /* void module_register */
diff --git a/src/apple_sensors.c b/src/apple_sensors.c
index bdba0ff85287745c960c1e5399d813aad2c116e2..7f4443b9db10925547e4c3ee42ce7abe9726161a 100644 (file)
--- a/src/apple_sensors.c
+++ b/src/apple_sensors.c
double val)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
DEBUG ("type = %s; type_instance = %s; val = %f;",
type, type_instance, val);
return (0);
} /* int as_read */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_init ("apple_sensors", as_init);
- plugin_register_read ("apple_sensors", as_read);
+ plugin_register_read ("apple_sensors", as_read, plugin_interval);
} /* void module_register */
diff --git a/src/ascent.c b/src/ascent.c
index 993e480cb1746b0464741967eb6340921365ca7b..bf6c7ca8588dd6c441894bdc4600bf5c98adeff0 100644 (file)
--- a/src/ascent.c
+++ b/src/ascent.c
const char *type, const char *type_instance, gauge_t value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value;
return (0);
} /* }}} int ascent_read */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_config ("ascent", ascent_config, config_keys, config_keys_num);
plugin_register_init ("ascent", ascent_init);
- plugin_register_read ("ascent", ascent_read);
+ plugin_register_read ("ascent", ascent_read, plugin_interval);
} /* void module_register */
/* vim: set sw=2 sts=2 ts=8 et fdm=marker : */
diff --git a/src/battery.c b/src/battery.c
index 4178d8b5145f2b728e5c7c949d72ebd8d126a89e..f36172dbcda8b1251b1ab3f36b8932a24a985ef5 100644 (file)
--- a/src/battery.c
+++ b/src/battery.c
static void battery_submit (const char *plugin_instance, const char *type, double value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value;
return (0);
}
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_init ("battery", battery_init);
- plugin_register_read ("battery", battery_read);
+ plugin_register_read ("battery", battery_read, plugin_interval);
} /* void module_register */
diff --git a/src/bind.c b/src/bind.c
index b640a59669a363fe7a0b4e73ccdcb419877a8b47..363668b2b3a8c6813ae6f5ebfa285d2eb1a1a799 100644 (file)
--- a/src/bind.c
+++ b/src/bind.c
const char *type, const char *type_instance, value_t value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0] = value;
return (0);
} /* }}} int bind_shutdown */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_complex_config ("bind", bind_config);
plugin_register_init ("bind", bind_init);
- plugin_register_read ("bind", bind_read);
+ plugin_register_read ("bind", bind_read, plugin_interval);
plugin_register_shutdown ("bind", bind_shutdown);
} /* void module_register */
diff --git a/src/configfile.c b/src/configfile.c
index 7c8347b15b20a1aa8d73011a1255105f5937035e..d89bc27541d35aace9fd2adc35807429c0a7bccf 100644 (file)
--- a/src/configfile.c
+++ b/src/configfile.c
int i;
const char *name;
unsigned int flags = 0;
+ plugin_loaddata_t loaddata;
assert (strcasecmp (ci->key, "LoadPlugin") == 0);
if (ci->values_num != 1)
return (-1);
name = ci->values[0].value.string;
+ memset (&loaddata, 0, sizeof (loaddata));
/*
* XXX: Magic at work:
for (i = 0; i < ci->children_num; ++i) {
if (strcasecmp("Globals", ci->children[i].key) == 0)
cf_util_get_flag (ci->children + i, &flags, PLUGIN_FLAGS_GLOBAL);
+ else if (strcasecmp ("Interval", ci->children[i].key) == 0) {
+ double interval = 0.0;
+
+ if (cf_util_get_double (ci->children + i, &interval) != 0) {
+ /* cf_util_get_double will log an error */
+ continue;
+ }
+
+ loaddata.interval = DOUBLE_TO_CDTIME_T (interval);
+ }
else {
WARNING("Ignoring unknown LoadPlugin option \"%s\" "
"for plugin \"%s\"",
}
}
- return (plugin_load (name, (uint32_t) flags));
+ return (plugin_load (name, (uint32_t) flags, &loaddata));
} /* int dispatch_value_loadplugin */
static int dispatch_value_plugin (const char *plugin, oconfig_item_t *ci)
return (0);
} /* }}} int cf_util_get_int */
+int cf_util_get_double (const oconfig_item_t *ci, double *ret_value) /* {{{ */
+{
+ if ((ci == NULL) || (ret_value == NULL))
+ return (EINVAL);
+
+ if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_NUMBER))
+ {
+ ERROR ("cf_util_get_double: The %s option requires "
+ "exactly one numeric argument.", ci->key);
+ return (-1);
+ }
+
+ *ret_value = ci->values[0].value.number;
+
+ return (0);
+} /* }}} int cf_util_get_double */
+
int cf_util_get_boolean (const oconfig_item_t *ci, _Bool *ret_bool) /* {{{ */
{
if ((ci == NULL) || (ret_bool == NULL))
diff --git a/src/configfile.h b/src/configfile.h
index e63a0ea047533257bde40be867bc0394060a884f..59ea55428e43e9752a91c3c9e82675fc0d7ba91b 100644 (file)
--- a/src/configfile.h
+++ b/src/configfile.h
/* Assures the config option is a number and returns it as an int. */
int cf_util_get_int (const oconfig_item_t *ci, int *ret_value);
+/* Assures the config option is a number and returns it as a double. */
+int cf_util_get_double (const oconfig_item_t *ci, double *ret_value);
+
/* Assures the config option is a boolean and assignes it to `ret_bool'.
* Otherwise, `ret_bool' is not changed and non-zero is returned. */
int cf_util_get_boolean (const oconfig_item_t *ci, _Bool *ret_bool);
diff --git a/src/conntrack.c b/src/conntrack.c
index e70ff5f1834b5deecc53bfe7f0419176ce564eeb..8e5f7d5621a44329b81b63303eaffbc9dd9039f6 100644 (file)
--- a/src/conntrack.c
+++ b/src/conntrack.c
static void conntrack_submit (double conntrack)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = conntrack;
return (0);
} /* static int conntrack_read */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
- plugin_register_read ("conntrack", conntrack_read);
+ PLUGIN_INIT_INTERVAL (data);
+ plugin_register_read ("conntrack", conntrack_read, plugin_interval);
} /* void module_register */
diff --git a/src/contextswitch.c b/src/contextswitch.c
index c207318f9d62425fbfb18e7e86727bce62b65bcb..1cdce65789329f799096f3c4cec3f1587058edc4 100644 (file)
--- a/src/contextswitch.c
+++ b/src/contextswitch.c
static void cs_submit (derive_t context_switches)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].derive = (derive_t) context_switches;
return status;
}
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
- plugin_register_read ("contextswitch", cs_read);
+ PLUGIN_INIT_INTERVAL (data);
+ plugin_register_read ("contextswitch", cs_read, plugin_interval);
} /* void module_register */
diff --git a/src/cpu.c b/src/cpu.c
index 12071a2ca8bae25cf86f25782a682ad1bf898846..666fbad5546ea3f4edc2f571d0440015a4834868 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
static void submit (int cpu_num, const char *type_instance, derive_t value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].derive = value;
return (0);
}
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_init ("cpu", init);
- plugin_register_read ("cpu", cpu_read);
+ plugin_register_read ("cpu", cpu_read, plugin_interval);
} /* void module_register */
diff --git a/src/cpufreq.c b/src/cpufreq.c
index b92b1d095226c6a9deea13fa6731d5a68b213478..38d84ad7964bf1ddfd68ec773cdbbf73ce1dfe83 100644 (file)
--- a/src/cpufreq.c
+++ b/src/cpufreq.c
static void cpufreq_submit (int cpu_num, double value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value;
return (0);
} /* int cpufreq_read */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_init ("cpufreq", cpufreq_init);
- plugin_register_read ("cpufreq", cpufreq_read);
+ plugin_register_read ("cpufreq", cpufreq_read, plugin_interval);
}
diff --git a/src/cpython.h b/src/cpython.h
index 4b8aa72143167864ff575147c5ef19949997ab50..4eb942de034cf5763e9e6988f426c9012c656402 100644 (file)
--- a/src/cpython.h
+++ b/src/cpython.h
void cpy_log_exception(const char *context);
+cdtime_t cpy_get_plugin_interval(void);
+
/* Python object declarations. */
typedef struct {
diff --git a/src/csv.c b/src/csv.c
index 02d62c1e014e89f98becd7993ea14a646287b31b..10b13ef8fcef170c9213873f6999ad364dc73231 100644 (file)
--- a/src/csv.c
+++ b/src/csv.c
return (0);
} /* int csv_write */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_config ("csv", csv_config,
config_keys, config_keys_num);
plugin_register_write ("csv", csv_write, /* user_data = */ NULL);
diff --git a/src/curl.c b/src/curl.c
index 2160b980de5a18c3ca9a0f98a8ddf37469f18bf2..16de82216e810927e12d4aa71a8b2bda0d93099b 100644 (file)
--- a/src/curl.c
+++ b/src/curl.c
const cu_match_value_t *mv)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0] = mv->value;
static void cc_submit_response_time (const web_page_t *wp, double seconds) /* {{{ */
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = seconds;
return (0);
} /* }}} int cc_shutdown */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_complex_config ("curl", cc_config);
plugin_register_init ("curl", cc_init);
- plugin_register_read ("curl", cc_read);
+ plugin_register_read ("curl", cc_read, plugin_interval);
plugin_register_shutdown ("curl", cc_shutdown);
} /* void module_register */
diff --git a/src/curl_json.c b/src/curl_json.c
index 857e276bb585e16a9f872d4863f43e86c20d1e2d..3f77b7e1f04c39609b6b1874df104dfdd506b4f4 100644 (file)
--- a/src/curl_json.c
+++ b/src/curl_json.c
{
user_data_t ud;
char cb_name[DATA_MAX_NAME_LEN];
+ struct timespec cb_interval;
if (db->instance == NULL)
db->instance = strdup("default");
ssnprintf (cb_name, sizeof (cb_name), "curl_json-%s-%s",
db->instance, db->url);
- plugin_register_complex_read (/* group = */ NULL, cb_name, cj_read,
- /* interval = */ NULL, &ud);
+ CDTIME_T_TO_TIMESPEC (plugin_interval, &cb_interval);
+
+ plugin_register_complex_read (/* group = */ NULL,
+ /* name = */ cb_name,
+ /* callback = */ cj_read,
+ /* interval = */ (plugin_interval != 0)
+ ? &cb_interval : NULL,
+ /* user_data = */ &ud);
}
else
{
static void cj_submit (cj_t *db, cj_key_t *key, value_t *value) /* {{{ */
{
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
char *host;
vl.values = value;
return cj_curl_perform (db, db->curl);
} /* }}} int cj_read */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_complex_config ("curl_json", cj_config);
} /* void module_register */
diff --git a/src/curl_xml.c b/src/curl_xml.c
index 61b5adedf423a4a770da06d066b1e372b767dfcb..56cf6f727414506e184fb9a105560d34987eb4da 100644 (file)
--- a/src/curl_xml.c
+++ b/src/curl_xml.c
xmlXPathObjectPtr base_node_obj = NULL;
xmlNodeSetPtr base_nodes = NULL;
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
base_node_obj = cx_evaluate_xpath (xpath_ctx, BAD_CAST base_xpath);
if (base_node_obj == NULL)
{
user_data_t ud;
char cb_name[DATA_MAX_NAME_LEN];
+ struct timespec cb_interval;
if (db->instance == NULL)
db->instance = strdup("default");
ssnprintf (cb_name, sizeof (cb_name), "curl_xml-%s-%s",
db->instance, db->url);
+ CDTIME_T_TO_TIMESPEC (plugin_interval, &cb_interval);
- plugin_register_complex_read (/* group = */ NULL, cb_name, cx_read,
- /* interval = */ NULL, &ud);
+ plugin_register_complex_read (/* group = */ NULL,
+ /* name = */ cb_name,
+ /* callback = */ cx_read,
+ /* interval = */ (plugin_interval != 0)
+ ? &cb_interval : NULL,
+ /* user_data = */ &ud);
}
else
{
return (0);
} /* }}} int cx_config */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_complex_config ("curl_xml", cx_config);
} /* void module_register */
diff --git a/src/dbi.c b/src/dbi.c
index caa41ef64023d247bd14721f936b0323df0ccfae..b55d39c0d1660db03641219b39d3410fa18ff43d 100644 (file)
--- a/src/dbi.c
+++ b/src/dbi.c
udb_query_prepare_result (q, prep_area, hostname_g,
/* plugin = */ "dbi", db->name,
- column_names, column_num, /* interval = */ 0);
+ column_names, column_num, /* interval = */ plugin_interval);
/* 0 = error; 1 = success; */
status = dbi_result_first_row (res); /* {{{ */
return (0);
} /* }}} int cdbi_shutdown */
-void module_register (void) /* {{{ */
+void module_register (plugin_loaddata_t *data) /* {{{ */
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_complex_config ("dbi", cdbi_config);
plugin_register_init ("dbi", cdbi_init);
- plugin_register_read ("dbi", cdbi_read);
+ plugin_register_read ("dbi", cdbi_read, plugin_interval);
plugin_register_shutdown ("dbi", cdbi_shutdown);
} /* }}} void module_register */
diff --git a/src/df.c b/src/df.c
index 5391f50c852f8dea77e620683c1a2d5e51fd3eac..c5ae868fa6aebf2be3b16a22c77776f8487560bc 100644 (file)
--- a/src/df.c
+++ b/src/df.c
gauge_t value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value;
return (0);
} /* int df_read */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_config ("df", df_config,
config_keys, config_keys_num);
plugin_register_init ("df", df_init);
- plugin_register_read ("df", df_read);
+ plugin_register_read ("df", df_read, plugin_interval);
} /* void module_register */
diff --git a/src/disk.c b/src/disk.c
index fde0dcde9abd5112c48633a6dcd588ef8bb0f69b..81ac30317b67da0d6e76ee9d959876d6b9d7a561 100644 (file)
--- a/src/disk.c
+++ b/src/disk.c
derive_t read, derive_t write)
{
value_t values[2];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
/* Both `ignorelist' and `plugin_instance' may be NULL. */
if (ignorelist_match (ignorelist, plugin_instance) != 0)
return (0);
} /* int disk_read */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_config ("disk", disk_config,
config_keys, config_keys_num);
plugin_register_init ("disk", disk_init);
- plugin_register_read ("disk", disk_read);
+ plugin_register_read ("disk", disk_read, plugin_interval);
} /* void module_register */
diff --git a/src/dns.c b/src/dns.c
index 95797f543ea67138e23c967645905354991e408e..9e868911bb7b03b6f55f46d0f89b3151ef933f5f 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
derive_t value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].derive = value;
static void submit_octets (derive_t queries, derive_t responses)
{
value_t values[2];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].derive = queries;
values[1].derive = responses;
return (0);
} /* int dns_read */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_config ("dns", dns_config, config_keys, config_keys_num);
plugin_register_init ("dns", dns_init);
- plugin_register_read ("dns", dns_read);
+ plugin_register_read ("dns", dns_read, plugin_interval);
} /* void module_register */
diff --git a/src/email.c b/src/email.c
index 8fc5509f3e7e5ece33a15015b0ffa40fde6d6ede..a7214fa562c4f779a1b5ae30741ec3085809ac1f 100644 (file)
--- a/src/email.c
+++ b/src/email.c
static void email_submit (const char *type, const char *type_instance, gauge_t value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value;
return (0);
} /* int email_read */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_config ("email", email_config, config_keys, config_keys_num);
plugin_register_init ("email", email_init);
- plugin_register_read ("email", email_read);
+ plugin_register_read ("email", email_read, plugin_interval);
plugin_register_shutdown ("email", email_shutdown);
} /* void module_register */
diff --git a/src/entropy.c b/src/entropy.c
index d56be6dc1df8f4645eb7c4f04a820ee978d87a8b..1a2c93757abd39e603a7cc8e5bf673dec543f9d5 100644 (file)
--- a/src/entropy.c
+++ b/src/entropy.c
static void entropy_submit (double entropy)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = entropy;
return (0);
}
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
- plugin_register_read ("entropy", entropy_read);
+ PLUGIN_INIT_INTERVAL (data);
+ plugin_register_read ("entropy", entropy_read, plugin_interval);
} /* void module_register */
diff --git a/src/exec.c b/src/exec.c
index 4f6f9dfb9871000a0e4e7084fb451204f9857c8a..1da2bdd0224ca4fa30d2394f573d0fd5f23f71fd 100644 (file)
--- a/src/exec.c
+++ b/src/exec.c
@@ -533,7 +533,7 @@ static int fork_child (program_list_t *pl, int *fd_in, int *fd_out, int *fd_err)
static int parse_line (char *buffer) /* {{{ */
{
if (strncasecmp ("PUTVAL", buffer, strlen ("PUTVAL")) == 0)
- return (handle_putval (stdout, buffer));
+ return (handle_putval (stdout, buffer, /* default_interval = */ plugin_interval));
else if (strncasecmp ("PUTNOTIF", buffer, strlen ("PUTNOTIF")) == 0)
return (handle_putnotif (stdout, buffer));
else
return (0);
} /* int exec_shutdown }}} */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_complex_config ("exec", exec_config);
plugin_register_init ("exec", exec_init);
- plugin_register_read ("exec", exec_read);
+ plugin_register_read ("exec", exec_read, plugin_interval);
plugin_register_notification ("exec", exec_notification,
/* user_data = */ NULL);
plugin_register_shutdown ("exec", exec_shutdown);
diff --git a/src/filecount.c b/src/filecount.c
index 47f99e91c8e3df2a502208ba6f99f6596afe10e1..c2f34ec311bdcda860300f0ea2a51d625710650c 100644 (file)
--- a/src/filecount.c
+++ b/src/filecount.c
static void fc_submit_dir (const fc_directory_conf_t *dir)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = (gauge_t) dir->files_num;
return (0);
} /* int fc_read */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_complex_config ("filecount", fc_config);
plugin_register_init ("filecount", fc_init);
- plugin_register_read ("filecount", fc_read);
+ plugin_register_read ("filecount", fc_read, plugin_interval);
} /* void module_register */
/*
diff --git a/src/fscache.c b/src/fscache.c
index 8fbd271394e90554fcf92f1c850f6b4733242537..c4597481d1f9df6fd31021c2a9e456a4bce93244 100644 (file)
--- a/src/fscache.c
+++ b/src/fscache.c
static void fscache_submit (const char *section, const char *name,
value_t value)
{
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
vl.values = &value;
vl.values_len = 1;
return (0);
}
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
- plugin_register_read ("fscache", fscache_read);
+ PLUGIN_INIT_INTERVAL (data);
+ plugin_register_read ("fscache", fscache_read, plugin_interval);
} /* void module_register */
/* vim: set sw=4 sts=4 et : */
diff --git a/src/gmond.c b/src/gmond.c
index 3c746c48887c3e678d42e2417b3d11bd38a7b1ec..4388f989a5a28180f3ff1475ce31910dfec1e979 100644 (file)
--- a/src/gmond.c
+++ b/src/gmond.c
return (0);
} /* }}} int gmond_shutdown */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_complex_config ("gmond", gmond_config);
plugin_register_init ("gmond", gmond_init);
plugin_register_shutdown ("gmond", gmond_shutdown);
diff --git a/src/hddtemp.c b/src/hddtemp.c
index 4428b75ddc086db0be4e8cff39f95f6437e09e89..cf6d7cfe80d9a87154131c5aff7cd0694c6a582e 100644 (file)
--- a/src/hddtemp.c
+++ b/src/hddtemp.c
static void hddtemp_submit (char *type_instance, double value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value;
/* module_register
Register collectd plugin. */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_config ("hddtemp", hddtemp_config,
config_keys, config_keys_num);
- plugin_register_read ("hddtemp", hddtemp_read);
+ plugin_register_read ("hddtemp", hddtemp_read, plugin_interval);
}
diff --git a/src/interface.c b/src/interface.c
index c1e28e32c962aff7a3393ae321634affb6a44be1..01dd389604e8b844114565f802b63f3b468a1e10 100644 (file)
--- a/src/interface.c
+++ b/src/interface.c
derive_t tx)
{
value_t values[2];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
if (ignorelist_match (ignorelist, dev) != 0)
return;
return (0);
} /* int interface_read */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_config ("interface", interface_config,
config_keys, config_keys_num);
#if HAVE_LIBKSTAT
plugin_register_init ("interface", interface_init);
#endif
- plugin_register_read ("interface", interface_read);
+ plugin_register_read ("interface", interface_read, plugin_interval);
} /* void module_register */
diff --git a/src/ipmi.c b/src/ipmi.c
index f341320ddec54ed9135f6cec34759f30eb74ecd7..3ec25ea674fa77829d2b88f68773f3b48de58b06 100644 (file)
--- a/src/ipmi.c
+++ b/src/ipmi.c
void *user_data)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
c_ipmi_sensor_list_t *list_item = (c_ipmi_sensor_list_t *)user_data;
return (0);
} /* int c_ipmi_shutdown */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_config ("ipmi", c_ipmi_config,
config_keys, config_keys_num);
plugin_register_init ("ipmi", c_ipmi_init);
- plugin_register_read ("ipmi", c_ipmi_read);
+ plugin_register_read ("ipmi", c_ipmi_read, plugin_interval);
plugin_register_shutdown ("ipmi", c_ipmi_shutdown);
} /* void module_register */
diff --git a/src/iptables.c b/src/iptables.c
index 49454f050d755283b5cec6094a003116983e21fb..e620d38aa90648cf6092847f67e3ee9b3e55bf16 100644 (file)
--- a/src/iptables.c
+++ b/src/iptables.c
{
int status;
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
/* Select the rules to collect */
if (chain->rule_type == RTYPE_NUM)
{
int status;
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
/* Select the rules to collect */
if (chain->rule_type == RTYPE_NUM)
return (0);
} /* int iptables_shutdown */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_config ("iptables", iptables_config,
config_keys, config_keys_num);
- plugin_register_read ("iptables", iptables_read);
+ plugin_register_read ("iptables", iptables_read, plugin_interval);
plugin_register_shutdown ("iptables", iptables_shutdown);
} /* void module_register */
diff --git a/src/ipvs.c b/src/ipvs.c
index ab76f1eb8638d2517dd1e56ddb981148d17ed556..d7d43c0b95a051489ccc5f87bae73b890ec0516a 100644 (file)
--- a/src/ipvs.c
+++ b/src/ipvs.c
static void cipvs_submit_connections (char *pi, char *ti, derive_t value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].derive = value;
derive_t rx, derive_t tx)
{
value_t values[2];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].derive = rx;
values[1].derive = tx;
return 0;
} /* cipvs_shutdown */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_init ("ipvs", cipvs_init);
- plugin_register_read ("ipvs", cipvs_read);
+ plugin_register_read ("ipvs", cipvs_read, plugin_interval);
plugin_register_shutdown ("ipvs", cipvs_shutdown);
return;
} /* module_register */
diff --git a/src/irq.c b/src/irq.c
index 7e738291c58af7c851907f477e7386fc5e3fd561..ae93cd2978abae2e19d3e54e6d3ca24680ea28c9 100644 (file)
--- a/src/irq.c
+++ b/src/irq.c
static void irq_submit (const char *irq_name, derive_t value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
if (check_ignore_irq (irq_name))
return;
return (0);
} /* int irq_read */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_config ("irq", irq_config,
config_keys, config_keys_num);
- plugin_register_read ("irq", irq_read);
+ plugin_register_read ("irq", irq_read, plugin_interval);
} /* void module_register */
diff --git a/src/java.c b/src/java.c
index b69ca946b301c36a367c114e98666c7b33e69acd..5d5893c2f645dfd0694787f8771d17e0096f7e00 100644 (file)
--- a/src/java.c
+++ b/src/java.c
static jint JNICALL cjni_api_dispatch_values (JNIEnv *jvm_env, /* {{{ */
jobject this, jobject java_vl)
{
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
int status;
DEBUG ("cjni_api_dispatch_values: java_vl = %p;", (void *) java_vl);
user_data_t ud;
cjni_callback_info_t *cbi;
+ struct timespec cb_interval;
+
cbi = cjni_callback_info_create (jvm_env, o_name, o_read, CB_TYPE_READ);
if (cbi == NULL)
return (-1);
ud.data = (void *) cbi;
ud.free_func = cjni_callback_info_destroy;
- plugin_register_complex_read (/* group = */ NULL, cbi->name, cjni_read,
- /* interval = */ NULL, &ud);
+ CDTIME_T_TO_TIMESPEC (plugin_interval, &cb_interval);
+
+ plugin_register_complex_read (/* group = */ NULL,
+ /* name = */ cbi->name,
+ /* callback = */ cjni_read,
+ /* interval = */ (plugin_interval != 0) ? &cb_interval : NULL,
+ /* user_data = */ &ud);
(*jvm_env)->DeleteLocalRef (jvm_env, o_read);
return (0);
} /* }}} int cjni_init */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_complex_config ("java", cjni_config_callback);
plugin_register_init ("java", cjni_init);
plugin_register_shutdown ("java", cjni_shutdown);
-} /* void module_register (void) */
+} /* void module_register (plugin_loaddata_t *data) */
/* vim: set sw=2 sts=2 et fdm=marker : */
diff --git a/src/libvirt.c b/src/libvirt.c
index 774067cdf016a09e1c9279f9ec2e86d987a3fd0b..95b46143f1fe61db4c287a6b308af53f2e90bec0 100644 (file)
--- a/src/libvirt.c
+++ b/src/libvirt.c
virDomainPtr dom, const char *type)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
init_value_list (&vl, dom);
virDomainPtr dom, int vcpu_nr, const char *type)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
init_value_list (&vl, dom);
virDomainPtr dom, const char *devname)
{
value_t values[2];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
init_value_list (&vl, dom);
}
void
-module_register (void)
+module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_config ("libvirt",
lv_config,
config_keys, NR_CONFIG_KEYS);
plugin_register_init ("libvirt", lv_init);
- plugin_register_read ("libvirt", lv_read);
+ plugin_register_read ("libvirt", lv_read, plugin_interval);
plugin_register_shutdown ("libvirt", lv_shutdown);
}
diff --git a/src/load.c b/src/load.c
index 0188da7ef38407972f5570f47fabcf622db41b4b..e6a618d4a8e393c200b025dd2250441c11f576fe 100644 (file)
--- a/src/load.c
+++ b/src/load.c
static void load_submit (gauge_t snum, gauge_t mnum, gauge_t lnum)
{
value_t values[3];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = snum;
values[1].gauge = mnum;
return (0);
}
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
- plugin_register_read ("load", load_read);
+ PLUGIN_INIT_INTERVAL (data);
+ plugin_register_read ("load", load_read, plugin_interval);
} /* void module_register */
diff --git a/src/logfile.c b/src/logfile.c
index 60fb5d9202ecfc5e5d9ddc2252820732e5586433..40a5d7afd1bda74b929fb9c7c6583537ab3d8f37 100644 (file)
--- a/src/logfile.c
+++ b/src/logfile.c
return (0);
} /* int logfile_notification */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_config ("logfile", logfile_config,
config_keys, config_keys_num);
plugin_register_log ("logfile", logfile_log, /* user_data = */ NULL);
plugin_register_notification ("logfile", logfile_notification,
/* user_data = */ NULL);
-} /* void module_register (void) */
+} /* void module_register (plugin_loaddata_t *data) */
/* vim: set sw=4 ts=4 tw=78 noexpandtab : */
diff --git a/src/lpar.c b/src/lpar.c
index 4d534476f62c76754433b2c73d313967595e5843..ff31d27415dd7a46106b9e479f05d43bdf924f3b 100644 (file)
--- a/src/lpar.c
+++ b/src/lpar.c
static void lpar_submit (const char *type_instance, double value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = (gauge_t)value;
return (0);
} /* int lpar_read */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_config ("lpar", lpar_config,
config_keys, config_keys_num);
plugin_register_init ("lpar", lpar_init);
- plugin_register_read ("lpar", lpar_read);
+ plugin_register_read ("lpar", lpar_read, plugin_interval);
} /* void module_register */
/* vim: set sw=8 noet : */
diff --git a/src/madwifi.c b/src/madwifi.c
index 13301fffe15aea8afbce76c3ce06105ededfa195..7af8b2226d0cfd9a4f5cd39d9739a611647f2612 100644 (file)
--- a/src/madwifi.c
+++ b/src/madwifi.c
static void submit (const char *dev, const char *type, const char *ti1,
const char *ti2, value_t *val, int len)
{
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
vl.values = val;
vl.values_len = len;
return rv;
}
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_config ("madwifi", madwifi_config,
config_keys, config_keys_num);
- plugin_register_read ("madwifi", madwifi_read);
+ plugin_register_read ("madwifi", madwifi_read, plugin_interval);
}
index 1ab445a7af0d793a825da5e72fd1465dbc59ebad..a06af564834daa5268c1f243dfaab318af8cb4d0 100644 (file)
return (FC_MATCH_NO_MATCH);
} /* }}} int mec_match */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
match_proc_t mproc;
+ PLUGIN_INIT_INTERVAL (data);
+
memset (&mproc, 0, sizeof (mproc));
mproc.create = mec_create;
mproc.destroy = mec_destroy;
diff --git a/src/match_hashed.c b/src/match_hashed.c
index ee3101a23190c3f2848994ca90ab6900c6eb03a5..6cb2c5a161057123838b2bfb1189ca55e1f208e1 100644 (file)
--- a/src/match_hashed.c
+++ b/src/match_hashed.c
return (FC_MATCH_NO_MATCH);
} /* }}} int mh_match */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
match_proc_t mproc;
+ PLUGIN_INIT_INTERVAL (data);
+
memset (&mproc, 0, sizeof (mproc));
mproc.create = mh_create;
mproc.destroy = mh_destroy;
diff --git a/src/match_regex.c b/src/match_regex.c
index 1defc18026241e6580e777b6ec8324c84c1411b7..44de1db3fe65add4112978f5b6d3545d1fb0a921 100644 (file)
--- a/src/match_regex.c
+++ b/src/match_regex.c
return (match_value);
} /* }}} int mr_match */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
match_proc_t mproc;
+ PLUGIN_INIT_INTERVAL (data);
+
memset (&mproc, 0, sizeof (mproc));
mproc.create = mr_create;
mproc.destroy = mr_destroy;
diff --git a/src/match_timediff.c b/src/match_timediff.c
index 2e2741550c46e63882fd162d31caf8264cbfce21..8e1980ffde33f49bc3c0e7ed3ada9f2336c2bea4 100644 (file)
--- a/src/match_timediff.c
+++ b/src/match_timediff.c
return (FC_MATCH_NO_MATCH);
} /* }}} int mt_match */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
match_proc_t mproc;
+ PLUGIN_INIT_INTERVAL (data);
+
memset (&mproc, 0, sizeof (mproc));
mproc.create = mt_create;
mproc.destroy = mt_destroy;
diff --git a/src/match_value.c b/src/match_value.c
index ae6282c4afa4a54083a745ba14bcaa01873d3eca..aea01ebbc460b393c92b570bcd42680e5474e4fb 100644 (file)
--- a/src/match_value.c
+++ b/src/match_value.c
return (status);
} /* }}} int mv_match */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
match_proc_t mproc;
+ PLUGIN_INIT_INTERVAL (data);
+
memset (&mproc, 0, sizeof (mproc));
mproc.create = mv_create;
mproc.destroy = mv_destroy;
diff --git a/src/mbmon.c b/src/mbmon.c
index 90226bbf6e7403eda02919b8b9e02fb008215ba2..160ae5cbf83905352ae5074aed07211ed1792f34 100644 (file)
--- a/src/mbmon.c
+++ b/src/mbmon.c
double value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value;
/* module_register
Register collectd plugin. */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_config ("mbmon", mbmon_config, config_keys, config_keys_num);
- plugin_register_read ("mbmon", mbmon_read);
+ plugin_register_read ("mbmon", mbmon_read, plugin_interval);
} /* void module_register */
diff --git a/src/memcachec.c b/src/memcachec.c
index 8f51e22f01dd3c2d728d0cbc0a8e2cc61fba99e1..e280e316477fc19a258816a3b3517202abd17dce 100644 (file)
--- a/src/memcachec.c
+++ b/src/memcachec.c
const cu_match_value_t *mv)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0] = mv->value;
return (0);
} /* }}} int cmc_shutdown */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_complex_config ("memcachec", cmc_config);
plugin_register_init ("memcachec", cmc_init);
- plugin_register_read ("memcachec", cmc_read);
+ plugin_register_read ("memcachec", cmc_read, plugin_interval);
plugin_register_shutdown ("memcachec", cmc_shutdown);
} /* void module_register */
diff --git a/src/memcached.c b/src/memcached.c
index ee3dbe12d67c4998b3ac65ede2f808016370023f..6ae4843cf7c6d4c41dca58a2d3d4e2450520a560 100644 (file)
--- a/src/memcached.c
+++ b/src/memcached.c
derive_t value) /* {{{ */
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].derive = value;
derive_t value0, derive_t value1) /* {{{ */
{
value_t values[2];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].derive = value0;
values[1].derive = value1;
gauge_t value) /* {{{ */
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value;
gauge_t value0, gauge_t value1) /* {{{ */
{
value_t values[2];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value0;
values[1].gauge = value1;
}
/* }}} */
-void module_register (void) /* {{{ */
+void module_register (plugin_loaddata_t *data) /* {{{ */
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_config ("memcached", memcached_config, config_keys, config_keys_num);
- plugin_register_read ("memcached", memcached_read);
+ plugin_register_read ("memcached", memcached_read, plugin_interval);
}
/* }}} */
diff --git a/src/memory.c b/src/memory.c
index b79a74b7cb42a307916eef911dbba3a968ac456a..faf7092c8a329b7211473804509128ee5e6f8669 100644 (file)
--- a/src/memory.c
+++ b/src/memory.c
static void memory_submit (const char *type_instance, gauge_t value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value;
return (0);
}
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_init ("memory", memory_init);
- plugin_register_read ("memory", memory_read);
+ plugin_register_read ("memory", memory_read, plugin_interval);
} /* void module_register */
diff --git a/src/modbus.c b/src/modbus.c
index 19848b0b330c056b71a82b92888631c0f1b59830..5b3bc1cb199fa33baa87513a5322055dbaf1d10c 100644 (file)
--- a/src/modbus.c
+++ b/src/modbus.c
static int mb_submit (mb_host_t *host, mb_slave_t *slave, /* {{{ */
mb_data_t *data, value_t value)
{
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
if ((host == NULL) || (slave == NULL) || (data == NULL))
return (EINVAL);
ssnprintf (name, sizeof (name), "modbus-%s", host->host);
+ if (host->interval <= 0)
+ host->interval = plugin_interval;
CDTIME_T_TO_TIMESPEC (host->interval, &interval);
plugin_register_complex_read (/* group = */ NULL, name,
return (0);
} /* }}} int mb_shutdown */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_complex_config ("modbus", mb_config);
plugin_register_shutdown ("modbus", mb_shutdown);
} /* void module_register */
diff --git a/src/multimeter.c b/src/multimeter.c
index 775eb57e27bff64201f81e83cf6528c36fa0608e..b54acfb3c75d740e2de140454b732d7909cc1079 100644 (file)
--- a/src/multimeter.c
+++ b/src/multimeter.c
static void multimeter_submit (double value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value;
return (0);
}
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_init ("multimeter", multimeter_init);
- plugin_register_read ("multimeter", multimeter_read);
+ plugin_register_read ("multimeter", multimeter_read, plugin_interval);
plugin_register_shutdown ("multimeter", multimeter_shutdown);
} /* void module_register */
diff --git a/src/mysql.c b/src/mysql.c
index 6b636787555b7e177a09abf20b71cd7cbbb7f9a7..104f072ca364edac671ff652d101defc05325769 100644 (file)
--- a/src/mysql.c
+++ b/src/mysql.c
{
user_data_t ud;
char cb_name[DATA_MAX_NAME_LEN];
+ struct timespec cb_interval;
DEBUG ("mysql plugin: Registering new read callback: %s",
(db->database != NULL) ? db->database : "<default>");
else
sstrncpy (cb_name, "mysql", sizeof (cb_name));
- plugin_register_complex_read (/* group = */ NULL, cb_name,
- mysql_read,
- /* interval = */ NULL, &ud);
+ CDTIME_T_TO_TIMESPEC (plugin_interval, &cb_interval);
+
+ plugin_register_complex_read (/* group = */ NULL,
+ /* name = */ cb_name,
+ /* callback = */ mysql_read,
+ /* interval = */ (plugin_interval > 0)
+ ? &cb_interval : NULL,
+ /* user_data = */ &ud);
}
else
{
static void submit (const char *type, const char *type_instance,
value_t *values, size_t values_len, mysql_database_t *db)
{
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
vl.values = values;
vl.values_len = values_len;
return (0);
} /* int mysql_read */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_complex_config ("mysql", mysql_config);
} /* void module_register */
diff --git a/src/netapp.c b/src/netapp.c
index d9bd1ae520597697fc96cb1f1a540d664c571ff2..53dea0cfc71c7fac14b7b4be97f657de17007856 100644 (file)
--- a/src/netapp.c
+++ b/src/netapp.c
value_t *values, int values_len,
cdtime_t timestamp, cdtime_t interval)
{
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
vl.values = values;
vl.values_len = values_len;
ssnprintf (cb_name, sizeof (cb_name), "netapp-%s", host->name);
+ if (host->interval <= 0)
+ host->interval = plugin_interval;
CDTIME_T_TO_TIMESPEC (host->interval, &interval);
memset (&ud, 0, sizeof (ud));
return (0);
} /* }}} int cna_shutdown */
-void module_register(void) {
+void module_register(plugin_loaddata_t *data) {
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_complex_config("netapp", cna_config);
plugin_register_init("netapp", cna_init);
plugin_register_shutdown("netapp", cna_shutdown);
diff --git a/src/netlink.c b/src/netlink.c
index ef851d354937a0069969b7822b5ce6de0879a739..10c8dd1b189fa7664810452b1f3812a5d5082334 100644 (file)
--- a/src/netlink.c
+++ b/src/netlink.c
const char *type_instance, derive_t value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].derive = value;
derive_t rx, derive_t tx)
{
value_t values[2];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].derive = rx;
values[1].derive = tx;
return (0);
} /* int ir_shutdown */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_config ("netlink", ir_config, config_keys, config_keys_num);
plugin_register_init ("netlink", ir_init);
- plugin_register_read ("netlink", ir_read);
+ plugin_register_read ("netlink", ir_read, plugin_interval);
plugin_register_shutdown ("netlink", ir_shutdown);
} /* void module_register */
diff --git a/src/network.c b/src/network.c
index 38534264e2bb5ff18cd1f472aa259e907d4aa8e6..1d6708d5f54d65ca583a4181ed3bc74c8dfb60b9 100644 (file)
--- a/src/network.c
+++ b/src/network.c
{
int status;
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (/* default interval = */ 0);
notification_t n;
#if HAVE_LIBGCRYPT
derive_t copy_values_sent;
derive_t copy_values_not_sent;
derive_t copy_receive_list_length;
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
value_t values[2];
copy_octets_rx = stats_octets_rx;
#endif
if (network_config_stats != 0)
- plugin_register_read ("network", network_stats_read);
+ plugin_register_read ("network", network_stats_read, plugin_interval);
plugin_register_shutdown ("network", network_shutdown);
return (0);
} /* int network_flush */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_complex_config ("network", network_config);
plugin_register_init ("network", network_init);
plugin_register_flush ("network", network_flush,
diff --git a/src/nfs.c b/src/nfs.c
index f3c636ecce9cd14aead260b9cfdd3149750b5c31..a42a885896c6469ef5f54fb08be28d67df8778ef 100644 (file)
--- a/src/nfs.c
+++ b/src/nfs.c
unsigned long long *val, const char **names, int len)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
int i;
vl.values = values;
return (0);
}
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
- plugin_register_read ("nfs", nfs_read);
+ PLUGIN_INIT_INTERVAL (data);
+ plugin_register_read ("nfs", nfs_read, plugin_interval);
} /* void module_register */
diff --git a/src/nginx.c b/src/nginx.c
index 3e162bacf0bf52be3ecfb6dc8d48e223df4e0a3e..15370db7952491652d95d5aab6a2bc88277bba56 100644 (file)
--- a/src/nginx.c
+++ b/src/nginx.c
static void submit (char *type, char *inst, long long value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
if (strcmp (type, "nginx_connections") == 0)
values[0].gauge = value;
return (0);
} /* int nginx_read */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_config ("nginx", config, config_keys, config_keys_num);
plugin_register_init ("nginx", init);
- plugin_register_read ("nginx", nginx_read);
+ plugin_register_read ("nginx", nginx_read, plugin_interval);
} /* void module_register */
/*
diff --git a/src/notify_desktop.c b/src/notify_desktop.c
index 3f3c6dfc9bf62c3ac0dc356295f0e68faf5879a8..aa2c216ef56428ff03acdb68b5f6b641a7d17518 100644 (file)
--- a/src/notify_desktop.c
+++ b/src/notify_desktop.c
return 0;
} /* c_notify_init */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_complex_config ("notify_desktop", c_notify_config);
plugin_register_init ("notify_desktop", c_notify_init);
return;
diff --git a/src/notify_email.c b/src/notify_email.c
index cd216ca2da753a2e1a2895486f706c62c280e42d..1c3890d1aa32d6bd43559d835afa5d380330df0c 100644 (file)
--- a/src/notify_email.c
+++ b/src/notify_email.c
return (0);
} /* int notify_email_notification */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_init ("notify_email", notify_email_init);
plugin_register_shutdown ("notify_email", notify_email_shutdown);
plugin_register_config ("notify_email", notify_email_config,
config_keys, config_keys_num);
plugin_register_notification ("notify_email", notify_email_notification,
/* user_data = */ NULL);
-} /* void module_register (void) */
+} /* void module_register (plugin_loaddata_t *data) */
/* vim: set sw=2 sts=2 ts=8 et : */
diff --git a/src/ntpd.c b/src/ntpd.c
index 8bbf74d7d965b94ac0d21939fc3a4776116a7539..ce074039635da89265ba7d9102fc9cc340868bfb 100644 (file)
--- a/src/ntpd.c
+++ b/src/ntpd.c
static void ntpd_submit (char *type, char *type_inst, double value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value;
return (0);
} /* int ntpd_read */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_config ("ntpd", ntpd_config,
config_keys, config_keys_num);
- plugin_register_read ("ntpd", ntpd_read);
+ plugin_register_read ("ntpd", ntpd_read, plugin_interval);
} /* void module_register */
diff --git a/src/nut.c b/src/nut.c
index edc48c61510ab6e716abe17b52d222136ee7ceba..8ca07781e048bb28542775ad172c66288ee97fad 100644 (file)
--- a/src/nut.c
+++ b/src/nut.c
const char *type_instance, gauge_t value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value;
return (0);
} /* int nut_shutdown */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_config ("nut", nut_config, config_keys, config_keys_num);
- plugin_register_read ("nut", nut_read);
+ plugin_register_read ("nut", nut_read, plugin_interval);
plugin_register_shutdown ("nut", nut_shutdown);
} /* void module_register */
diff --git a/src/olsrd.c b/src/olsrd.c
index be422ab61068d284ef5f1bbc9455bb7e9a214db4..5cc20f9cd39fbfa13e8e54039134ad62f9928110 100644 (file)
--- a/src/olsrd.c
+++ b/src/olsrd.c
const char *type, const char *type_instance, gauge_t value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value;
return (0);
} /* }}} int olsrd_shutdown */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_config ("olsrd", olsrd_config,
config_keys, config_keys_num);
- plugin_register_read ("olsrd", olsrd_read);
+ plugin_register_read ("olsrd", olsrd_read, plugin_interval);
plugin_register_shutdown ("olsrd", olsrd_shutdown);
} /* void module_register */
diff --git a/src/onewire.c b/src/onewire.c
index 09a6bf0926154369c3fe75e408a3c79c9b194cfe..8d4e600b7fb218e23f5a21776e45148f674407b2 100644 (file)
--- a/src/onewire.c
+++ b/src/onewire.c
const ow_family_features_t *family_info)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
int success = 0;
size_t i;
return (1);
}
+ if (ow_interval <= 0)
+ ow_interval = plugin_interval;
CDTIME_T_TO_TIMESPEC (ow_interval, &cb_interval);
plugin_register_complex_read (/* group = */ NULL, "onewire", cow_read,
return (0);
} /* int cow_init */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_init ("onewire", cow_init);
plugin_register_config ("onewire", cow_load_config,
config_keys, config_keys_num);
diff --git a/src/openvpn.c b/src/openvpn.c
index 9ce23b4f4cb9c9e2550e86d337a866a451931404..2b374bcf693069f9a22c2f9117708924a60d19c9 100644 (file)
--- a/src/openvpn.c
+++ b/src/openvpn.c
static void numusers_submit (char *pinst, char *tinst, gauge_t value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value;
static void iostats_submit (char *pinst, char *tinst, derive_t rx, derive_t tx)
{
value_t values[2];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].derive = rx;
values[1].derive = tx;
derive_t uncompressed, derive_t compressed)
{
value_t values[2];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].derive = uncompressed;
values[1].derive = compressed;
return (-1);
}
- plugin_register_read ("openvpn", openvpn_read);
+ plugin_register_read ("openvpn", openvpn_read, plugin_interval);
plugin_register_shutdown ("openvpn", openvpn_shutdown);
return (0);
} /* int openvpn_init */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_config ("openvpn", openvpn_config,
config_keys, config_keys_num);
plugin_register_init ("openvpn", openvpn_init);
diff --git a/src/oracle.c b/src/oracle.c
index 03567494f227cd281e41d528fbbee7fc67823620..e648fb7741cf3bb67c76d22de80ceb036d44a068 100644 (file)
--- a/src/oracle.c
+++ b/src/oracle.c
status = udb_query_prepare_result (q, prep_area, hostname_g,
/* plugin = */ "oracle", db->name, column_names, column_num,
- /* interval = */ 0);
+ /* interval = */ plugin_interval);
if (status != 0)
{
ERROR ("oracle plugin: o_read_database_query (%s, %s): "
return (0);
} /* }}} int o_shutdown */
-void module_register (void) /* {{{ */
+void module_register (plugin_loaddata_t *data) /* {{{ */
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_complex_config ("oracle", o_config);
plugin_register_init ("oracle", o_init);
- plugin_register_read ("oracle", o_read);
+ plugin_register_read ("oracle", o_read, plugin_interval);
plugin_register_shutdown ("oracle", o_shutdown);
} /* }}} void module_register */
diff --git a/src/perl.c b/src/perl.c
index f8a482275d89bde294344222b060294cdaa8b3e6..e6965e069a76a974bca1f193286cca1153cbeb5d 100644 (file)
--- a/src/perl.c
+++ b/src/perl.c
*/
static int pplugin_dispatch_values (pTHX_ HV *values)
{
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
int ret = 0;
static int pplugin_write (pTHX_ const char *plugin, AV *data_set, HV *values)
{
data_set_t ds;
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
int ret;
/* user_data = */ NULL);
plugin_register_init ("perl", perl_init);
- plugin_register_read ("perl", perl_read);
+ plugin_register_read ("perl", perl_read, plugin_interval);
plugin_register_write ("perl", perl_write, /* user_data = */ NULL);
plugin_register_flush ("perl", perl_flush, /* user_data = */ NULL);
return status;
} /* static int perl_config (oconfig_item_t *) */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
perl_argc = 4;
perl_argv = (char **)smalloc ((perl_argc + 1) * sizeof (char *));
plugin_register_complex_config ("perl", perl_config);
return;
-} /* void module_register (void) */
+} /* void module_register (plugin_loaddata_t *data) */
/* vim: set sw=4 ts=4 tw=78 noexpandtab : */
diff --git a/src/pinba.c b/src/pinba.c
index a6fd06fe2d56352a0a7e29cba18b394dd32559d2..8c4da1a8ebea585c14cfa91f71dabed0a8e791bd 100644 (file)
--- a/src/pinba.c
+++ b/src/pinba.c
return (status);
} /* }}} int pinba_config_view */
-static int plugin_config (oconfig_item_t *ci) /* {{{ */
+static int cpinba_config (oconfig_item_t *ci) /* {{{ */
{
int i;
return (0);
} /* }}} int pinba_config */
-static int plugin_init (void) /* {{{ */
+static int cpinba_init (void) /* {{{ */
{
int status;
return (0);
} /* }}} */
-static int plugin_shutdown (void) /* {{{ */
+static int cpinba_shutdown (void) /* {{{ */
{
if (collector_thread_running)
{
} /* if (collector_thread_running) */
return (0);
-} /* }}} int plugin_shutdown */
+} /* }}} int cpinba_shutdown */
-static int plugin_submit (const pinba_statnode_t *res) /* {{{ */
+static int cpinba_submit (const pinba_statnode_t *res) /* {{{ */
{
value_t value;
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
vl.values = &value;
vl.values_len = 1;
plugin_dispatch_values (&vl);
return (0);
-} /* }}} int plugin_submit */
+} /* }}} int cpinba_submit */
-static int plugin_read (void) /* {{{ */
+static int cpinba_read (void) /* {{{ */
{
unsigned int i=0;
pinba_statnode_t data;
while ((i = service_statnode_collect (&data, i)) != 0)
{
- plugin_submit (&data);
+ cpinba_submit (&data);
}
return 0;
-} /* }}} int plugin_read */
+} /* }}} int cpinba_read */
-void module_register (void) /* {{{ */
+void module_register (plugin_loaddata_t *data) /* {{{ */
{
- plugin_register_complex_config ("pinba", plugin_config);
- plugin_register_init ("pinba", plugin_init);
- plugin_register_read ("pinba", plugin_read);
- plugin_register_shutdown ("pinba", plugin_shutdown);
+ PLUGIN_INIT_INTERVAL (data);
+
+ plugin_register_complex_config ("pinba", cpinba_config);
+ plugin_register_init ("pinba", cpinba_init);
+ plugin_register_read ("pinba", cpinba_read, plugin_interval);
+ plugin_register_shutdown ("pinba", cpinba_shutdown);
} /* }}} void module_register */
/* vim: set sw=2 sts=2 et fdm=marker : */
diff --git a/src/ping.c b/src/ping.c
index b536f42966639f4d7e3ca260e238b7944440294f..7adbfe13e4d4288dcf5ebb11b55c34e9889970eb 100644 (file)
--- a/src/ping.c
+++ b/src/ping.c
gauge_t value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value;
return (0);
} /* }}} int ping_shutdown */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_config ("ping", ping_config,
config_keys, config_keys_num);
plugin_register_init ("ping", ping_init);
- plugin_register_read ("ping", ping_read);
+ plugin_register_read ("ping", ping_read, plugin_interval);
plugin_register_shutdown ("ping", ping_shutdown);
} /* void module_register */
diff --git a/src/plugin.c b/src/plugin.c
index a749d1e07b18502127406469471cd728fe9121bd..e87f6e269701cd2f99350d373e24714b979707c4 100644 (file)
--- a/src/plugin.c
+++ b/src/plugin.c
* object, but it will bitch about a shared object not having a
* ``module_register'' symbol..
*/
-static int plugin_load_file (char *file, uint32_t flags)
+static int plugin_load_file (char *file, uint32_t flags, plugin_loaddata_t *data)
{
lt_dlhandle dlh;
- void (*reg_handle) (void);
+ void (*reg_handle) (plugin_loaddata_t *);
lt_dlinit ();
lt_dlerror (); /* clear errors */
return (1);
}
- if ((reg_handle = (void (*) (void)) lt_dlsym (dlh, "module_register")) == NULL)
+ reg_handle = (void (*) (plugin_loaddata_t *)) lt_dlsym (dlh, "module_register");
+ if (reg_handle == NULL)
{
WARNING ("Couldn't find symbol \"module_register\" in \"%s\": %s\n",
file, lt_dlerror ());
return (-1);
}
- (*reg_handle) ();
+ (*reg_handle) (data);
return (0);
}
}
#define BUFSIZE 512
-int plugin_load (const char *type, uint32_t flags)
+int plugin_load (const char *type, uint32_t flags, plugin_loaddata_t *data)
{
DIR *dh;
const char *dir;
continue;
}
- if (plugin_load_file (filename, flags) == 0)
+ if (plugin_load_file (filename, flags, data) == 0)
{
/* success */
ret = 0;
} /* int plugin_insert_read */
int plugin_register_read (const char *name,
- int (*callback) (void))
+ int (*callback) (void), cdtime_t interval)
{
read_func_t *rf;
int status;
rf->rf_group[0] = '\0';
sstrncpy (rf->rf_name, name, sizeof (rf->rf_name));
rf->rf_type = RF_SIMPLE;
- rf->rf_interval.tv_sec = 0;
- rf->rf_interval.tv_nsec = 0;
+ CDTIME_T_TO_TIMESPEC (interval, &rf->rf_interval);
rf->rf_effective_interval = rf->rf_interval;
status = plugin_insert_read (rf);
diff --git a/src/plugin.h b/src/plugin.h
index e88047283d2325252b068f252f20b5c6a2b196e1..490770a5161da9a1d915d7d2c60c22cb7011d975 100644 (file)
--- a/src/plugin.h
+++ b/src/plugin.h
/*
* Public data types
*/
+struct plugin_loaddata_s
+{
+ cdtime_t interval;
+};
+typedef struct plugin_loaddata_s plugin_loaddata_t;
+static cdtime_t __attribute__((unused)) plugin_interval = 0;
+
typedef unsigned long long counter_t;
typedef double gauge_t;
typedef int64_t derive_t;
};
typedef struct value_list_s value_list_t;
-#define VALUE_LIST_INIT { NULL, 0, 0, interval_g, "localhost", "", "", "", "", NULL }
+#define VALUE_LIST_INIT(interval) { NULL, 0, 0, (interval), "localhost", "", "", "", "", NULL }
#define VALUE_LIST_STATIC { NULL, 0, 0, 0, "localhost", "", "", "", "", NULL }
struct data_source_s
* ARGUMENTS
* `name' Name of the plugin to load.
* `flags' Hints on how to handle this plugin.
+ * `data' Additional arguments to pass to the plugin.
*
* RETURN VALUE
* Returns zero upon success, a value greater than zero if no plugin was found
* NOTES
* No attempt is made to re-load an already loaded module.
*/
-int plugin_load (const char *name, uint32_t flags);
+int plugin_load (const char *name, uint32_t flags, plugin_loaddata_t *data);
+
+/*
+ * NAME
+ * PLUGIN_INIT_INTERVAL
+ *
+ * DESCRIPTION
+ * Initialize the plugin specific interval settings.
+ *
+ * ARGUMENTS
+ * `data' Data provided by LoadPlugin, like custom interval settings.
+ */
+#define PLUGIN_INIT_INTERVAL(data) \
+ do { \
+ if ((data)->interval != 0) \
+ plugin_interval = (data)->interval; \
+ } while (0)
void plugin_init_all (void);
void plugin_read_all (void);
int plugin_register_init (const char *name,
plugin_init_cb callback);
int plugin_register_read (const char *name,
- int (*callback) (void));
+ int (*callback) (void), cdtime_t interval);
/* "user_data" will be freed automatically, unless
* "plugin_register_complex_read" returns an error (non-zero). */
int plugin_register_complex_read (const char *group, const char *name,
diff --git a/src/postgresql.c b/src/postgresql.c
index a8812e2158327bf86153689894e8eada7e620022..0bb5653423075286bb58d8f028cf562dd674c91f 100644 (file)
--- a/src/postgresql.c
+++ b/src/postgresql.c
ssnprintf (cb_name, sizeof (cb_name), "postgresql-%s", db->database);
+ if (db->interval <= 0)
+ db->interval = plugin_interval;
CDTIME_T_TO_TIMESPEC (db->interval, &cb_interval);
plugin_register_complex_read ("postgresql", cb_name, c_psql_read,
return 0;
} /* c_psql_config */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_complex_config ("postgresql", c_psql_config);
plugin_register_shutdown ("postgresql", c_psql_shutdown);
} /* module_register */
diff --git a/src/powerdns.c b/src/powerdns.c
index a1b23555bec080592a261f91e1d6e02ae769bd6a..ae74b437f3cda36c47e5b991c923c392d45db788 100644 (file)
--- a/src/powerdns.c
+++ b/src/powerdns.c
static void submit (const char *plugin_instance, /* {{{ */
const char *pdns_type, const char *value)
{
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
value_t values[1];
const char *type = NULL;
return (0);
} /* static int powerdns_shutdown */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_complex_config ("powerdns", powerdns_config);
- plugin_register_read ("powerdns", powerdns_read);
+ plugin_register_read ("powerdns", powerdns_read, plugin_interval);
plugin_register_shutdown ("powerdns", powerdns_shutdown );
} /* void module_register */
diff --git a/src/processes.c b/src/processes.c
index 8f4eb88fc168f3c1b36835c5ed294c95dd31ed08..b77f2aee37608cafe19ffc14a70a9095cca13af4 100644 (file)
--- a/src/processes.c
+++ b/src/processes.c
static void ps_submit_state (const char *state, double value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value;
static void ps_submit_proc_list (procstat_t *ps)
{
value_t values[2];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
vl.values = values;
vl.values_len = 2;
static void ps_submit_fork_rate (unsigned long value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].derive = (derive_t) value;
return (0);
} /* int ps_read */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_complex_config ("processes", ps_config);
plugin_register_init ("processes", ps_init);
- plugin_register_read ("processes", ps_read);
+ plugin_register_read ("processes", ps_read, plugin_interval);
} /* void module_register */
diff --git a/src/protocols.c b/src/protocols.c
index 0dfba2101fa578e92c56c360b795f1e989ff1a29..e87534e83a0370998c58d15003d71fbe7c3f00ca 100644 (file)
--- a/src/protocols.c
+++ b/src/protocols.c
const char *str_key, const char *str_value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
int status;
status = parse_value (str_value, values, DS_TYPE_DERIVE);
return (0);
} /* int protocols_config */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_config ("protocols", protocols_config,
config_keys, config_keys_num);
- plugin_register_read ("protocols", protocols_read);
+ plugin_register_read ("protocols", protocols_read, plugin_interval);
} /* void module_register */
/* vim: set sw=2 sts=2 et : */
diff --git a/src/python.c b/src/python.c
index ee673883e49b120512d855aef6e4266a793967d6..3e678f3a7cfc002db128e1140384c119852d3f08 100644 (file)
--- a/src/python.c
+++ b/src/python.c
PyErr_Clear();
}
+cdtime_t cpy_get_plugin_interval(void) {
+ return plugin_interval;
+}
+
static int cpy_read_callback(user_data_t *data) {
cpy_callback_t *c = data->data;
PyObject *ret;
@@ -627,8 +631,14 @@ static PyObject *cpy_register_read(PyObject *self, PyObject *args, PyObject *kwd
user_data = malloc(sizeof(*user_data));
user_data->free_func = cpy_destroy_user_data;
user_data->data = c;
- ts.tv_sec = interval;
- ts.tv_nsec = (interval - ts.tv_sec) * 1000000000;
+ if (interval > 0.0) {
+ ts.tv_sec = interval;
+ ts.tv_nsec = (interval - ts.tv_sec) * 1000000000;
+ }
+ else {
+ CDTIME_T_TO_TIMESPEC (plugin_interval, &ts);
+ }
+
plugin_register_complex_read(/* group = */ NULL, buf,
cpy_read_callback, &ts, user_data);
return cpy_string_to_unicode_or_bytes(buf);
return 0;
}
-void module_register(void) {
+void module_register(plugin_loaddata_t *data) {
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_complex_config("python", cpy_config);
plugin_register_init("python", cpy_init);
plugin_register_shutdown("python", cpy_shutdown);
diff --git a/src/pyvalues.c b/src/pyvalues.c
index 36a717e9bfec401b54d8e2b629f110a01a303d7a..2373217395f5606c8bd5abe351caf3c242bb28a4 100644 (file)
--- a/src/pyvalues.c
+++ b/src/pyvalues.c
@@ -482,7 +482,7 @@ static PyObject *Values_dispatch(Values *self, PyObject *args, PyObject *kwds) {
const data_set_t *ds;
int size;
value_t *value;
- value_list_t value_list = VALUE_LIST_INIT;
+ value_list_t value_list = VALUE_LIST_INIT(/* default interval = */ 0);
PyObject *values = self->values, *meta = self->meta;
double time = self->data.time, interval = self->interval;
const char *host = self->data.host;
@@ -558,7 +558,10 @@ static PyObject *Values_dispatch(Values *self, PyObject *args, PyObject *kwds) {
value_list.meta = cpy_build_meta(meta);
value_list.values_len = size;
value_list.time = DOUBLE_TO_CDTIME_T(time);
- value_list.interval = DOUBLE_TO_CDTIME_T(interval);
+ if (interval > 0.0)
+ value_list.interval = DOUBLE_TO_CDTIME_T(interval);
+ else
+ value_list.interval = cpy_get_plugin_interval();
sstrncpy(value_list.host, host, sizeof(value_list.host));
sstrncpy(value_list.plugin, plugin, sizeof(value_list.plugin));
sstrncpy(value_list.plugin_instance, plugin_instance, sizeof(value_list.plugin_instance));
const data_set_t *ds;
int size;
value_t *value;
- value_list_t value_list = VALUE_LIST_INIT;
+ value_list_t value_list = VALUE_LIST_INIT(/* default interval = */ 0);
PyObject *values = self->values, *meta = self->meta;
double time = self->data.time, interval = self->interval;
const char *host = self->data.host;
value_list.values = value;
value_list.values_len = size;
value_list.time = DOUBLE_TO_CDTIME_T(time);
- value_list.interval = DOUBLE_TO_CDTIME_T(interval);
+ if (interval > 0.0)
+ value_list.interval = DOUBLE_TO_CDTIME_T(interval);
+ else
+ value_list.interval = cpy_get_plugin_interval();
sstrncpy(value_list.host, host, sizeof(value_list.host));
sstrncpy(value_list.plugin, plugin, sizeof(value_list.plugin));
sstrncpy(value_list.plugin_instance, plugin_instance, sizeof(value_list.plugin_instance));
diff --git a/src/redis.c b/src/redis.c
index b694e09db8f84a6be6767b20cacd50d37791b074..5032b771bae99520cc4e717d31b21df08c2c801b 100644 (file)
--- a/src/redis.c
+++ b/src/redis.c
gauge_t value) /* {{{ */
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value;
derive_t value) /* {{{ */
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].derive = value;
}
/* }}} */
-void module_register (void) /* {{{ */
+void module_register (plugin_loaddata_t *data) /* {{{ */
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_complex_config ("redis", redis_config);
plugin_register_init ("redis", redis_init);
- plugin_register_read ("redis", redis_read);
+ plugin_register_read ("redis", redis_read, plugin_interval);
/* TODO: plugin_register_write: one redis list per value id with
* X elements */
}
diff --git a/src/routeros.c b/src/routeros.c
index d61ffe984d36cfa2eaa3b74efce9872abdc9d648..c35a0483bf2a40fb1788fd6ea1541fcc5ac39b78 100644 (file)
--- a/src/routeros.c
+++ b/src/routeros.c
const char *type_instance, derive_t rx, derive_t tx)
{
value_t values[2];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].derive = rx;
values[1].derive = tx;
const char *type_instance, gauge_t value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value;
const char *type_instance, derive_t value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].derive = value;
{
cr_data_t *router_data;
char read_name[128];
+ struct timespec read_interval;
user_data_t user_data;
int status;
int i;
}
ssnprintf (read_name, sizeof (read_name), "routeros/%s", router_data->node);
+ CDTIME_T_TO_TIMESPEC (plugin_interval, &read_interval);
user_data.data = router_data;
user_data.free_func = (void *) cr_free_data;
if (status == 0)
- status = plugin_register_complex_read (/* group = */ NULL, read_name,
- cr_read, /* interval = */ NULL, &user_data);
+ status = plugin_register_complex_read (/* group = */ NULL,
+ /* name = */ read_name,
+ /* callback = */ cr_read,
+ /* interval = */ (plugin_interval > 0) ? &read_interval : NULL,
+ /* user_data = */ &user_data);
if (status != 0)
cr_free_data (router_data);
return (0);
} /* }}} int cr_config */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_complex_config ("routeros", cr_config);
} /* void module_register */
diff --git a/src/rrdcached.c b/src/rrdcached.c
index 11c1c6a7f85c3e96c2380602094c81f09e4bb97f..8a937d46991602a9b004734d93160caa91853051 100644 (file)
--- a/src/rrdcached.c
+++ b/src/rrdcached.c
rrdc_stats_t *ptr;
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
if (daemon_address == NULL)
return (-1);
static int rc_init (void)
{
if (config_collect_stats != 0)
- plugin_register_read ("rrdcached", rc_read);
+ plugin_register_read ("rrdcached", rc_read, plugin_interval);
return (0);
} /* int rc_init */
return (0);
} /* int rc_shutdown */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_complex_config ("rrdcached", rc_config);
plugin_register_init ("rrdcached", rc_init);
plugin_register_shutdown ("rrdcached", rc_shutdown);
diff --git a/src/rrdtool.c b/src/rrdtool.c
index 56a82d0321b8a875fdc1a8b5c93e312550388b77..88a939e9a0f86803de7baa03db4a151d408a0b67 100644 (file)
--- a/src/rrdtool.c
+++ b/src/rrdtool.c
return (0);
} /* int rrd_init */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_config ("rrdtool", rrd_config,
config_keys, config_keys_num);
plugin_register_init ("rrdtool", rrd_init);
diff --git a/src/sensors.c b/src/sensors.c
index 8391346b4dc611b060633e8e6b1c828d20d7b67a..596d7df05487ec472e680946d026bb19257908e3 100644 (file)
--- a/src/sensors.c
+++ b/src/sensors.c
int status;
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
status = ssnprintf (match_key, sizeof (match_key), "%s/%s-%s",
plugin_instance, type, type_instance);
return (0);
} /* int sensors_read */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_config ("sensors", sensors_config,
config_keys, config_keys_num);
- plugin_register_read ("sensors", sensors_read);
+ plugin_register_read ("sensors", sensors_read, plugin_interval);
plugin_register_shutdown ("sensors", sensors_shutdown);
} /* void module_register */
diff --git a/src/serial.c b/src/serial.c
index 9bd885dbbf0bec28aeacbe8ae06624a06bf0a98e..7069a21d916b8752ed7570b87b6254ce03973719 100644 (file)
--- a/src/serial.c
+++ b/src/serial.c
derive_t rx, derive_t tx)
{
value_t values[2];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].derive = rx;
values[1].derive = tx;
return (0);
} /* int serial_read */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
- plugin_register_read ("serial", serial_read);
+ PLUGIN_INIT_INTERVAL (data);
+ plugin_register_read ("serial", serial_read, plugin_interval);
} /* void module_register */
diff --git a/src/snmp.c b/src/snmp.c
index 7a8485113289f16923a14f491537c16b2aa5ac79..9e3143b735fcdb8e7ed68d43e092bbd33b48398c 100644 (file)
--- a/src/snmp.c
+++ b/src/snmp.c
cb_data.data = hd;
cb_data.free_func = csnmp_host_definition_destroy;
+ if (hd->interval <= 0)
+ hd->interval = plugin_interval;
CDTIME_T_TO_TIMESPEC (hd->interval, &cb_interval);
status = plugin_register_complex_read (/* group = */ NULL, cb_name,
@@ -1025,7 +1027,7 @@ static int csnmp_dispatch_table (host_definition_t *host, data_definition_t *dat
csnmp_table_values_t **value_table)
{
const data_set_t *ds;
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
csnmp_list_instances_t *instance_list_ptr;
csnmp_table_values_t **value_table_ptr;
@@ -1406,7 +1408,7 @@ static int csnmp_read_value (host_definition_t *host, data_definition_t *data)
struct variable_list *vb;
const data_set_t *ds;
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
int status;
int i;
return (0);
} /* int csnmp_shutdown */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_complex_config ("snmp", csnmp_config);
plugin_register_init ("snmp", csnmp_init);
plugin_register_shutdown ("snmp", csnmp_shutdown);
diff --git a/src/swap.c b/src/swap.c
index 397969eff0ce0ea7a4eb48762bdef9d0e019bbd6..f9165a2ac8911f4450b42e10f20183756c8e6937 100644 (file)
--- a/src/swap.c
+++ b/src/swap.c
const char *type, const char *type_instance,
value_t value)
{
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
assert (type != NULL);
} /* }}} int swap_read */
#endif /* HAVE_PERFSTAT */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
#if SWAP_HAVE_CONFIG
plugin_register_config ("swap", swap_config, config_keys, config_keys_num);
#endif
plugin_register_init ("swap", swap_init);
- plugin_register_read ("swap", swap_read);
+ plugin_register_read ("swap", swap_read, plugin_interval);
} /* void module_register */
/* vim: set fdm=marker : */
diff --git a/src/syslog.c b/src/syslog.c
index ace9dc6f090e1a98a8bc3a0d4d08a25b39f6f21b..f9f42045e40c6162638fcbceb95be4f0b82d09da 100644 (file)
--- a/src/syslog.c
+++ b/src/syslog.c
return (0);
}
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
openlog ("collectd", LOG_CONS | LOG_PID, LOG_DAEMON);
plugin_register_config ("syslog", sl_config, config_keys, config_keys_num);
plugin_register_log ("syslog", sl_log, /* user_data = */ NULL);
plugin_register_shutdown ("syslog", sl_shutdown);
-} /* void module_register(void) */
+} /* void module_register(plugin_loaddata_t *data) */
diff --git a/src/table.c b/src/table.c
index 9641c759b2b059a010492b39d6e583196b8038fd..123b696827219c00b9ef2095b33abc426a4068ac 100644 (file)
--- a/src/table.c
+++ b/src/table.c
static int tbl_result_dispatch (tbl_t *tbl, tbl_result_t *res,
char **fields, size_t fields_num)
{
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
value_t values[res->values_num];
size_t i;
if (0 == tables_num)
return 0;
- plugin_register_read ("table", tbl_read);
+ plugin_register_read ("table", tbl_read, plugin_interval);
plugin_register_shutdown ("table", tbl_shutdown);
return 0;
} /* tbl_init */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_complex_config ("table", tbl_config);
plugin_register_init ("table", tbl_init);
} /* module_register */
diff --git a/src/tail.c b/src/tail.c
index 25cbcd4c1b5188df787e843c60aecb895aad5688..96523486b52b80dab2a59ba20731179ec51a00b5 100644 (file)
--- a/src/tail.c
+++ b/src/tail.c
if (status == 0)
{
status = tail_match_add_match_simple (tm, cm.regex, cm.excluderegex,
- cm.flags, "tail", plugin_instance, cm.type, cm.type_instance);
+ cm.flags, "tail", plugin_instance, cm.type, cm.type_instance,
+ plugin_interval);
if (status != 0)
{
return (0);
} /* int ctail_shutdown */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_complex_config ("tail", ctail_config);
plugin_register_init ("tail", ctail_init);
- plugin_register_read ("tail", ctail_read);
+ plugin_register_read ("tail", ctail_read, plugin_interval);
plugin_register_shutdown ("tail", ctail_shutdown);
} /* void module_register */
diff --git a/src/tape.c b/src/tape.c
index a8e7dc45faab08bdf18ffd42fbebd242f3f3477f..9063d3ce3117c5a2c1a6a31ec69d76a5f0e66cb7 100644 (file)
--- a/src/tape.c
+++ b/src/tape.c
derive_t read, derive_t write)
{
value_t values[2];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].derive = read;
values[1].derive = write;
return (0);
}
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_init ("tape", tape_init);
- plugin_register_read ("tape", tape_read);
+ plugin_register_read ("tape", tape_read, plugin_interval);
}
index cb68048b6a8f7c042cdd37bbf7dc3c77a24bd754..df756907487a8338b8ca8c04831f0465a0e98324 100644 (file)
return (FC_TARGET_CONTINUE);
} /* }}} int tn_invoke */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
target_proc_t tproc;
+ PLUGIN_INIT_INTERVAL (data);
+
memset (&tproc, 0, sizeof (tproc));
tproc.create = tn_create;
tproc.destroy = tn_destroy;
diff --git a/src/target_replace.c b/src/target_replace.c
index 9a9affb4d3e6ba3841f33f0be7d3d47effade175..e0722fffcde92f6f65ec247602bdfbd199cf56f6 100644 (file)
--- a/src/target_replace.c
+++ b/src/target_replace.c
return (FC_TARGET_CONTINUE);
} /* }}} int tr_invoke */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
target_proc_t tproc;
+ PLUGIN_INIT_INTERVAL (data);
+
memset (&tproc, 0, sizeof (tproc));
tproc.create = tr_create;
tproc.destroy = tr_destroy;
diff --git a/src/target_scale.c b/src/target_scale.c
index af224f109d6bb8de19066b8c472a6557d6058d3e..ccd1d085173499dcf8bea6793b9a7cff2b4cbb8f 100644 (file)
--- a/src/target_scale.c
+++ b/src/target_scale.c
return (FC_TARGET_CONTINUE);
} /* }}} int ts_invoke */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
target_proc_t tproc;
+ PLUGIN_INIT_INTERVAL (data);
+
memset (&tproc, 0, sizeof (tproc));
tproc.create = ts_create;
tproc.destroy = ts_destroy;
diff --git a/src/target_set.c b/src/target_set.c
index 8a014c3cd50caa156649f6de3093eda7cd7cac77..099f109679f7f8ac096c8c8b813fd1d43e6f673e 100644 (file)
--- a/src/target_set.c
+++ b/src/target_set.c
return (FC_TARGET_CONTINUE);
} /* }}} int ts_invoke */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
target_proc_t tproc;
+ PLUGIN_INIT_INTERVAL (data);
+
memset (&tproc, 0, sizeof (tproc));
tproc.create = ts_create;
tproc.destroy = ts_destroy;
diff --git a/src/target_v5upgrade.c b/src/target_v5upgrade.c
index 25f4637d15b8afd75363b3256f8a78ca45aa4788..f4e87603fb262abf9aadf12352719d2e68814b0f 100644 (file)
--- a/src/target_v5upgrade.c
+++ b/src/target_v5upgrade.c
return (FC_TARGET_CONTINUE);
} /* }}} int v5_invoke */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
target_proc_t tproc;
+ PLUGIN_INIT_INTERVAL (data);
+
memset (&tproc, 0, sizeof (tproc));
tproc.create = v5_create;
tproc.destroy = v5_destroy;
diff --git a/src/tcpconns.c b/src/tcpconns.c
index 6a7e32d72007e216ff739bd491e6e34a6abefe11..d4c14a22c8652ebcee683fdff73c48206b745207 100644 (file)
--- a/src/tcpconns.c
+++ b/src/tcpconns.c
static void conn_submit_port_entry (port_entry_t *pe)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
int i;
vl.values = values;
}
#endif /* KERNEL_AIX */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_config ("tcpconns", conn_config,
config_keys, config_keys_num);
#if KERNEL_LINUX
#elif KERNEL_AIX
/* no initialization */
#endif
- plugin_register_read ("tcpconns", conn_read);
+ plugin_register_read ("tcpconns", conn_read, plugin_interval);
} /* void module_register */
/*
diff --git a/src/teamspeak2.c b/src/teamspeak2.c
index 2552ad305ffcaa51decb9ab490764a1cc907e4fb..48a81ce9f9bf60bd9dc58e7b1f0fc779bf0131e1 100644 (file)
--- a/src/teamspeak2.c
+++ b/src/teamspeak2.c
* Submits a gauge value to the collectd daemon
*/
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value;
* Submits the io rx/tx tuple to the collectd daemon
*/
value_t values[2];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].derive = rx;
values[1].derive = tx;
return (0);
} /* int tss2_shutdown */
-void module_register(void)
+void module_register(plugin_loaddata_t *data)
{
/*
* Mandatory module_register function
*/
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_config ("teamspeak2", tss2_config,
config_keys, config_keys_num);
- plugin_register_read ("teamspeak2", tss2_read);
+ plugin_register_read ("teamspeak2", tss2_read, plugin_interval);
plugin_register_shutdown ("teamspeak2", tss2_shutdown);
} /* void module_register */
diff --git a/src/ted.c b/src/ted.c
index bf519bbee53ec38c34ddae669c707523e2fbf617..6ecef3ef4533ba15bc82b996ba643ad32ec39027 100644 (file)
--- a/src/ted.c
+++ b/src/ted.c
static void ted_submit (char *type, double value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value;
return (0);
} /* int ted_shutdown */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_config ("ted", ted_config,
config_keys, config_keys_num);
- plugin_register_read ("ted", ted_read);
+ plugin_register_read ("ted", ted_read, plugin_interval);
plugin_register_shutdown ("ted", ted_shutdown);
} /* void module_register */
diff --git a/src/thermal.c b/src/thermal.c
index 0ad0d90a04377126132e35cad77e4d592a844a1d..f029a3bd9f47cc45944fc5d98034505900ef3cfd 100644 (file)
--- a/src/thermal.c
+++ b/src/thermal.c
static void thermal_submit (const char *plugin_instance, enum dev_type dt,
gauge_t value)
{
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
value_t v;
v.gauge = value;
int ret = -1;
if (!force_procfs && access (dirname_sysfs, R_OK | X_OK) == 0) {
- ret = plugin_register_read ("thermal", thermal_sysfs_read);
+ ret = plugin_register_read ("thermal", thermal_sysfs_read, plugin_interval);
} else if (access (dirname_procfs, R_OK | X_OK) == 0) {
- ret = plugin_register_read ("thermal", thermal_procfs_read);
+ ret = plugin_register_read ("thermal", thermal_procfs_read, plugin_interval);
}
return ret;
return 0;
}
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_config ("thermal", thermal_config,
config_keys, STATIC_ARRAY_SIZE(config_keys));
plugin_register_init ("thermal", thermal_init);
diff --git a/src/threshold.c b/src/threshold.c
index 342d08acae919edd72cbea74b10a6e798dc4a094..5b00b7a91196faf9560e9a524413623893a949f6 100644 (file)
--- a/src/threshold.c
+++ b/src/threshold.c
return (status);
} /* }}} int um_config */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_complex_config ("threshold", ut_config);
}
diff --git a/src/tokyotyrant.c b/src/tokyotyrant.c
index 678a341c1ceeaf15f24a708d12567c1b8ed92f15..6cb358e8d6204bb289ebc5d98b8082cc2be2f6aa 100644 (file)
--- a/src/tokyotyrant.c
+++ b/src/tokyotyrant.c
static void tt_submit (gauge_t val, const char* type)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = val;
return(0);
}
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_config("tokyotyrant", tt_config,
config_keys, config_keys_num);
- plugin_register_read("tokyotyrant", tt_read);
+ plugin_register_read("tokyotyrant", tt_read, plugin_interval);
plugin_register_shutdown("tokyotyrant", tt_shutdown);
}
diff --git a/src/unixsock.c b/src/unixsock.c
index d729477bbc54db999322dedfe581834dc9725c21..f62ba3dc79f10e0512c7742910756a281a95ae0e 100644 (file)
--- a/src/unixsock.c
+++ b/src/unixsock.c
}
else if (strcasecmp (fields[0], "putval") == 0)
{
- handle_putval (fhout, buffer);
+ handle_putval (fhout, buffer, /* default_interval = */ interval_g);
}
else if (strcasecmp (fields[0], "listval") == 0)
{
return (0);
} /* int us_shutdown */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_config ("unixsock", us_config,
config_keys, config_keys_num);
plugin_register_init ("unixsock", us_init);
plugin_register_shutdown ("unixsock", us_shutdown);
-} /* void module_register (void) */
+} /* void module_register (plugin_loaddata_t *data) */
/* vim: set sw=4 ts=4 sts=4 tw=78 : */
diff --git a/src/uptime.c b/src/uptime.c
index d2ba9633db290aeb17ac0a064874b3c652742b3a..6a147aff81e804898034eb2b6b9464c42822a06e 100644 (file)
--- a/src/uptime.c
+++ b/src/uptime.c
static void uptime_submit (gauge_t uptime)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = uptime;
return (0);
}
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_init ("uptime", uptime_init);
- plugin_register_read ("uptime", uptime_read);
+ plugin_register_read ("uptime", uptime_read, plugin_interval);
} /* void module_register */
diff --git a/src/users.c b/src/users.c
index 1e337540e5b4f5b258d00234472385c8a1187454..0753b07bc825768550393272b804980c7f7f4a4a 100644 (file)
--- a/src/users.c
+++ b/src/users.c
static void users_submit (gauge_t value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value;
return (0);
} /* int users_read */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
- plugin_register_read ("users", users_read);
-} /* void module_register(void) */
+ PLUGIN_INIT_INTERVAL (data);
+ plugin_register_read ("users", users_read, plugin_interval);
+} /* void module_register(plugin_loaddata_t *data) */
diff --git a/src/utils_cache.c b/src/utils_cache.c
index dd5bcb59ffc9833b2a92341a085e32d526e9e812..27d22534cdaf57d6709a4de659fe75e0df87480a 100644 (file)
--- a/src/utils_cache.c
+++ b/src/utils_cache.c
* plugin calls the cache interface. */
for (i = 0; i < keys_len; i++)
{
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (/* default interval = */ 0);
vl.values = NULL;
vl.values_len = 0;
diff --git a/src/utils_cmd_putval.c b/src/utils_cmd_putval.c
index dd43337ee01390eb3c703a5d8c473bc93eb7ea90..89c55287786565322168cdd32aad89fef256299d 100644 (file)
--- a/src/utils_cmd_putval.c
+++ b/src/utils_cmd_putval.c
return (0);
} /* int parse_option */
-int handle_putval (FILE *fh, char *buffer)
+int handle_putval (FILE *fh, char *buffer, cdtime_t default_interval)
{
char *command;
char *identifier;
char *identifier_copy;
const data_set_t *ds;
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (default_interval);
DEBUG ("utils_cmd_putval: handle_putval (fh = %p, buffer = %s);",
(void *) fh, buffer);
diff --git a/src/utils_cmd_putval.h b/src/utils_cmd_putval.h
index 9c92fd31c0caf6a0524ef595c60d3158051b73aa..9aa2ef274fb7b03dee6bb4c40639923561e21e23 100644 (file)
--- a/src/utils_cmd_putval.h
+++ b/src/utils_cmd_putval.h
#include "plugin.h"
-int handle_putval (FILE *fh, char *buffer);
+int handle_putval (FILE *fh, char *buffer, cdtime_t default_interval);
int create_putval (char *ret, size_t ret_len,
const data_set_t *ds, const value_list_t *vl);
diff --git a/src/utils_db_query.c b/src/utils_db_query.c
index dcac80764c665ca1dd98a456feea0cb2386692c4..047eb82ded37ca0e04be955c5f6373ebd6805ca3 100644 (file)
--- a/src/utils_db_query.c
+++ b/src/utils_db_query.c
udb_result_preparation_area_t *r_area,
const udb_query_t const *q, udb_query_preparation_area_t *q_area)
{
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (/* default_interval = */ 0);
size_t i;
assert (r != NULL);
diff --git a/src/utils_tail_match.c b/src/utils_tail_match.c
index 8ae2208cc1e2138e9c304930e016d039c7dfb480..69902ddbd49efc6520aae5d6265812f7654770a8 100644 (file)
--- a/src/utils_tail_match.c
+++ b/src/utils_tail_match.c
char plugin_instance[DATA_MAX_NAME_LEN];
char type[DATA_MAX_NAME_LEN];
char type_instance[DATA_MAX_NAME_LEN];
+ cdtime_t interval;
};
typedef struct cu_tail_match_simple_s cu_tail_match_simple_t;
{
cu_tail_match_simple_t *data = (cu_tail_match_simple_t *) user_data;
cu_match_value_t *match_value;
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (/* default_interval = */ 0);
value_t values[1];
match_value = (cu_match_value_t *) match_get_user_data (match);
sstrncpy (vl.type, data->type, sizeof (vl.type));
sstrncpy (vl.type_instance, data->type_instance,
sizeof (vl.type_instance));
+ vl.interval = data->interval;
plugin_dispatch_values (&vl);
int tail_match_add_match_simple (cu_tail_match_t *obj,
const char *regex, const char *excluderegex, int ds_type,
const char *plugin, const char *plugin_instance,
- const char *type, const char *type_instance)
+ const char *type, const char *type_instance,
+ cdtime_t interval)
{
cu_match_t *match;
cu_tail_match_simple_t *user_data;
sstrncpy (user_data->type_instance, type_instance,
sizeof (user_data->type_instance));
+ user_data->interval = interval;
+
status = tail_match_add_match (obj, match, simple_submit_match,
user_data, free);
diff --git a/src/utils_tail_match.h b/src/utils_tail_match.h
index 765974576660449c3887707007afc1edf8a6ea1e..4b6e79435c28c54c09b02ce083c17d791c359786 100644 (file)
--- a/src/utils_tail_match.h
+++ b/src/utils_tail_match.h
int tail_match_add_match_simple (cu_tail_match_t *obj,
const char *regex, const char *excluderegex, int ds_type,
const char *plugin, const char *plugin_instance,
- const char *type, const char *type_instance);
+ const char *type, const char *type_instance,
+ cdtime_t interval);
/*
* NAME
diff --git a/src/uuid.c b/src/uuid.c
index cf23f5b37eea4e6505f62cb8ac37c65def408a07..929b901cb646b317de7c5591bdec17fbb6ba9d1c 100644 (file)
--- a/src/uuid.c
+++ b/src/uuid.c
return 0;
}
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_config ("uuid", uuid_config,
config_keys, NR_CONFIG_KEYS);
plugin_register_init ("uuid", uuid_init);
diff --git a/src/varnish.c b/src/varnish.c
index 37fd4bb3541f2181bd81dd1b379214bc9a6d4f03..2693b7c415d21c96f883e4d0458a9125f8383fb0 100644 (file)
--- a/src/varnish.c
+++ b/src/varnish.c
static int varnish_submit (const char *plugin_instance, /* {{{ */
const char *category, const char *type, const char *type_instance, value_t value)
{
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
vl.values = &value;
vl.values_len = 1;
static int varnish_init (void) /* {{{ */
{
user_config_t *conf;
+ struct timespec cb_interval;
user_data_t ud;
if (have_instance)
ud.data = conf;
ud.free_func = varnish_config_free;
+ CDTIME_T_TO_TIMESPEC (plugin_interval, &cb_interval);
+
plugin_register_complex_read (/* group = */ "varnish",
/* name = */ "varnish/localhost",
/* callback = */ varnish_read,
- /* interval = */ NULL,
+ /* interval = */ (plugin_interval > 0) ? &cb_interval : NULL,
/* user data = */ &ud);
return (0);
user_config_t *conf;
user_data_t ud;
char callback_name[DATA_MAX_NAME_LEN];
+ struct timespec cb_interval;
int i;
conf = malloc (sizeof (*conf));
ssnprintf (callback_name, sizeof (callback_name), "varnish/%s",
(conf->instance == NULL) ? "localhost" : conf->instance);
+ CDTIME_T_TO_TIMESPEC (plugin_interval, &cb_interval);
+
ud.data = conf;
ud.free_func = varnish_config_free;
plugin_register_complex_read (/* group = */ "varnish",
/* name = */ callback_name,
/* callback = */ varnish_read,
- /* interval = */ NULL,
+ /* interval = */ (plugin_interval > 0) ? &cb_interval : NULL,
/* user data = */ &ud);
have_instance = 1;
return (0);
} /* }}} int varnish_config */
-void module_register (void) /* {{{ */
+void module_register (plugin_loaddata_t *data) /* {{{ */
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_complex_config ("varnish", varnish_config);
plugin_register_init ("varnish", varnish_init);
} /* }}} */
diff --git a/src/vmem.c b/src/vmem.c
index 56997bf14f54f0a812a3cdb7c5cc17b4b867b517..47d10825c153e6275d1414ecd6b373d86669e082 100644 (file)
--- a/src/vmem.c
+++ b/src/vmem.c
static void submit (const char *plugin_instance, const char *type,
const char *type_instance, value_t *values, int values_len)
{
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
vl.values = values;
vl.values_len = values_len;
return (0);
} /* int vmem_read */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
+
plugin_register_config ("vmem", vmem_config,
config_keys, config_keys_num);
- plugin_register_read ("vmem", vmem_read);
+ plugin_register_read ("vmem", vmem_read, plugin_interval);
} /* void module_register */
/* vim: set sw=2 sts=2 ts=8 : */
diff --git a/src/vserver.c b/src/vserver.c
index d80717cd3349e6a684e977375604209e7d05b775..ee8888ab5e15e46a44b6c3e167e3971ff1903020 100644 (file)
--- a/src/vserver.c
+++ b/src/vserver.c
const char *type_instance, derive_t rx, derive_t tx)
{
value_t values[2];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].derive = rx;
values[1].derive = tx;
gauge_t snum, gauge_t mnum, gauge_t lnum)
{
value_t values[3];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = snum;
values[1].gauge = mnum;
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value;
return (0);
} /* int vserver_read */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_init ("vserver", vserver_init);
- plugin_register_read ("vserver", vserver_read);
-} /* void module_register(void) */
+ plugin_register_read ("vserver", vserver_read, plugin_interval);
+} /* void module_register(plugin_loaddata_t *data) */
/* vim: set ts=4 sw=4 noexpandtab : */
diff --git a/src/wireless.c b/src/wireless.c
index f7ba735d37687356d16d3d7bd5b3ff230736563d..6943a804feede97edf7b535e9d69b18d9aea0368 100644 (file)
--- a/src/wireless.c
+++ b/src/wireless.c
double value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value;
return (0);
} /* int wireless_read */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
- plugin_register_read ("wireless", wireless_read);
+ PLUGIN_INIT_INTERVAL (data);
+ plugin_register_read ("wireless", wireless_read, plugin_interval);
} /* void module_register */
diff --git a/src/write_http.c b/src/write_http.c
index 3035e43a99611ec3daf9e3b5b99f2ec3a2d71316..61ac0e7fdbc2bb299e9fc8f2cb3122b8890b6416 100644 (file)
--- a/src/write_http.c
+++ b/src/write_http.c
return (0);
} /* }}} int wh_config */
-void module_register (void) /* {{{ */
+void module_register (plugin_loaddata_t *data) /* {{{ */
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_complex_config ("write_http", wh_config);
} /* }}} void module_register */
diff --git a/src/write_redis.c b/src/write_redis.c
index 58f2cae3e28dc02b3a9fad6bcbb80171230631a3..5876185182e0e53d9eac547ac103f57e865649e5 100644 (file)
--- a/src/write_redis.c
+++ b/src/write_redis.c
return (0);
} /* }}} int wr_config */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_complex_config ("write_redis", wr_config);
}
diff --git a/src/xmms.c b/src/xmms.c
index 52beb65f8a5d21d32880f81a58be887363390873..b9937a5022b29614c2b2d50911ae47ed84a37a4f 100644 (file)
--- a/src/xmms.c
+++ b/src/xmms.c
static void cxmms_submit (const char *type, gauge_t value)
{
value_t values[1];
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
values[0].gauge = value;
return (0);
} /* int read */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
- plugin_register_read ("xmms", cxmms_read);
+ PLUGIN_INIT_INTERVAL (data);
+ plugin_register_read ("xmms", cxmms_read, plugin_interval);
} /* void module_register */
/*
diff --git a/src/zfs_arc.c b/src/zfs_arc.c
index 8341be0c306317aa21dac615a1c16f3b66611962..4f36f2a40c761c3c447dd7e441b10f905c806c7b 100644 (file)
--- a/src/zfs_arc.c
+++ b/src/zfs_arc.c
static void za_submit (const char* type, const char* type_instance, value_t* values, int values_len)
{
- value_list_t vl = VALUE_LIST_INIT;
+ value_list_t vl = VALUE_LIST_INIT (plugin_interval);
vl.values = values;
vl.values_len = values_len;
return (0);
} /* }}} int za_init */
-void module_register (void)
+void module_register (plugin_loaddata_t *data)
{
+ PLUGIN_INIT_INTERVAL (data);
plugin_register_init ("zfs_arc", za_init);
- plugin_register_read ("zfs_arc", za_read);
+ plugin_register_read ("zfs_arc", za_read, plugin_interval);
} /* void module_register */
/* vmi: set sw=8 noexpandtab fdm=marker : */