nagios客戶端安裝與配置windows篇


一、被監控的windows xp客戶端的配置

1、安裝NSClient++並安裝
下載地址: http://sourceforge.net/projects/nscplus
NSClient++-0.3.8-Win32.msi  
NSClient++-0.3.8-x64.msi

2、安裝NSClient++
雙擊安裝 -> next -> 同意 -> next  -> next -> next -> 設置允許IP,設置密碼(這里密碼一般可以不設置),Modules to load (選前三個模塊就可以了,第2個為chect_nt用於監控windows,第3個為checp_nrpe用於監控linux) -> next  -> install  -> finish

3、啟動NSClientpp服務,並允許服務交互式

4、如果windows開啟了自帶的防火牆,那么必須設置讓該程序通過




二、監控端主機的設置(Nagios服務器)

1、檢查Nagios目錄下的libexec子目錄,一定要存在check_nt(例如:/usr/local/nagios/libexec/check_nt)



2、配置command.cfg文件(例如:/usr/local/nagios/etc/objects/command.cfg),增加如下幾行(默認應該已經有了)

 

#/usr/local/nagios/etc/objects/command.cfg

 

# 'check_nt' command definition


define command{
command_name    check_nt
command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
}

3、編譯nagios.cfg文件

 

#/usr/local/nagios/etc/nagios.cfg,打開下面這一行

 

# Definitions for monitoring a Windows machine

 

cfg_file=/usr/local/nagios/etc/objects/windows.cfg



#vi  /usr/local/nagios/etc/objects/windows.cfg,下面為配置主要的監控項目



#定義要被監控的windows主機名與主機的IP地址

define host{

 

use             windows-server 

 

host_name       ruanxi         

 

alias           My Windows Server

 

address         192.168.0.5    

 

}



#定義一個主機名組(可以不用管它)

define hostgroup{

 

hostgroup_name  windows-servers

 

alias           Windows Servers

 

}



#檢查windows主機是否已經安裝了NSClient++,及它的版本號

define service{

 

use                     generic-service

 

host_name               ruanxi

 

service_description     NSClient++ Version

 

check_command           check_nt!CLIENTVERSION

 

}



#監控 windows 主機的開機運作時間

define service{

 

use                     generic-service

 

host_name               ruanxi

 

service_description     Uptime

 

check_command           check_nt!UPTIME

 

}



#監控 windows 主機的 CPU 負載

define service{

 

use                     generic-service

 

host_name               ruanxi

 

service_description     CPU Load

 

check_command           check_nt!CPULOAD!-l 5,80,90    #CPU如果到達80%則報警,到達90%則警笛

 

}



#監控 windows 主機的內存使用狀況 

define service{

 

use                     generic-service

 

host_name               ruanxi

 

service_description     Memory Usage

 

check_command           check_nt!MEMUSE!-w 80 -c 90  #內存使用到達80%則warn,到達90%則Critical

 

}



#監控 windows 主機的 C:\ 的空間使用量 

define service{

 

use                     generic-service

 

host_name               ruanxi

 

service_description     C:\ Drive Space

 

check_command           check_nt!USEDDISKSPACE!-l c -w 80 -c 90

 

}



#監控 windows主機的W3SVC設置的動作狀況

                         ------>此服務為WEB服務器有關日志的服務程序

 

define service{

 

use                     generic-service

 

host_name               ruanxi

 

service_description     W3SVC

 

check_command           check_nt!SERVICESTATE!-d SHOWALL -l W3SVC

 

}



#監控 windows 主機的 Explorer.exe 執行程序的運作狀況,如程序終止了,則會發 CRITICA

define service{

 

use                     generic-service

 

host_name               ruanxi

 

service_description     Explorer

 

check_command           check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe

 

}



#監控 windows 主機的 MSSQLSERVER 服務的運作狀況,如服務終止了,則會發 CRITICAL 

define service{

 

use                     generic-service

 

host_name               ruanxi

 

service_description     MSSQL

 

check_command           check_nt!SERVICESTATE!-d SHOWALL -l MSSQLSERVER

 

}



說明:如果有多台的windows xp客戶端要監控,那么就以上述這樣寫多個就可以了


3、檢查nagios.cfg文件有沒有錯誤

 

#nagios -c  nagios.cfg



4、重新啟動一下nagios服務

 

#service nagios restart



5、訪問頁面進行查看

 

#elinks http://localhost/nagios/


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM