nagios监控NFS
Nagios具体搭建配置参考
创新互联是一家企业级云计算解决方案提供商,超15年IDC数据中心运营经验。主营GPU显卡服务器,站群服务器,绵阳主机托管,海外高防服务器,大带宽服务器,动态拨号VPS,海外云手机,海外云服务器,海外服务器租用托管等。
补充监控NFS
check_nfs该脚本是网上找的,忘记在那里下载的了,也以附件的形式提供出来。
-bash-4.1$ cat check_nfs #!/bin/bash . /data1/server/nagios/libexec/utils.sh CHECKNAME="Mount NFS" RESULT="" EXIT_STATUS=$STATE_OK NFSFSTAB=`LC_ALL=C awk '!/^#/ && $3 ~ /^nfs/ && $3 != "nfsd" && $4 !~ /noauto/ { print $1 }' /etc/fstab` NFSMTAB=`LC_ALL=C awk '$3 ~ /^nfs/ && $3 != "nfsd" && $2 != "/" { print $1 }' /proc/mounts` theend() { echo $RESULT exit $EXIT_STATUS } CHECK_MOUNT(){ LIST="" for list in $NFSFSTAB do NFS_MOUNT=$(LC_ALL=C cat /proc/mounts |cut -d " " -f 1|grep "${list}$") if [ -z "${NFS_MOUNT}" ];then LIST="$LIST$list " fi done } if [ -n "${NFSMTAB}" ];then CHECK_MOUNT if [ -z "${LIST}" ];then RESULT="$CHECKNAME OK - NFS BE MOUNTED PROPERLY" EXIT_STATUS=$STATE_OK else RESULT="$CHECKNAME WARNING - ${LIST} NOT BE MOUNTED" EXIT_STATUS=$STATE_WARNING fi else RESULT="$CHECKNAME CRITICAL - ALL NFS NOT BE MOUNTED" EXIT_STATUS=$STATE_CRITICAL fi theend
定义check_nfs命令:
-bash-4.1$ vim commands.cfg #添加下面内容 define command{ command_name check_nfs command_line $USER1$/check_nfs }
定义监控NFS服务:
-bash-4.1$ vim web103.cfg #添加下面内容: define service{ use local-service host_name web103 service_description NFS mount check_command check_nrpe!check_nfs }
检测配置是否正确:
-bash-4.1$ ../../bin/nagios -v ../nagios.cfg
切换到root启动nagios
[root@monitor root]# service nagios start
网页题目:nagios监控NFS
本文网址:http://cdiso.cn/article/gghjih.html