Sets the plugin instance to I<Instance>.
+=item B<Interval> I<Interval>
+
+Sets the interval (in seconds) in which the values will be collected from this
+URL. By default the global B<Interval> setting will be used.
+
=item B<User> I<Name>
=item B<Password> I<Password>
char *cacert;
struct curl_slist *headers;
char *post_body;
+ cdtime_t interval;
CURL *curl;
char curl_errbuf[CURL_ERROR_SIZE];
status = cf_util_get_string (child, &db->post_body);
else if (strcasecmp ("Key", child->key) == 0)
status = cj_config_add_key (db, child);
+ else if (strcasecmp ("Interval", child->key) == 0)
+ status = cf_util_get_cdtime(child, &db->interval);
else
{
WARNING ("curl_json plugin: Option `%s' not allowed here.", child->key);
{
user_data_t ud;
char cb_name[DATA_MAX_NAME_LEN];
+ struct timespec interval = { 0, 0 };
+
+ CDTIME_T_TO_TIMESPEC (db->interval, &interval);
if (db->instance == NULL)
db->instance = strdup("default");
db->instance, db->url ? db->url : db->sock);
plugin_register_complex_read (/* group = */ NULL, cb_name, cj_read,
- /* interval = */ NULL, &ud);
+ /* interval = */ (db->interval > 0) ? &interval : NULL,
+ &ud);
}
else
{
sstrncpy (vl.plugin_instance, db->instance, sizeof (vl.plugin_instance));
sstrncpy (vl.type, key->type, sizeof (vl.type));
+ if (db->interval > 0)
+ vl.interval = db->interval;
+
plugin_dispatch_values (&vl);
} /* }}} int cj_submit */