redis plugin¶
| Plugin name | redis |
| Type | read |
| Callbacks | config, read |
| Status | supported |
| Since | 5.0 |
| Copyright | 2010 Andrés J. Díaz |
| Configuration | collectd.conf(5) |
The Redis plugin connects to one or more instances of Redis, a key-value store, and collects usage information using the credis library.
Synopsis¶
Example graphs¶
None yet. Add one now!
Dependencies¶
- credis, C library implementing the redis protocol. The credis library is lagging support for current redis, and requires at least the following patch:
--- ../credis_2/credis-0.2.3/credis.c 2010-08-27 01:57:25.000000000 -0700
+++ ../credis-0.2.3/credis.c 2014-01-28 22:39:42.000000000 -0800
@@ -754,7 +754,7 @@
* first 1.1.0 release(?), e.g. stable releases 1.02 and 1.2.6 */
if (cr_sendfandreceive(rhnd, CR_BULK, "INFO\r\n") == 0) {
int items = sscanf(rhnd->reply.bulk,
- "redis_version:%d.%d.%d\r\n",
+ "# Server\r\nredis_version:%d.%d.%d\r\n",
&(rhnd->version.major),
&(rhnd->version.minor),
&(rhnd->version.patch));
- see brief notes on configuring this under ubuntu 14.04 1
- the following tips are useful when testing and troubleshooting
- use redis-cli ping to ensure you can connect to redis itself.
- use credis-test to see if your compiled credis is able to talk to redis itself. If this fails, the collectd plugin will also not work.
- use redis-cli monitor & to see what redis is receiving and sending itself.
- use sudo ngrep -texd lo port 6379 to see raw traffic goin to/from redis on the loopback adapter. You may need to use eth0 or similar depending on your setup. This may show up more information on why certain credis commands do not get through to redis itself.
Finally, users comfortable with compiling their own versions from scratch may want to follow the hiredis alternative mentioned in current issues 2
See also¶
- Redis project page on Google Project Hosting.
- Credis project page on Google Project Hosting.
- Plugin-exec-redis.sh
Configuration¶
Configuration options · from collectd.conf(5)
See this section in the full configuration reference
The Redis plugin connects to one or more Redis servers, gathers information about each server's state and executes user-defined queries. For each server there is a Node block which configures the connection parameters and set of user-defined queries for this node.
<Plugin redis>
<Node "example">
Host "localhost"
Port "6379"
#Socket "/var/run/redis/redis.sock"
Timeout 2000
ReportCommandStats false
ReportCpuUsage true
<Query "LLEN myqueue">
#Database 0
Type "queue_length"
Instance "myqueue"
</Query>
</Node>
</Plugin>
- Node Nodename
-
The Node block identifies a new Redis node, that is a new Redis instance running in an specified host and port. The name for node is a canonical identifier which is used as plugin instance. It is limited to 128E<nbsp>characters in length.
When no Node is configured explicitly, plugin connects to "localhost:6379".
- Host Hostname
- The Host option is the hostname or IP-address where the Redis instance is running on.
- Port Port
- The Port option is the TCP port on which the Redis instance accepts connections. Either a service name of a port number may be given. Please note that numerical port numbers must be given as a string, too.
- Socket Path
- Connect to Redis using the UNIX domain socket at Path. If this setting is given, the Hostname and Port settings are ignored.
- Password Password
- Use Password to authenticate when connecting to Redis.
- Timeout Milliseconds
-
The Timeout option set the socket timeout for node response. Since the Redis read function is blocking, you should keep this value as low as possible. It is expected what Timeout values should be lower than Interval defined globally.
Defaults to 2000 (2 seconds).
- ReportCommandStats false|true
- Enables or disables reporting of statistics based on the command type, including rate of command calls and average CPU time consumed by command processing. Defaults to false.
- ReportCpuUsage true|false
- Enables or disables reporting of CPU consumption statistics. Defaults to true.
- Query Querystring
- The Query block identifies a query to execute against the redis server. There may be an arbitrary number of queries to execute. Each query should return single string or integer.
- Type Collectd type
-
Within a query definition, a valid collectd type to use as when submitting the result of the query. When not supplied, will default to gauge.
Currently only types with one datasource are supported. See types.db(5) for more details on types and their configuration.
- Instance Type instance
- Within a query definition, an optional type instance to use when submitting the result of the query. When not supplied will default to the escaped command, up to 128 chars.
- Database Index
- This index selects the Redis logical database to use for query. Defaults to
0.