From: Florian Forster Date: Tue, 17 Aug 2010 14:45:42 +0000 (+0200) Subject: write_redis plugin: Add all identifiers to a "set". X-Git-Tag: collectd-5.0.0-beta0~50^2^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3e2a37d253db4eb286445e696029506c1bcec34a;p=collectd.git write_redis plugin: Add all identifiers to a "set". This should make it easy for front-ends to discover available metrics. --- diff --git a/src/write_redis.c b/src/write_redis.c index c995a906..58f2cae3 100644 --- a/src/write_redis.c +++ b/src/write_redis.c @@ -53,6 +53,7 @@ static int wr_write (const data_set_t *ds, /* {{{ */ user_data_t *ud) { wr_node_t *node = ud->data; + char ident[512]; char key[512]; char value[512]; size_t value_size; @@ -60,10 +61,10 @@ static int wr_write (const data_set_t *ds, /* {{{ */ int status; int i; - status = FORMAT_VL (value, sizeof (value), vl); + status = FORMAT_VL (ident, sizeof (ident), vl); if (status != 0) return (status); - ssnprintf (key, sizeof (key), "collectd/%s", value); + ssnprintf (key, sizeof (key), "collectd/%s", ident); memset (value, 0, sizeof (value)); value_size = sizeof (value); @@ -120,6 +121,8 @@ static int wr_write (const data_set_t *ds, /* {{{ */ assert (node->conn != NULL); status = credis_zadd (node->conn, key, (double) vl->time, value); + credis_sadd (node->conn, "collectd/values", ident); + pthread_mutex_unlock (&node->lock); return (0);