X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fwrite_riemann.c;h=93bf85340027658392fc56ef79545e7683201a8c;hb=f19159854c272e5a8bb9f6915c456cf3a0f2d20e;hp=a09c72361f910ac8615a219fd9187da36e77a819;hpb=4c88746c9a916eb93f2ea4a2d83edd803b7ec06c;p=collectd.git diff --git a/src/write_riemann.c b/src/write_riemann.c index a09c7236..93bf8534 100644 --- a/src/write_riemann.c +++ b/src/write_riemann.c @@ -778,35 +778,33 @@ static int riemann_notification(const notification_t *n, user_data_t *ud) /* {{{ } /* }}} int riemann_notification */ static int riemann_write(const data_set_t *ds, /* {{{ */ - const value_list_t *vl, - user_data_t *ud) + const value_list_t *vl, + user_data_t *ud) { int status = 0; int statuses[vl->values_len]; struct riemann_host *host = ud->data; - Msg *msg; - - if (host->check_thresholds) - write_riemann_threshold_check(ds, vl, statuses); - - if (host->use_tcp == 1 && host->batch_mode) { - - riemann_batch_add_value_list (host, ds, vl, statuses); + if (host->check_thresholds) { + status = write_riemann_threshold_check(ds, vl, statuses); + if (status != 0) + return status; + } - } else { + if (host->use_tcp == 1 && host->batch_mode) { + riemann_batch_add_value_list (host, ds, vl, statuses); + } else { + Msg *msg = riemann_value_list_to_protobuf (host, ds, vl, statuses); + if (msg == NULL) + return (-1); - msg = riemann_value_list_to_protobuf (host, ds, vl, statuses); - if (msg == NULL) - return (-1); + status = riemann_send (host, msg); + if (status != 0) + ERROR ("write_riemann plugin: riemann_send failed with status %i", status); - status = riemann_send (host, msg); - if (status != 0) - ERROR ("write_riemann plugin: riemann_send failed with status %i", - status); + riemann_msg_protobuf_free (msg); + } - riemann_msg_protobuf_free (msg); - } return status; } /* }}} int riemann_write */