zabbix监控redis的shell脚本
#! /bin/bash # Name: redismontior.sh # From: [email protected] updn.cn [email protected] <2017/11/03> # Action: Zabbix monitoring redis plug-in # redis connect info REDISCLI="/opt/redis/bin/redis-cli" CLUSTER_HOST=('192.168.10.18 3000' '192.168.10.18 3004' '192.168.10.19 3001' '192.168.10.19 3005' '192.168.10.20 3002' '192.168.10.21 3003') #CLUSTER_HOST1=(192.168.10.18 3000) #CLUSTER_HOST2=(192.168.10.18 3004) #CLUSTER_HOST3=(192.168.10.19 3001) #CLUSTER_HOST4=(192.168.10.19 3005) #CLUSTER_HOST5=(192.168.10.20 3002) #CLUSTER_HOST6=(192.168.10.21 3003) PASSWD="xxxx" # zabbix info ZBX_CONF=/etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf ZBX_SENDER=/usr/bin/zabbix_sender function sender() { $ZBX_SENDER -c $ZBX_CONF -s ${HOSTNAME} -k $1 -o $2 &>/dev/null } # do function getinfo() { result=`$REDISCLI -h $1 -p $2 -a $PASSWD info | grep -w "$3" | awk -F':' '{print $2}'` echo $result } if [[ $# == 1 ]];then for i in "${CLUSTER_HOST[@]}" do echo $i HOST=($i) getinfo ${HOST[0]} ${HOST[1]} $1 done else echo "error input" fi
今天谢了一个shell脚本用来获取redis的信息,发给zabbix告警
[root@tingyun-zabbix opt]# sh redismonitor.sh used_memory_human
192.168.10.18 3000
6.39G
192.168.10.18 3004
3.45G
192.168.10.19 3001
7.12G
192.168.10.19 3005
3.97G
192.168.10.20 3002
6.38G
192.168.10.21 3003
6.38G
相关推荐
王道革 2020-11-25
wangdonghello 2020-11-03
Langeldep 2020-11-16
chenhualong0 2020-11-16
聚合室 2020-11-16
koushr 2020-11-12
MRFENGG 2020-11-11
guoyanga 2020-11-10
fackyou00 2020-11-10
Orangesss 2020-11-03
dongCSDN 2020-10-31
rainandtear 2020-10-30
Quietboy 2020-10-30
liuyulong 2020-10-29
fansili 2020-10-29
温攀峰 2020-10-23
jackbon 2020-10-19
kaixinfelix 2020-10-04