check_redis
A Nagios/Icinga compatible check plugin for Redis, written in Go.
Features
- Monitor specific Redis metrics (e.g.,
memory_mb,hit_ratio). - Support for custom Redis INFO keys.
- Nagios/Icinga compatible output and exit codes.
- Performance data support.
- Support for Redis authentication.
Installation
From Source
Ensure you have Go installed (version 1.23 or later recommended).
go build -o check_redis
Usage
Basic Check
Returns a summary of the Redis instance (version, clients, memory, uptime).
./check_redis -H 127.0.0.1
Monitor Memory Usage
Check if used memory exceeds 100MB (Warning) or 200MB (Critical).
./check_redis -H 127.0.0.1 --key memory_mb -w 100 -c 200
Monitor Cache Hit Ratio
Check if hit ratio falls below 90% (Warning) or 80% (Critical). Note: Thresholds use the Nagios Range Format.
./check_redis -H 127.0.0.1 --key hit_ratio -w 90: -c 80:
Custom Stat
Monitor any key from the Redis INFO command.
./check_redis -H 127.0.0.1 --key connected_clients -w 50 -c 100
Authenticated Connection
./check_redis -H 127.0.0.1 -u myuser -P mypassword --key memory_mb
Arguments
| Flag | Short | Default | Description |
|---|---|---|---|
--host |
-H |
127.0.0.1 |
Redis host |
--port |
-p |
6379 |
Redis port |
--username |
-u |
Redis username | |
--password |
-P |
Redis password | |
--key |
-k |
Stat to monitor (memory_mb, hit_ratio, or any custom INFO key) |
|
--warning |
-w |
Warning threshold | |
--critical |
-c |
Critical threshold | |
--timeout |
-t |
30 |
Timeout in seconds |
--help |
Show help message |
License
This project is licensed under the MIT License.