summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 510eb02)
raw | patch | inline | side by side (parent: 510eb02)
author | Stan Sawa <stan.sawa@unrulymedia.com> | |
Wed, 18 Sep 2013 14:24:06 +0000 (15:24 +0100) | ||
committer | Stan <stan@unrulymedia.com> | |
Wed, 30 Jul 2014 09:53:58 +0000 (10:53 +0100) |
src/collectd.conf.pod | patch | blob | history | |
src/curl_json.c | patch | blob | history |
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index a86df33567ec002ff4897d35c9f3a834fba2588c..0e808bb0529d765843de9147193f3a88d9ea2932 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
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>
diff --git a/src/curl_json.c b/src/curl_json.c
index 029c80277f4321d1d6661fb4b2dd6fcb1d1d1b10..6a01590217883d985ee7098934d6387ed1cdee54 100644 (file)
--- a/src/curl_json.c
+++ b/src/curl_json.c
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 */