From: ~/.gitconfig Date: Wed, 13 Aug 2014 12:06:43 +0000 (+0300) Subject: add the prefix feature to the src X-Git-Tag: collectd-5.5.0~219^2~9 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=96708a7981cdd5ea092d5b42f19ba3784cc9d8c7;p=collectd.git add the prefix feature to the src --- diff --git a/src/write_riemann.c b/src/write_riemann.c index 78f01c05..56752124 100644 --- a/src/write_riemann.c +++ b/src/write_riemann.c @@ -48,6 +48,7 @@ int write_riemann_threshold_check(const data_set_t *, const value_list_t *, int struct riemann_host { char *name; + char *prefix; #define F_CONNECT 0x01 uint8_t flags; pthread_mutex_t lock; @@ -430,7 +431,7 @@ static Msg *riemann_notification_to_protobuf (struct riemann_host *host, /* {{{ riemann_event_add_tag (event, riemann_tags[i]); format_name (service_buffer, sizeof (service_buffer), - /* host = */ "", n->plugin, n->plugin_instance, + /* host = */ host->prefix, n->plugin, n->plugin_instance, n->type, n->type_instance); event->service = strdup (&service_buffer[1]); @@ -566,7 +567,7 @@ static Event *riemann_value_to_protobuf (struct riemann_host const *host, /* {{{ } format_name (name_buffer, sizeof (name_buffer), - /* host = */ "", vl->plugin, vl->plugin_instance, + /* host = */ host->prefix, vl->plugin, vl->plugin_instance, vl->type, vl->type_instance); if (host->always_append_ds || (ds->ds_num > 1)) ssnprintf (service_buffer, sizeof (service_buffer), @@ -755,6 +756,9 @@ static int riemann_config_node(oconfig_item_t *ci) /* {{{ */ status = cf_util_get_boolean(child, &host->notifications); if (status != 0) break; + } else if (strcasecmp ("Prefix", child->key) == 0) { + status = cf_util_get_string (child, &host->prefix); + break; } else if (strcasecmp ("CheckThresholds", child->key) == 0) { status = cf_util_get_boolean(child, &host->check_thresholds); if (status != 0)