summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7201bb0)
raw | patch | inline | side by side (parent: 7201bb0)
author | Pierre-Yves Ritschard <pyr@spootnik.org> | |
Wed, 13 Apr 2016 20:59:51 +0000 (22:59 +0200) | ||
committer | Pierre-Yves Ritschard <pyr@spootnik.org> | |
Wed, 13 Apr 2016 20:59:51 +0000 (22:59 +0200) |
src/daemon/utils_complain.c | patch | blob | history | |
src/write_riemann.c | patch | blob | history |
index 6193614940e34570265cff661c9517f38b349318..1cf6c3aa14aed420bca416b9dfb1e9c41a3c9f84 100644 (file)
} /* c_release */
/* vim: set sw=4 ts=4 tw=78 noexpandtab : */
-
diff --git a/src/write_riemann.c b/src/write_riemann.c
index 63e89186cb3eb45a7a741304d0745851b0886317..fd82650e779931d43b68e2544712d9b33445e175 100644 (file)
--- a/src/write_riemann.c
+++ b/src/write_riemann.c
#include "common.h"
#include "configfile.h"
#include "utils_cache.h"
+#include "utils_complain.h"
#include "write_riemann_threshold.h"
#define RIEMANN_HOST "localhost"
_Bool always_append_ds;
char *node;
int port;
+ c_complain_t init_complaint;
+ c_complain_t init_send_complaint;
riemann_client_type_t client_type;
riemann_client_t *client;
double ttl_factor;
RIEMANN_CLIENT_OPTION_TLS_KEY_FILE, host->tls_key_file,
RIEMANN_CLIENT_OPTION_NONE);
if (host->client == NULL) {
- WARNING("write_riemann plugin: Unable to connect to Riemann at %s:%d",
- node, port);
+ c_complain (LOG_ERR, &host->init_complaint,
+ "write_riemann plugin: Unable to connect to Riemann at %s:%d",
+ node, port);
return -1;
}
if (host->timeout.tv_sec != 0) {
if (riemann_client_set_timeout(host->client, &host->timeout) != 0) {
riemann_client_free(host->client);
host->client = NULL;
- WARNING("write_riemann plugin: Unable to connect to Riemann at %s:%d",
- node, port);
+ c_complain (LOG_ERR, &host->init_complaint,
+ "write_riemann plugin: Unable to connect to Riemann at %s:%d",
+ node, port);
return -1;
}
}
- DEBUG("write_riemann plugin: got a successful connection for: %s:%d",
- node, port);
+
+ c_release (LOG_INFO, &host->init_complaint,
+ "write_riemann plugin: Successfully connected to %s:%d",
+ node, port);
return 0;
} /* }}} int wrr_connect */
pthread_mutex_lock(&host->lock);
status = wrr_batch_flush_nolock(timeout, host);
if (status != 0)
- ERROR("write_riemann plugin: riemann_client_send failed with status %i",
- status);
+ c_complain (LOG_ERR, &host->init_complaint,
+ "write_riemann plugin: riemann_client_send failed with status %i",
+ status);
+ else
+ c_release (LOG_DEBUG, &host->init_complaint, "write_riemann plugin: batch sent.");
pthread_mutex_unlock(&host->lock);
return status;
@@ -561,8 +571,12 @@ static int wrr_notification(const notification_t *n, user_data_t *ud) /* {{{ */
status = wrr_send(host, msg);
if (status != 0)
- ERROR("write_riemann plugin: riemann_client_send failed with status %i",
- status);
+ c_complain (LOG_ERR, &host->init_complaint,
+ "write_riemann plugin: riemann_client_send failed with status %i",
+ status);
+ else
+ c_release (LOG_DEBUG, &host->init_complaint,
+ "write_riemann plugin: riemann_client_send succeeded");
riemann_message_free(msg);
return (status);
return (-1);
status = wrr_send(host, msg);
- if (status != 0)
- ERROR("write_riemann plugin: riemann_client_send failed with status %i",
- status);
riemann_message_free(msg);
}
return ENOMEM;
}
pthread_mutex_init(&host->lock, NULL);
+ C_COMPLAIN_INIT (&host->init_complaint);
host->reference_count = 1;
host->node = NULL;
host->port = 0;