Chinaunix首页 | 论坛 | 博客

e

  • 博客访问: 158874
  • 博文数量: 15
  • 博客积分: 2041
  • 博客等级: 大尉
  • 技术积分: 197
  • 用 户 组: 管理员
  • 注册时间: 2012-02-12 10:26
个人简介

木有介绍 爱咋咋地

文章分类

全部博文(15)

分类: 系统运维

2012-07-19 14:58:42

test特色    



#DATE=`date +%Y-%m-%d`
connections=`/usr/local/nagios/libexec/check_tcp -H localhost  -p 11211 -E -s 'stats\r\nquit\r\n' -e 'uptime' |grep curr_connections | awk '{print $3}'`
#cmd_get=`/usr/local/nagios/libexec/check_tcp -H localhost  -p 11211 -E -s 'stats\r\nquit\r\n' -e 'uptime' |grep cmd_get | awk '{print $3+0}'`
#get_hits=`/usr/local/nagios/libexec/check_tcp -H localhost  -p 11211 -E -s 'stats\r\nquit\r\n' -e 'uptime' |grep get_hits | awk '{print $3+0}'`
limit_maxbytes=`/usr/local/nagios/libexec/check_tcp -H localhost  -p 11211 -E -s 'stats\r\nquit\r\n' -e 'uptime' |grep limit_maxbytes | awk '{print $3+0}'`
th=`/usr/local/nagios/libexec/check_tcp -H localhost  -p 11211 -E -s 'stats\r\nquit\r\n' -e 'uptime' |grep threads | awk '{print $3+0}'`
bytes=`/usr/local/nagios/libexec/check_tcp -H localhost  -p 11211 -E -s 'stats\r\nquit\r\n' -e 'uptime' |grep bytes |grep -vn '_'|awk '{print $3+0}'`
ci=`/usr/local/nagios/libexec/check_tcp -H localhost  -p 11211 -E -s 'stats\r\nquit\r\n' -e 'uptime' |grep curr_items|awk '{print $3+0}'`
#hit_rate=`echo "$get_hits*100/$cmd_get"|bc`
# echo "$hit_rate"
mem_percentage=`echo "scale=2;100*$bytes/$limit_maxbytes"|bc`
# echo $mem_percentage
mp=`echo "100*$bytes/$limit_maxbytes"|bc`
# echo $mp
# echo "$mem_percentage"
if [[ $mp -lt $1 ]]
   then
   echo "OK - mem_percentage is 0$mem_percentage% | mem_percentage=0$mem_percentage%; bytes=$bytes; limit_maxbytes=$limit_maxbytes; threads=$th; curr_items=$ci; curr_connections=$connections"
   exit 0
fi
if [[ $mp -ge $2 ]]
   then
   echo "Critical - mem_percentage is 0$mem_percentage% | mem_percentage=0$mem_percentage%; bytes=$bytes; limit_maxbytes=$limit_maxbytes; threads=$th; curr_items=$ci; curr_connections=$connections"
   exit 1
fi
if [[ $mp -ge $1 ]]
   then
   echo "WARNING - mem_percentage is 0$mem_percentage% | mem_percentage=0$mem_percentage%; bytes=$bytes; limit_maxbytes=$limit_maxbytes; threads=$th; curr_items=$ci; curr_connections=$connections"
   exit 2
fi

阅读(2472) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~