pkglib_LTLIBRARIES += write_http.la
write_http_la_SOURCES = \
src/write_http.c \
+ src/utils/curl_stats/curl_stats.c \
+ src/utils/curl_stats/curl_stats.h \
src/utils/format_kairosdb/format_kairosdb.c \
src/utils/format_kairosdb/format_kairosdb.h
write_http_la_CFLAGS = $(AM_CFLAGS) $(BUILD_WITH_LIBCURL_CFLAGS)
slightly below this interval, which you can estimate by monitoring the network
traffic between collectd and the HTTP server.
+=item B<E<lt>StatisticsE<gt>>
+
+One B<Statistics> block can be used to specify cURL statistics to be collected
+for each request to the remote URL. See the section "cURL Statistics" above
+for details.
+
=back
=head2 Plugin C<write_kafka>
#include "plugin.h"
#include "utils/common/common.h"
+#include "utils/curl_stats/curl_stats.h"
#include "utils/format_json/format_json.h"
#include "utils/format_kairosdb/format_kairosdb.h"
bool send_notifications;
CURL *curl;
+ curl_stats_t *curl_stats;
struct curl_slist *headers;
char curl_errbuf[CURL_ERROR_SIZE];
wh_log_http_error(cb);
+ if (cb->curl_stats != NULL)
+ curl_stats_dispatch(cb->curl_stats, cb->curl, NULL, "write_http", cb->name);
+
if (status != CURLE_OK) {
ERROR("write_http plugin: curl_easy_perform failed with "
"status %i: %s",
cb->curl = NULL;
}
+ curl_stats_destroy(cb->curl_stats);
+
if (cb->headers != NULL) {
curl_slist_free_all(cb->headers);
cb->headers = NULL;
cb->send_notifications = false;
cb->data_ttl = 0;
cb->metrics_prefix = strdup(WRITE_HTTP_DEFAULT_PREFIX);
+ cb->curl_stats = NULL;
if (cb->metrics_prefix == NULL) {
ERROR("write_http plugin: strdup failed.");
status = config_set_format(cb, child);
else if (strcasecmp("Metrics", child->key) == 0)
cf_util_get_boolean(child, &cb->send_metrics);
- else if (strcasecmp("Notifications", child->key) == 0)
+ else if (strcasecmp("Statistics", child->key) == 0) {
+ cb->curl_stats = curl_stats_from_config(child);
+ if (cb->curl_stats == NULL)
+ status = -1;
+ } else if (strcasecmp("Notifications", child->key) == 0)
cf_util_get_boolean(child, &cb->send_notifications);
else if (strcasecmp("StoreRates", child->key) == 0)
status = cf_util_get_boolean(child, &cb->store_rates);