天天看點

nagios用戶端安裝與配置windows篇

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

1、安裝NSClient++并安裝

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服務,并允許服務互動式

nagios用戶端安裝與配置windows篇

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 主機的開機運作時間

service_description     Uptime

check_command           check_nt!UPTIME

#監控 windows 主機的 CPU 負載

service_description     CPU Load

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

#監控 windows 主機的記憶體使用狀況 

service_description     Memory Usage

check_command           check_nt!MEMUSE!-w 80 -c 90  #記憶體使用到達80%則warn,到達90%則Critical

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

service_description     C:\ Drive Space

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

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

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

service_description     W3SVC

check_command           check_nt!SERVICESTATE!-d SHOWALL -l W3SVC

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

service_description     Explorer

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

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

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/

繼續閱讀