Port "6379"
Timeout 1000
Prefix "collectd/"
+ Database 1
</Node>
</Plugin>
C<ZRANGEBYSCORE> I<Redis> command. Additionnally, all the identifiers of these
I<Sorted Sets> are kept in a I<Set> called C<collectd/values> (or
C<${prefix}/values> if the B<Prefix> option was specified) and can be retrieved
-using the C<SMEMBERS> I<Redis> command. See
+using the C<SMEMBERS> I<Redis> command. You can specify the database to use
+with the B<Database> parameter (default is C<0>). See
L<http://redis.io/commands#sorted_set> and L<http://redis.io/commands#set> for
details.
like C<collectd/cpu-0/cpu-user>. When setting this to something different, it
is recommended but not required to include a trailing slash in I<Prefix>.
+=item B<Database> I<Index>
+
+This index selects the redis database to use for writing operations. Defaults to C<0>.
+
=back
=head2 Plugin C<write_riemann>
int port;
struct timeval timeout;
char *prefix;
+ int database;
redisContext *conn;
pthread_mutex_t lock;
pthread_mutex_unlock (&node->lock);
return (-1);
}
+
+ rr = redisCommand(node->conn, "SELECT %d", node->database);
+ if (rr == NULL)
+ WARNING("SELECT command error. database:%d message:%s", node->database, node->conn->errstr);
+ else
+ freeReplyObject (rr);
}
rr = redisCommand (node->conn, "ZADD %s %s %s", key, time, value);
node->timeout.tv_usec = 1000;
node->conn = NULL;
node->prefix = NULL;
+ node->database = 0;
pthread_mutex_init (&node->lock, /* attr = */ NULL);
status = cf_util_get_string_buffer (ci, node->name, sizeof (node->name));
else if (strcasecmp ("Prefix", child->key) == 0) {
status = cf_util_get_string (child, &node->prefix);
}
+ else if (strcasecmp ("Database", child->key) == 0) {
+ status = cf_util_get_int (child, &node->database);
+ }
else
WARNING ("write_redis plugin: Ignoring unknown config option \"%s\".",
child->key);