快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

nagios监控mfs脚本

#!/bin/bash
#a nagios plugin for  check moosefs healthy
#write 20120821
CHECK_OK=0
CHECK_WARNING=1
CHECK_CRITICAL=2
CHECK_UNKNOWN=3

CHECK_MASTER () {
        check_process=`ps aux|grep '/usr/local/mfs/sbin/mfsmaster'|grep -v grep`
        check_port=`netstat -lunpt|grep ':9419'`
        if [ -n "$check_process" -a -n "$check_port" ]
        then
        echo "mfsmaster is OK"
        exit 0
        else
        echo "mfsmaster is not running"
        exit 2
        fi
}

CHECK_CHUNK () {
        check_process=`ps aux|grep '/usr/local/mfs/sbin/mfschunkserver'|grep -v grep`
        check_port=`netstat -lunpt|grep ':9422'`
        if [ -n "$check_process" -a -n "$check_port" ]
        then
        echo "mfschunkserver is OK"
        exit 0
        else
        echo "mfschunkserver is not running"
        exit 2
        fi
}
CHECK_CLIENT () {
        check_process=`ps aux|grep '/usr/local/mfs/bin/mfsmount'|grep -v grep`
        if [ -n "$check_process" ]
        then
        echo "mfsclient is OK"
        exit 0
        else
        echo "mfsclient is not running"
        exit 2
        fi
}
CHECK_METALOGGER () {
        check_process=`ps aux|grep '/usr/local/mfs/sbin/mfsmetalogger'|grep -v grep`
        if [ -n "$check_process" ]
        then
        echo "mfschunkserver is OK"
        exit 0
        else
        echo "mfschunkserver is not running"
        exit 2
        fi
}
case "$1" in
        -M)
        CHECK_MASTER
        ;;
        -c)
        CHECK_CLIENT
        ;;
        -C)
        CHECK_CHUNK
        ;;
        -L)
        CHECK_METALOGGER
        ;;
        *)
        echo "Unknown argement: $1"
        ;;
esac

本文题目:nagios监控mfs脚本
链接分享:http://6mz.cn/article/ggigei.html

其他资讯