最近线上刚好有监控MFS服务器的需求,本来准备自己完全写一个nagios插件出来的,但是又懒不想写就搜了一下,还真有网友分享出来了。他的连接地址是:http://blog.csdn.net/liuyunfengheda/article/details/5606830
我把脚本拿下来测试了一下,貌似有些小错误,不知道是不是系统不一样的原因。
我的测试环境是centos 6.5 86_64。
以下是我在centos 6.5 86_64环境下做了修改的脚本,分享给大家。
118 | #by cuiyuanrong # Nagios return codes STATE_WARNING=1 STATE_CRITICAL=2 STATE_UNKNOWN=3 # Set MFS Path And Warning/CRITICAL Value MFS_Path= "/usr/sbin" MFS_Mount_Point= "/mnt/mfs" WARNING_Value=85 CRITICAL_Value=95 #Get Master server Process MFS_PID=` ps -ef | grep mfsmaster | grep ${mfspath} | awk '{print $2}' ` if [ "${MFS_PID}" = "" ]; then echo "ERROR : mfs master does not start" exit $STATE_CRITICAL echo "OK : mfs master server running OK!" #Get chunker server Process MFS_PID=` ps -ef | grep mfschunkserver | grep ${mfspath} | awk '{print $2}' ` if [ "${MFS_PID}" = "" ]; then echo "ERROR : mfs chunkserver does not start" exit $STATE_CRITICAL echo "OK : mfs master chunkserver running OK!" Disk_used=` df -h | grep ${mountpoint} | awk '{print $5}' | awk -F% '{print $1}' ` if [ ${Disk_used} - ge ${warningdiskused} -a ${Disk_used} -lt ${criticaldiskused} ]; then echo "Waring :mfs disk used Rate is " ${Disk_used} "" exit $STATE_WARNING elif [ ${Disk_used} - ge ${criticaldiskused} ]; then echo "CRITICAL :mfs disk used Rate is " ${Disk_used} "" exit $STATE_CRITICAL elif [ "${Disk_used}" = "" ]; then echo "CRITICAL :mfs client not mount on" exit $STATE_CRITICAL echo "OK : MFS client mount on and disk used rate is ${Disk_used}% , Everything is OK!" #Get metalogger server Process MFS_PID=` ps -ef | grep mfsmetalogger | grep ${mfspath} | awk '{print $2}' ` if [ "${MFS_PID}" = "" ]; then echo "ERROR : mfs mfsmetalogger does not start" exit $STATE_CRITICAL echo "OK : mfs master mfsmetalogger running OK!" # Functions plugin usage echo "" echo " -M MFS master server status " echo " -C MFS chunker server status " echo " -U MFS client disk used Rate " echo " -L MFS metalogger server status " echo "" echo " Usage1 : ${Program_name} -M mfsmasterpath" echo " ex : ${Program_name} -M ${MFS_Path}" echo " Usage2 : ${Program_name} -C mfschunkpath" echo " ex : ${Program_name} -C ${MFS_Path}"我的北漂在路上--------时不时的停下脚步思考 阅读原文»
订阅:
博文评论 (Atom)
|
没有评论:
发表评论