AC_PLUGIN([fscache], [$plugin_fscache], [fscache statistics])
AC_PLUGIN([gmond], [$with_libganglia], [Ganglia plugin])
AC_PLUGIN([hddtemp], [yes], [Query hddtempd])
-AC_PLUGIN([http], [$with_libcurl], [HTTP output plugin])
AC_PLUGIN([interface], [$plugin_interface], [Interface traffic statistics])
AC_PLUGIN([ipmi], [$plugin_ipmi], [IPMI sensor statistics])
AC_PLUGIN([iptables], [$with_libiptc], [IPTables rule counters])
AC_PLUGIN([vmem], [$plugin_vmem], [Virtual memory statistics])
AC_PLUGIN([vserver], [$plugin_vserver], [Linux VServer statistics])
AC_PLUGIN([wireless], [$plugin_wireless], [Wireless statistics])
+AC_PLUGIN([write_http], [$with_libcurl], [HTTP output plugin])
AC_PLUGIN([xmms], [$with_libxmms], [XMMS statistics])
dnl Default configuration file
fscache . . . . . . . $enable_fscache
gmond . . . . . . . . $enable_gmond
hddtemp . . . . . . . $enable_hddtemp
- http . . . . . . . . $enable_http
interface . . . . . . $enable_interface
ipmi . . . . . . . . $enable_ipmi
iptables . . . . . . $enable_iptables
vmem . . . . . . . . $enable_vmem
vserver . . . . . . . $enable_vserver
wireless . . . . . . $enable_wireless
+ write_http . . . . . $enable_write_http
xmms . . . . . . . . $enable_xmms
EOF
/**
- * collectd - src/http.c
+ * collectd - src/write_http.c
* Copyright (C) 2009 Paul Sadauskas
- * Copyright (C) 2007-2009 Florian octo Forster
* Copyright (C) 2009 Doug MacEachern
+ * Copyright (C) 2007-2009 Florian octo Forster
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
static pthread_mutex_t send_lock = PTHREAD_MUTEX_INITIALIZER;
-static void http_init_buffer (void) /* {{{ */
+static void wh_init_buffer (void) /* {{{ */
{
memset (send_buffer, 0, sizeof (send_buffer));
send_buffer_free = sizeof (send_buffer);
send_buffer_fill = 0;
send_buffer_init_time = time (NULL);
-} /* }}} http_init_buffer */
+} /* }}} wh_init_buffer */
-static int http_init(void) /* {{{ */
+static int wh_init(void) /* {{{ */
{
curl = curl_easy_init ();
curl_easy_setopt (curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
}
- http_init_buffer ();
+ wh_init_buffer ();
return (0);
} /* }}} */
-static int http_value_list_to_string (char *buffer, /* {{{ */
+static int wh_value_list_to_string (char *buffer, /* {{{ */
size_t buffer_size,
const data_set_t *ds, const value_list_t *vl)
{
BUFFER_ADD (":%"PRIu64, vl->values[i].absolute);
else
{
- ERROR ("http plugin: Unknown data source type: %i",
+ ERROR ("write_http plugin: Unknown data source type: %i",
ds->ds[i].type);
return (-1);
}
#undef BUFFER_ADD
return (0);
-} /* }}} int http_value_list_to_string */
+} /* }}} int wh_value_list_to_string */
-static int http_config (const char *key, const char *value) /* {{{ */
+static int wh_config (const char *key, const char *value) /* {{{ */
{
if (strcasecmp ("URL", key) == 0)
{
return (-1);
}
return (0);
-} /* }}} int http_config */
+} /* }}} int wh_config */
-static int http_send_buffer (char *buffer) /* {{{ */
+static int wh_send_buffer (char *buffer) /* {{{ */
{
int status = 0;
status = curl_easy_perform (curl);
if (status != 0)
{
- ERROR ("http plugin: curl_easy_perform failed with staus %i: %s",
+ ERROR ("write_http plugin: curl_easy_perform failed with "
+ "staus %i: %s",
status, curl_errbuf);
}
return (status);
-} /* }}} http_send_buffer */
+} /* }}} wh_send_buffer */
-static int http_flush_nolock (int timeout) /* {{{ */
+static int wh_flush_nolock (int timeout) /* {{{ */
{
int status;
- DEBUG ("http plugin: http_flush_nolock: timeout = %i; "
+ DEBUG ("write_http plugin: wh_flush_nolock: timeout = %i; "
"send_buffer =\n %s", timeout, send_buffer);
if (timeout > 0)
return (0);
}
- status = http_send_buffer (send_buffer);
- http_init_buffer ();
+ status = wh_send_buffer (send_buffer);
+ wh_init_buffer ();
return (status);
-} /* }}} http_flush_nolock */
+} /* }}} wh_flush_nolock */
-static int http_flush (int timeout, /* {{{ */
+static int wh_flush (int timeout, /* {{{ */
const char *identifier __attribute__((unused)),
user_data_t *user_data __attribute__((unused)))
{
int status;
pthread_mutex_lock (&send_lock);
- status = http_flush_nolock (timeout);
+ status = wh_flush_nolock (timeout);
pthread_mutex_unlock (&send_lock);
return (status);
-} /* }}} int http_flush */
+} /* }}} int wh_flush */
-static int http_write_command (const data_set_t *ds, const value_list_t *vl) /* {{{ */
+static int wh_write_command (const data_set_t *ds, const value_list_t *vl) /* {{{ */
{
char key[10*DATA_MAX_NAME_LEN];
char values[512];
int status;
if (0 != strcmp (ds->type, vl->type)) {
- ERROR ("http plugin: DS type does not match value list type");
+ ERROR ("write_http plugin: DS type does not match "
+ "value list type");
return -1;
}
/* Copy the identifier to `key' and escape it. */
status = FORMAT_VL (key, sizeof (key), vl);
if (status != 0) {
- ERROR ("http plugin: error with format_name");
+ ERROR ("write_http plugin: error with format_name");
return (status);
}
escape_string (key, sizeof (key));
/* Convert the values to an ASCII representation and put that into
* `values'. */
- status = http_value_list_to_string (values, sizeof (values), ds, vl);
+ status = wh_value_list_to_string (values, sizeof (values), ds, vl);
if (status != 0) {
- ERROR ("http plugin: error with http_value_list_to_string");
+ ERROR ("write_http plugin: error with "
+ "wh_value_list_to_string");
return (status);
}
"PUTVAL %s interval=%i %s\n",
key, vl->interval, values);
if (command_len >= sizeof (command)) {
- ERROR ("http plugin: Command buffer too small: "
+ ERROR ("write_http plugin: Command buffer too small: "
"Need %zu bytes.", command_len + 1);
return (-1);
}
/* Check if we have enough space for this command. */
if (command_len >= send_buffer_free)
{
- status = http_flush_nolock (/* timeout = */ -1);
+ status = wh_flush_nolock (/* timeout = */ -1);
if (status != 0)
{
pthread_mutex_unlock (&send_lock);
pthread_mutex_unlock (&send_lock);
return (0);
-} /* }}} int http_write_command */
+} /* }}} int wh_write_command */
-static int http_write (const data_set_t *ds, const value_list_t *vl, /* {{{ */
+static int wh_write (const data_set_t *ds, const value_list_t *vl, /* {{{ */
user_data_t __attribute__((unused)) *user_data)
{
int status;
- status = http_write_command (ds, vl);
+ status = wh_write_command (ds, vl);
return (status);
-} /* }}} int http_write */
+} /* }}} int wh_write */
-static int http_shutdown (void) /* {{{ */
+static int wh_shutdown (void) /* {{{ */
{
- http_flush_nolock (/* timeout = */ -1);
+ wh_flush_nolock (/* timeout = */ -1);
curl_easy_cleanup(curl);
return (0);
-} /* }}} int http_shutdown */
+} /* }}} int wh_shutdown */
void module_register (void) /* {{{ */
{
- plugin_register_init("http", http_init);
- plugin_register_config ("http", http_config,
+ plugin_register_init("write_http", wh_init);
+ plugin_register_config ("write_http", wh_config,
config_keys, config_keys_num);
- plugin_register_write ("http", http_write, /* user_data = */ NULL);
- plugin_register_flush ("http", http_flush, /* user_data = */ NULL);
- plugin_register_shutdown("http", http_shutdown);
+ plugin_register_write ("write_http", wh_write, /* user_data = */ NULL);
+ plugin_register_flush ("write_http", wh_flush, /* user_data = */ NULL);
+ plugin_register_shutdown("write_http", wh_shutdown);
} /* }}} void module_register */
/* vim: set fdm=marker sw=8 ts=8 tw=78 et : */