Skip to content

Check redis-status

Overview

Monitors a Redis server via the INFO command, reporting memory usage, fragmentation ratio, keyspace hit rate, connected clients, replication status, and persistence state. Alerts on memory consumption, high fragmentation, low hit rates, and OS-level misconfigurations such as overcommit and transparent huge pages. Includes Redis Memory Doctor diagnostics when available.

Important Notes:

  • Tested on Redis 3.0+
  • Requires the redis-cli command-line tool
  • The *_per_second and cpu_* metrics are rates between two check runs, kept per server, so they appear from the second run on and are missing for one run after a restart of Redis
  • --verbose appends the INFO answer below the result, one field per line
  • "I'm here to keep you safe, Sam. I want to help you." comes from the character GERTY in the movie "Moon" (2009)

Data Collection:

  • Executes redis-cli info default and redis-cli memory doctor against the target Redis instance
  • Connects via hostname/port (default: 127.0.0.1:6379) or Unix socket
  • Supports authentication (username/password) and TLS connections
  • Reads OS-level settings from /proc/sys/vm/overcommit_memory, /sys/kernel/mm/transparent_hugepage/enabled, /proc/sys/net/core/somaxconn, and /proc/sys/net/ipv4/tcp_max_syn_backlog

Fact Sheet

Fact Value
Check Plugin Download https://github.com/Linuxfabrik/monitoring-plugins/tree/main/check-plugins/redis-status
Nagios/Icinga Check Name check_redis_status
Check Interval Recommendation Every minute
Can be called without parameters Yes
Runs on Linux
Compiled for Windows No
Requirements command-line tool redis-cli
Uses State File $TEMP/linuxfabrik-monitoring-plugins-redis-status.db

Help

usage: redis-status [-h] [-V] [--always-ok] [--cacert CACERT] [-c CRIT]
                    [-H HOSTNAME] [--ignore-maxmemory0] [--ignore-overcommit]
                    [--ignore-somaxconn] [--ignore-sync-partial-err]
                    [--ignore-thp] [--no-perfdata] [-p PASSWORD] [--port PORT]
                    [--socket SOCKET] [--timeout TIMEOUT] [--tls]
                    [--username USERNAME] [--verbose] [-w WARN]

Monitors a Redis server via the INFO command. Reports memory usage,
fragmentation ratio, keyspace hit rate, connected clients, replication status,
and persistence state. Alerts on memory consumption, high fragmentation, low
hit rates, and OS-level misconfigurations such as overcommit and transparent
huge pages. Includes Redis Memory Doctor diagnostics when available.

options:
  -h, --help            show this help message and exit
  -V, --version         show program's version number and exit
  --always-ok           Always returns OK.
  --cacert CACERT       CA certificate file for TLS verification. Requires
                        `--tls`. Default: /etc/pki/tls/certs/rootCA.pem
  -c, --critical CRIT   CRIT threshold for memory usage as a percentage.
                        Default: >= None
  -H, --hostname HOSTNAME
                        Redis server hostname. Default: 127.0.0.1
  --ignore-maxmemory0   Suppress the warning when Redis maxmemory is set to 0
                        (unlimited).
  --ignore-overcommit   Suppress the warning when vm.overcommit_memory is not
                        set to 1.
  --ignore-somaxconn    Suppress the warning when net.core.somaxconn is lower
                        than net.ipv4.tcp_max_syn_backlog.
  --ignore-sync-partial-err
                        Suppress the warning when replicas were denied a
                        partial resync since the last check and fell back to a
                        full sync.
  --ignore-thp          Suppress the warning about transparent huge pages
                        being set to "always".
  --no-perfdata         Suppress the performance data section from the output.
                        The status message and the exit code are unaffected,
                        so alerting keeps working while trending data is
                        dropped.
  -p, --password PASSWORD
                        Password for Redis server authentication.
  --port PORT           Redis server port. Default: 6379
  --socket SOCKET       Redis server Unix socket path. Overrides --hostname
                        and --port.
  --timeout TIMEOUT     Network timeout in seconds. Default: 8 (seconds)
  --tls                 Establish a secure TLS connection to Redis.
  --username USERNAME   Username for Redis server authentication.
  --verbose             Makes this plugin verbose during the operation. Useful
                        for debugging and seeing what is going on under the
                        hood.
  -w, --warning WARN    WARN threshold for memory usage as a percentage.
                        Default: >= 90

