summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d82c71c)
raw | patch | inline | side by side (parent: d82c71c)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Wed, 4 Aug 2010 17:00:50 +0000 (19:00 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Wed, 4 Aug 2010 17:00:50 +0000 (19:00 +0200) |
src/amqp.c | patch | blob | history | |
src/collectd.conf.in | patch | blob | history |
diff --git a/src/amqp.c b/src/amqp.c
index 55066351ab0b1332c2cef698438d463f81dd4f8d..489936484c0fddbce178f7a3c91d1ac2e1cd7e8d 100644 (file)
--- a/src/amqp.c
+++ b/src/amqp.c
@@ -113,9 +113,11 @@ static int amqp_write(const data_set_t *ds, const value_list_t *vl, user_data_t
amqp_connection_state_t conn;
amqp_basic_properties_t props;
+ /* TODO: Don't create a new connection for each value that is to be dispatched. */
conn = amqp_new_connection();
if ((sockfd = amqp_open_socket(host, port)) < 0)
{
+ ERROR ("amqp plugin: amqp_open_socket failed.");
amqp_destroy_connection(conn);
return (1);
}
/* authentication: */ AMQP_SASL_METHOD_PLAIN, user, password);
if (reply.reply_type != AMQP_RESPONSE_NORMAL)
{
+ ERROR ("amqp plugin: amqp_login (vhost = %s, user = %s) failed.",
+ vhost, user);
amqp_destroy_connection(conn);
close(sockfd);
return (1);
amqp_channel_open(conn, 1);
if (reply.reply_type != AMQP_RESPONSE_NORMAL)
{
+ ERROR ("amqp plugin: amqp_channel_open failed.");
amqp_connection_close(conn, AMQP_REPLY_SUCCESS);
amqp_destroy_connection(conn);
close(sockfd);
@@ -159,6 +164,12 @@ static int amqp_write(const data_set_t *ds, const value_list_t *vl, user_data_t
/* immediate = */ 0,
&props,
amqp_cstring_bytes(buffer));
+ if (error != 0)
+ {
+ ERROR ("amqp plugin: amqp_basic_publish failed with status %i.",
+ error);
+ }
+
reply = amqp_channel_close(conn, 1, AMQP_REPLY_SUCCESS);
if (reply.reply_type != AMQP_RESPONSE_NORMAL)
error = 1;
diff --git a/src/collectd.conf.in b/src/collectd.conf.in
index 03d80ae8a6b35dbe3ba8d587d4b37cfca1956a55..85f79d6729f6f2ea891d372c8ab4c45e58bd6e74 100644 (file)
--- a/src/collectd.conf.in
+++ b/src/collectd.conf.in
##############################################################################
#<Plugin "amqp">
-# Host "host"
+# Host "localhost"
# Port "5672"
-# VHost "vhost"
+# VHost "/"
# User "collectd"
# Password "aiwaeZ0y"
-# Exchange "exchange"
+# Exchange "amq.direct"
# RoutingKey "routing_key"
#</Plugin>