Zabbix监控Redis

环境:
   Centos 7.3
   Zabbix version : 3.0.2
   Redis version : 3.2.5

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#监控脚本
[root@localhost ~]# cd /etc/zabbix/scripts/
[root@localhost scripts]# ls
check_redis.sh
[root@localhost scripts]# cat check_redis.sh
#!/bin/bash
PORT='6379'
STATUS_redis=`/bin/redis-cli -h '192.168.1.1' -p $PORT -a redis_password ping`
if [ "$STATUS_redis" == 'PONG' ];then
echo '1'
else
echo '0'
fi
[root@localhost scripts]#
#zabbix agent
[root@localhost ~]# cd /etc/zabbix/zabbix_agentd.d/
[root@localhost zabbix_agentd.d]# cat userparameter_redis.conf
UserParameter=redis_status[*],/bin/redis-cli -h '192.168.1.1' -p $1 -a redis_password info | grep -w $2 | awk -F':' '{print $NF}'
UserParameter=redis_ping,sh /etc/zabbix/scripts/check_redis.sh
[root@localhost zabbix_agentd.d]#
[root@localhost ~]# systemctl restart zabbix-agent
[root@localhost ~]# zabbix_get -s localhost -k redis_ping
1
[root@localhost ~]# zabbix_get -s localhost -k redis_status[6379,used_memory]
1210708664
[root@localhost ~]#

把修改后的模版链接到主机上
Zabbix Monitor Redis
Zabbix Monitor Redis
Zabbix Monitor Redis
Zabbix Monitor Redis
Zabbix Monitor Redis
Zabbix Monitor Redis
Zabbix Monitor Redis

参考:http://blog.hackroad.com/operations-engineer/linux_server/11019.html
http://www.cnblogs.com/gnuhpc/p/4609592.html

附件:
Zabbix监控redis模版6379
注:这个redis监控脚本需要根据实际情况修改


本文出自”Jack Wang Blog”:http://www.yfshare.vip/2017/09/10/Zabbix监控redis/