Documentation:
https://linuxfabrik.github.io/monitoring-plugins/check-plugins/redis-status/

Usage Examples

./redis-status \
    --ignore-maxmemory0 \
    --ignore-overcommit \
    --ignore-somaxconn \
    --ignore-sync-partial-err \
    --ignore-thp \
    --username=linus \
    --password=linuxfabrik

Output:

Redis v5.0.3, standalone mode on 127.0.0.1:6379, /etc/redis.conf, up 4m 25s, 100.9% memory usage
[WARNING] (9.6MiB/9.5MiB, 9.6MiB peak, 19.6MiB RSS), maxmemory-policy=noeviction, 3 DBs
(db0 db3 db4) with 10 keys, 0 evicted keys, 0 expired keys, hit rate 100.0%
(3M hits, 0 misses), vm.overcommit_memory is not set to 1, kernel transparent_hugepage is not
set to "madvise" or "never", net.core.somaxconn (128) is lower than net.ipv4.tcp_max_syn_backlog
(256). Sam, I detected a few issues in this Redis instance memory implants:

 * High total RSS: This instance has a memory fragmentation and RSS overhead greater than 1.4
 (this means that the Resident Set Size of the Redis process is much larger than the sum of the
logical allocations Redis performed). This problem is usually due either to a large peak
memory (check if there is a peak memory entry above in the report) or may result from a workload
that causes the allocator to fragment memory a lot. If the problem is a large peak memory, then
there is no issue. Otherwise, make sure you are using the Jemalloc allocator and not the default
libc malloc. Note: The currently used allocator is "jemalloc-5.1.0".

I'm here to keep you safe, Sam. I want to help you.

States

  • OK if memory usage is below the warning threshold and no OS-level misconfigurations are detected.
  • WARN or CRIT if memory usage exceeds the configured thresholds (default: WARN >= 90%).
  • WARN when maxmemory is set to 0 (unlimited), unless suppressed via --ignore-maxmemory0.
  • WARN on memory issues reported by Redis Memory Doctor (except harmless peak-only or jemalloc cases).
  • WARN if replicas were denied a partial resync since the previous check and had to fall back to a full sync, unless suppressed via --ignore-sync-partial-err. A denial before the previous check, still counted by the server until its restart, does not warn again.
  • WARN on OS-level misconfigurations (vm.overcommit_memory, transparent huge pages, somaxconn), each individually suppressible.
  • WARN if redis-cli cannot reach the server, or gets no answer within --timeout.
  • UNKNOWN if the login fails, because --password is missing or Redis rejects the username or password.
  • --always-ok suppresses all alerts and always returns OK.

Perfdata / Metrics

Latest info can be found here.

