summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 95c7f3d)
raw | patch | inline | side by side (parent: 95c7f3d)
author | Florian Forster <octo@collectd.org> | |
Wed, 23 Jan 2013 07:30:19 +0000 (08:30 +0100) | ||
committer | Florian Forster <octo@collectd.org> | |
Wed, 23 Jan 2013 07:30:19 +0000 (08:30 +0100) |
src/collectd.conf.in | patch | blob | history | |
src/collectd.conf.pod | patch | blob | history | |
src/write_riemann.c | patch | blob | history |
diff --git a/src/collectd.conf.in b/src/collectd.conf.in
index 12891fb6e7d97172b7955ceaf6f77af5dfd6848a..9f0390e4451623693bd3a5753861b87c59428d1d 100644 (file)
--- a/src/collectd.conf.in
+++ b/src/collectd.conf.in
# Host "localhost"
# Port 5555
# StoreRates true
+# AlwaysAppendDS false
# </Node>
# Tag "foobar"
#</Plugin>
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index b7bebf6d2fc25d712a4427c83c3dee791fed3478..5ada55ab6569dff9158efad7f8cb6271ee1c0bd2 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
converted values will have "rate" appended to the data source type, e.g.
C<ds_type:derive:rate>.
+=item B<AlwaysAppendDS> B<false>|B<true>
+
+If set the B<true>, append the name of the I<Data Source> (DS) to the
+"service", i.e. the field that, together with the "host" field, uniquely
+identifies a metric in I<Riemann>. If set to B<false> (the default), this is
+only done when there is more than one DS.
+
=back
=item B<Tag> I<String>
diff --git a/src/write_riemann.c b/src/write_riemann.c
index e7b3eb4acfbc0b70cc21655c3be48af735d4120a..62d75f3662c6ef117f9cd504d5084a2aaecd740c 100644 (file)
--- a/src/write_riemann.c
+++ b/src/write_riemann.c
uint8_t flags;
pthread_mutex_t lock;
_Bool store_rates;
+ _Bool always_append_ds;
char *node;
char *service;
int s;
@@ -332,7 +333,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,
vl->type, vl->type_instance);
- if (ds->ds_num > 1)
+ if (host->always_append_ds || (ds->ds_num > 1))
ssnprintf (service_buffer, sizeof (service_buffer),
"%s/%s", &name_buffer[1], ds->ds[index].name);
else
host->node = NULL;
host->service = NULL;
host->store_rates = 1;
+ host->always_append_ds = 0;
status = cf_util_get_string (ci, &host->name);
if (status != 0) {
status = cf_util_get_boolean (child, &host->store_rates);
if (status != 0)
break;
+ } else if (strcasecmp ("AlwaysAppendDS", child->key) == 0) {
+ status = cf_util_get_boolean (child,
+ &host->always_append_ds);
+ if (status != 0)
+ break;
} else {
WARNING("write_riemann plugin: ignoring unknown config "
"option: \"%s\"", child->key);