您好,登錄后才能下訂單哦!
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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。