Nagios具体搭建配置参考:http://my.oschina.net/duangr/blog/183160
补充监控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
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。