Name Type Description
clients_blocked_clients Number Number of clients pending on a blocking call.
clients_connected_clients Number Number of client connections (excluding connections from replicas).
cpu_used_cpu_sys_children_percent Percentage System CPU consumed by child processes, in percent.
cpu_used_cpu_sys_percent Percentage System (kernel) CPU consumed by the server, in percent.
cpu_used_cpu_user_children_percent Percentage User CPU consumed by child processes, in percent.
cpu_used_cpu_user_percent Percentage User CPU consumed by the server, in percent.
db_count Number Number of Redis databases holding keys.
key_count Number Sum of all keys across all databases.
keyspace_DBNAME_avg_ttl Seconds Average TTL for keys in this database.
keyspace_DBNAME_expires Number Number of keys with an expiration in this database.
keyspace_DBNAME_keys Number Number of keys in this database.
keyspace_hit_rate Percentage Percentage of key lookups successfully returned since the server start.
mem_usage Percentage Memory usage relative to maxmemory (or total system memory if maxmemory is 0).
memory_maxmemory Bytes Configured maximum memory limit, 0 if unlimited.
memory_mem_fragmentation_ratio Number Ratio between used_memory_rss and used_memory.
memory_used_memory Bytes Total bytes allocated by Redis using its allocator.
memory_used_memory_lua Bytes Bytes used by the Lua engine.
memory_used_memory_rss Bytes Bytes allocated as seen by the OS (resident set size).
persistence_aof_current_rewrite_time_sec Seconds Duration of the on-going AOF rewrite, 0 if none is running.
persistence_rdb_changes_since_last_save Number Number of changes since the last dump.
persistence_rdb_current_bgsave_time_sec Seconds Duration of the on-going RDB save, 0 if none is running.
replication_connected_slaves Number Number of connected replicas.
replication_repl_backlog_histlen Bytes Size of the data in the replication backlog buffer.
replication_repl_backlog_size Bytes Total size of the replication backlog buffer.
server_uptime_in_seconds Seconds Number of seconds since Redis server start.
stats_evicted_keys_per_second Number Keys evicted per second because of the maxmemory limit.
stats_expired_keys_per_second Number Key expiration events per second.
stats_keyspace_hits_per_second Number Successful key lookups per second.
stats_keyspace_misses_per_second Number Failed key lookups per second.
stats_latest_fork_usec Microseconds Duration of the latest fork operation.
stats_rejected_connections_per_second Number Connections rejected per second because of the maxclients limit.
stats_sync_full_per_second Number Full resyncs with replicas per second.
stats_sync_partial_err_per_second Number Denied partial resync requests per second.
stats_sync_partial_ok_per_second Number Accepted partial resync requests per second.
stats_total_commands_processed_per_second Number Commands processed per second.
stats_total_connections_received_per_second Number Connections accepted per second.
stats_total_net_input_bytes_per_second Bytes Bytes read from the network per second.
stats_total_net_output_bytes_per_second Bytes Bytes written to the network per second.

Troubleshooting

Failed to authenticate

redis-cli reports a refused login with exit code 0, so the plugin reads the answer. Redis requires a password (requirepass or an ACL user) and none was given: pass it with --password, and the account with --username if it is an ACL user. Redis rejected the credentials: check --username and --password against the requirepass or user line of the Redis configuration. The state is UNKNOWN, because the check cannot say anything about the server without logging in.

vm.overcommit_memory is not set to 1

Run sysctl -w vm.overcommit_memory=1.

kernel transparent_hugepage is not set to "madvise"

Run echo madvise > /sys/kernel/mm/transparent_hugepage/enabled.

net.core.somaxconn is lower than net.ipv4.tcp_max_syn_backlog

tcp_max_syn_backlog represents the maximal number of connections in SYN_RECV queue. somaxconn represents the maximal size of ESTABLISHED queue and should be greater than tcp_max_syn_backlog, so do something like this: sysctl -w net.core.somaxconn=1024; sysctl -w net.ipv4.tcp_max_syn_backlog=512

Replicas were denied a partial resync

replicas were denied a partial resync since the last check and fell back to a full sync

A replica lost its connection to this primary, asked to continue where it left off, and was refused. It then fetched a complete copy, which makes the primary fork and transfer a full dump. A single event after a network outage or a restart is harmless, the replication has recovered by the time the check reports it, and the next check is OK again. If it keeps coming back:

  1. Look for the reason in the Redis log of the primary: for lack of backlog or Replication ID mismatch.
  2. On for lack of backlog, the replication backlog is too small to cover the time a replica is away. Raise repl-backlog-size in redis.conf (the default is 1 MB), or at runtime with redis-cli config set repl-backlog-size 64mb.
  3. On Replication ID mismatch, the primary changed its replication history, for example after a restart without persistence. Check why the primary restarted or lost its data.

Credits, License