This is a Zabbix template + discovery & sender script useful to monitor Redis Server & Redis Sentinel instances:
Copy
zabbix-redis.py
to/usr/local/bin/
.Add the
redis_server.discovery
and / orredis_sentinel.discovery
user parameters to Zabbix:UserParameter=redis_server.discovery[*],/usr/local/bin/zabbix-redis.py -i '$1' -t server discover $2 2> /dev/null UserParameter=redis_sentinel.discovery[*],/usr/local/bin/zabbix-redis.py -i '$1' -t sentinel discover $2 2> /dev/null
Add required jobs to the
zabbix
user crontab (beware of the-i
,-t
and-s
options). This will submit Redis Server and / or Redis Sentinel metrics through Zabbix Sender:* * * * * /usr/local/bin/zabbix-redis.py -i '6379, 6380, 6381, 7000, 7001, 7002, 7003, 7004, 7005' -t server send -c /etc/zabbix/zabbix_agentd.conf -s dev > /dev/null 2>&1 * * * * * /usr/local/bin/zabbix-redis.py -i '26379, 26380, 26381' -t sentinel send -c /etc/zabbix/zabbix_agentd.conf -s dev > /dev/null 2>&1
Import the required templates (
template-app-redis-server.xml
and / ortemplate-app-redis-sentinel.xml
files).Add an existing / new host to the
Redis servers
group and link it to the right template (Template App Redis Server
for Redis Server andTemplate App Redis Sentinel
for Redis Sentinel). Beware depending on the used template you must set a value for the{$REDIS_SERVER_LOCATIONS}
or{$REDIS_SENTINEL_LOCATIONS}
macro (comma-delimited list of Redis instances;port
,host:port
andunix:///path/to/socket
formats are allowed).