summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 87768c5)
raw | patch | inline | side by side (parent: 87768c5)
author | Marc Fournier <marc.fournier@camptocamp.com> | |
Sat, 4 Apr 2015 20:26:34 +0000 (22:26 +0200) | ||
committer | Marc Fournier <marc.fournier@camptocamp.com> | |
Sat, 4 Apr 2015 20:26:34 +0000 (22:26 +0200) |
src/apache.c | patch | blob | history | |
src/collectd.conf.pod | patch | blob | history |
diff --git a/src/apache.c b/src/apache.c
index 1099248a24293485b8af3595793e03dbc1409fa4..9e91b8024f948f23a5c83328c828a51652481d01 100644 (file)
--- a/src/apache.c
+++ b/src/apache.c
char apache_curl_error[CURL_ERROR_SIZE];
size_t apache_buffer_size;
size_t apache_buffer_fill;
+ int timeout;
CURL *curl;
}; /* apache_s */
}
memset (st, 0, sizeof (*st));
+ st->timeout = -1;
+
status = cf_util_get_string (ci, &st->name);
if (status != 0)
{
status = cf_util_get_string (child, &st->cacert);
else if (strcasecmp ("Server", child->key) == 0)
status = cf_util_get_string (child, &st->server);
+ else if (strcasecmp ("Timeout", child->key) == 0)
+ status = cf_util_get_int (child, &st->timeout);
else
{
WARNING ("apache plugin: Option `%s' not allowed here.",
if (st->cacert != NULL)
curl_easy_setopt (st->curl, CURLOPT_CAINFO, st->cacert);
+ if (st->timeout >= 0)
+ curl_easy_setopt (st->curl, CURLOPT_TIMEOUT_MS, st->timeout);
+ else
+ curl_easy_setopt (st->curl, CURLOPT_TIMEOUT_MS,
+ CDTIME_T_TO_MS(plugin_get_interval()));
+
return (0);
} /* }}} int init_host */
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 35958b3385836e2226b9c6267c8d9c6b2d360910..07ef54f101222fba8bfc992832d54952d1a0c9dc 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
@@ -775,6 +775,12 @@ File that holds one or more SSL certificates. If you want to use HTTPS you will
possibly need this option. What CA certificates come bundled with C<libcurl>
and are checked by default depends on the distribution you use.
+=item B<Timeout> I<Milliseconds>
+
+The B<Timeout> option sets the overall timeout for HTTP requests, in
+milliseconds. By default, the configured B<Interval> is used to set the
+timeout.
+
=back
=head2 Plugin C<apcups>