Monitoring Redis
Redis is recognised by its redis-server process, and the port comes from that process,
so an instance on a non-default port is found without configuration. The INFO probe
needs one credential stored on the host; the log collection starts on its own.
How Redis is recognised
The signed definition matches a host that runs a process named redis-server. Every
minute the agent reads the configuration file for facts (/etc/redis/redis.conf on Debian
and Ubuntu, /etc/redis.conf on RHEL-family systems) and sends one INFO command to the
port the server listens on, authenticating with the credential named redis-monitor. A
companion definition for logs runs every 30 seconds.
What is collected
Memory. Used memory, the configured maxmemory (0 when unlimited), the fragmentation
ratio, and the share of the limit in use. That share exists only where a limit is set;
without maxmemory the metric is absent rather than invented.
Clients and work. Connected clients, commands processed, keyspace hits and misses.
Trouble signals. Evicted keys and rejected connections are counters that only grow, so the agent also computes a per-minute rate for each on the host (and one for keyspace misses), which is what a rule can judge. The first cycle produces no rate, and a counter that drops after a server restart skips one cycle instead of printing a negative spike.
Facts shown on the host page: the log file named in the configuration.
| Signal | Metric |
|---|---|
| Connected clients | svc.redis.connected_clients |
| Memory used, the limit, share of the limit | svc.redis.used_memory, svc.redis.maxmemory, svc.redis.memory_used_pct |
| Fragmentation ratio | svc.redis.mem_fragmentation_ratio |
| Commands processed | svc.redis.total_commands_processed |
| Key lookups hit / missed | svc.redis.keyspace_hits, svc.redis.keyspace_misses |
| Misses per minute | svc.redis.keyspace_misses_per_min |
| Evicted keys, total and per minute | svc.redis.evicted_keys, svc.redis.evicted_keys_per_min |
| Rejected connections, total and per minute | svc.redis.rejected_connections, svc.redis.rejected_connections_per_min |
| Uptime | svc.redis.uptime |
Names and units are in the metrics reference.
Logs. The server log ships by default at notice level and above, from the journal
entries of redis-server and from the logfile the configuration names, where the level
is read from the one-character marker Redis prints on each line. See
Logs.
Alerts out of the box
| Rule | Fires when | Severity | Ships |
|---|---|---|---|
| Redis is close to its memory limit | memory in use is 90% or more of maxmemory for 10 minutes | warning | on |
| Redis is refusing connections | one or more connections rejected per minute, sustained 5 minutes | warning | on |
| Redis is evicting keys | one or more keys evicted per minute, sustained 10 minutes | warning | off |
The memory rule watches the share of the limit, so it arms only where a limit exists and
clears once usage is back under 80%. Rejected connections mean maxclients was reached
and clients were turned away, judged per minute rather than on a total that never goes
down. Evictions ship off because a cache filled to its limit evicts by design; switch the
rule on for a Redis that holds data you expect to keep. Thresholds and hysteresis are in
the rules catalog.
Credentials
The INFO probe authenticates with the credential named redis-monitor when it exists,
and connects without one otherwise, so a Redis with no password set is measured with
nothing to configure. For an ACL user, store the name and the password:
sudo wakora secret set redis-monitor --user monitor
For a server protected by requirepass alone, omit --user: a credential without a user
name (or with the user default) sends just the password. The value is stored encrypted
on the host, bound to that machine, and never sent anywhere. On a server that does require
authentication, the INFO check fails until the secret exists, with Redis's own error and
the name of the missing secret; the log collection does not depend on it. See
Secrets stay local.
When a path is not where Redis says it is
The log file path comes from the configuration file. To point the agent elsewhere:
sudo wakora --set redis.log-file=/var/log/redis/redis-server.log
Keys are listed in Agent configuration.
Limitations
- Without
maxmemorythere is nomemory_used_pct, and the memory rule stays unarmed. - The
INFOprobe does not run until theredis-monitorcredential is stored, even on a server that accepts unauthenticated connections. - The local connection is plain TCP; a server that listens only on a TLS port is not reached.
- One instance per host: a second
redis-serveron another port is not told apart. - Per-database key counts, replication state and persistence (RDB, AOF) are not collected.
- The log file fact is read from the two stock configuration paths only; a configuration elsewhere leaves the file side of log collection idle, the journal side still works.
Related
- Monitoring MySQL and MariaDB, Monitoring PostgreSQL
- Monitoring PHP-FPM for the application side of a cache-backed site
- Monitoring for hosting providers on the main site