From: John-John Tedro Date: Mon, 2 Sep 2013 21:53:34 +0000 (+0000) Subject: write_riemann: Add extra meta strings as attributes in notifications X-Git-Tag: collectd-5.5.0~342^2 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=28088a38826a276541a6e729c1752d6cb9b538d0;p=collectd.git write_riemann: Add extra meta strings as attributes in notifications --- diff --git a/src/write_riemann.c b/src/write_riemann.c index 3345d044..42e11f9d 100644 --- a/src/write_riemann.c +++ b/src/write_riemann.c @@ -353,15 +353,20 @@ static Msg *riemann_notification_to_protobuf (struct riemann_host *host, /* {{{ n->type, n->type_instance); event->service = strdup (&service_buffer[1]); - /* Pull in values from threshold */ + /* Pull in values from threshold and add extra attributes */ for (meta = n->meta; meta != NULL; meta = meta->next) { - if (strcasecmp ("CurrentValue", meta->name) != 0) + if (strcasecmp ("CurrentValue", meta->name) == 0 && meta->type == NM_TYPE_DOUBLE) + { + event->metric_d = meta->nm_value.nm_double; + event->has_metric_d = 1; continue; + } - event->metric_d = meta->nm_value.nm_double; - event->has_metric_d = 1; - break; + if (meta->type == NM_TYPE_STRING) { + riemann_event_add_attribute (event, meta->name, meta->nm_value.nm_string); + continue; + } } DEBUG ("write_riemann plugin: Successfully created protobuf for notification: "