姓名:刘浩然。 2020年大目标Python

监控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内存碎片比率,过大操作会产生明显延迟

posted @ 2019-02-03 10:47  pluto2charon  阅读(170)  评论(0编辑  收藏  举报