summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 60bcd47)
raw | patch | inline | side by side (parent: 60bcd47)
author | Jan Kundrát <jan.kundrat@cesnet.cz> | |
Wed, 25 Mar 2015 17:06:50 +0000 (18:06 +0100) | ||
committer | Jan Kundrát <jan.kundrat@cesnet.cz> | |
Wed, 1 Apr 2015 17:49:01 +0000 (19:49 +0200) |
There's apparently no need to init the config values in the `db` struct;
memset() is used earlier in the process. This patch doesn't change this
convention.
memset() is used earlier in the process. This patch doesn't change this
convention.
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 788ffd454f2c74b489378f81c01db4b8f8a8d663..6b76c9112e4428d1758b314897476ec30491da34 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
=item B<Header> I<Header>
=item B<Post> I<Body>
+=item B<Timeout> I<Timeout in miliseconds>
These options behave exactly equivalent to the appropriate options of the
I<cURL> plugin. Please see there for a detailed description.
diff --git a/src/curl_json.c b/src/curl_json.c
index 09db7866fa8bdbc3465184c6820e38e3a94ee868..4cd4aec91d5155b08339d1a4c6ca72cc68325e47 100644 (file)
--- a/src/curl_json.c
+++ b/src/curl_json.c
struct curl_slist *headers;
char *post_body;
cdtime_t interval;
+ int timeout;
CURL *curl;
char curl_errbuf[CURL_ERROR_SIZE];
curl_easy_setopt (db->curl, CURLOPT_HTTPHEADER, db->headers);
if (db->post_body != NULL)
curl_easy_setopt (db->curl, CURLOPT_POSTFIELDS, db->post_body);
+ curl_easy_setopt (db->curl, CURLOPT_TIMEOUT_MS,
+ db->timeout > 0 ?
+ db->timeout :
+ ( db->interval > 0 ? db->interval : cf_get_default_interval () ));
return (0);
} /* }}} int cj_init_curl */
status = cj_config_add_key (db, child);
else if (strcasecmp ("Interval", child->key) == 0)
status = cf_util_get_cdtime(child, &db->interval);
+ else if (strcasecmp ("Timeout", child->key) == 0)
+ status = cf_util_get_int (child, &db->timeout);
else
{
WARNING ("curl_json plugin: Option `%s' not allowed here.", child->key);