summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4df7762)
raw | patch | inline | side by side (parent: 4df7762)
author | Florian Forster <octo@collectd.org> | |
Wed, 9 Jan 2013 10:18:34 +0000 (11:18 +0100) | ||
committer | Florian Forster <octo@collectd.org> | |
Wed, 9 Jan 2013 10:18:34 +0000 (11:18 +0100) |
src/riemann.c | patch | blob | history |
diff --git a/src/riemann.c b/src/riemann.c
index bc9b261c6d2df3676a6de14ae36d18a7320ce189..f14996828a41efcc209373f6733966cd6dafbe3a 100644 (file)
--- a/src/riemann.c
+++ b/src/riemann.c
const char *tags[RIEMANN_MAX_TAGS];
char service[DATA_MAX_NAME_LEN];
notification_meta_t *meta;
- struct {
+ struct {
int code;
char *name;
} severities[] = {
evtab[0] = &ev;
msg.n_events = 1;
msg.events = evtab;
-
+
ev.host = host->name;
ev.time = CDTIME_T_TO_TIME_T(n->time);
ev.has_time = 1;
ev.tags = (char **)tags;
tags[0] = n->plugin;
tags[1] = "notification";
-
+
for (i = 0; i < riemann_tagcount; i++)
tags[ev.n_tags++] = riemann_tags[i];
n->type, n->type_instance);
ev.service = service;
ev.description = (char *)n->message;
-
+
/*
* Pull in values from threshold
*/
- for (meta = n->meta;
+ for (meta = n->meta;
meta != NULL && strcasecmp(meta->name, "CurrentValue") != 0;
meta = meta->next)
;
ev.has_metric_d = 1;
ev.metric_d = meta->nm_value.nm_double;
}
-
+
return riemann_send(host, &msg);
}
DEBUG("riemann_write: %s ready to send", ev->service);
msg.events[i] = ev;
}
-
+
status = riemann_send(host, &msg);
sfree(msg.events);
return status;
if (host->flags & F_CONNECT)
return 0;
-
+
memset(&hints, 0, sizeof(hints));
memset(&service, 0, sizeof(service));
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_DGRAM;
ssnprintf(service, sizeof(service), "%d", host->port);
-
+
if ((e = getaddrinfo(host->name, service, &hints, &res)) != 0) {
WARNING("could not resolve host \"%s\": %s",
host->name, gai_strerror(e));
freeaddrinfo(res);
return 0;
}
-
+
if ((host->s = socket(ai->ai_family,
ai->ai_socktype,
ai->ai_protocol)) == -1) {
pthread_mutex_unlock(&host->lock);
break;
}
-
+
freeaddrinfo(res);
if (ai == NULL) {
WARNING("riemann_connect: no suitable hosts found");
DEBUG("riemann n_cb_name: %s", n_cb_name);
ud.data = host;
ud.free_func = riemann_free;
-
+
if ((status = plugin_register_write(w_cb_name, riemann_write, &ud)) != 0)
riemann_free(host);
return -1;
riemann_tags[riemann_tagcount++] = newtag;
DEBUG("riemann_config: got tag: %s", newtag);
-
+
} else {
WARNING ("riemann plugin: Ignoring unknown "
"configuration option \"%s\" at top level.",
module_register(void)
{
DEBUG("riemann: module_register");
-
+
plugin_register_complex_config ("riemann", riemann_config);
}