监控redis
[4ajr@redis1 scripts]$ cat redismonitor.sh
#!/bin/bash
#想要什么监控项再添加
rediscli="/soft/redis/bin/redis-cli"
ip="172.30.210.178"
port=6379
if [[ $# == 1 ]]
then
case $1 in
mem_fragmentation_ratio)
result=`$rediscli -h $ip -p $port info memory | grep -w "mem_fragmentation_ratio" | awk -F':' '{print $2}'`
echo $result
;;
esac
fi
UserParameter=Redis.Info[*],/soft/zabbix_agent/scripts/redismonitor.sh $1
[4ajr@redis1 scripts]$ redis-cli -h 172.30.210.178 -p 6379 info memory
used_memory:2649032
used_memory_rss:11042816
mem_fragmentation_ratio:4.27
used_memory_rss/used_memory内存碎片比率,过大操作会产生明显延迟