- 論壇徽章:
- 0
|
使用Nagios監(jiān)控Windows服務器
12.Nagios使用NSClient++監(jiān)控遠程Windows主機
![]()
下載NSClient++-Win32-0.3.5.msi并安裝。
到安裝目錄打開NSC.ini文件進行修改:
在[modules]模塊,將除CheckWMI.dll和RemoteConfiguration.dll外的所有dll文件明前的注釋(;)去掉。
在[Settings]模塊可以設置一個連接密碼password=PWD,為了簡單,在此不設密碼。設置 allowed_hosts=127.0.0.1/32,192.168.0.19,可以連接的監(jiān)控服務器的地址,如果寫成192.168.0.0/24 則表示該子網內的所有機器都可以訪問;如果這個地方是空白則表示所有的主機都可以連接上來(注意在[NSClient]有allowed_hosts的同 樣設置,不要設置錯了),最后不要忘記去掉前面的注釋符(;)。
運行nsclient++
NSClient++ /install
NSClient++ SysTray install
NSClient++ /start
如果有防火墻,請開放相應端口。
創(chuàng)建監(jiān)控配置文件,使用check_nt命令監(jiān)控windows系統(tǒng)信息(此命令默認已定義)。
Windows監(jiān)控示例配置文件:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[root@tech etc]# cat /usr/local/nagios/etc/servers/print-w-80.cfg
###############################################################################
# WINDOWS.CFG - SAMPLE CONFIG FILE FOR MONITORING A WINDOWS MACHINE
#
# Last Modified: 06-13-2007
#
# NOTES: This config file assumes that you are using the sample configuration
# files that get installed with the Nagios quickstart guide.
#
###############################################################################
###############################################################################
###############################################################################
#
# HOST DEFINITIONS
#
###############################################################################
###############################################################################
# Define a host for the Windows machine we'll be monitoring
# Change the host_name, alias, and address to fit your situation
define host{
use windows-server ; Inherit default values from a template
host_name print80 ; The name we're giving to this host
alias Print80 ; A longer name associated with the host
address 192.168.0.80 ; IP address of the host
}
###############################################################################
###############################################################################
#
# HOST GROUP DEFINITIONS
# 主機組在/usr/local/nagios/etc/servers/hostgroup.cfg中單獨配置
###############################################################################
###############################################################################
# Define a hostgroup for Windows machines
# All hosts that use the windows-server template will automatically be a member of this group
#define hostgroup{
# hostgroup_name windows-servers ; The name of the hostgroup
# alias Windows Servers ; Long name of the group
# }
###############################################################################
###############################################################################
#
# SERVICE DEFINITIONS
#
###############################################################################
###############################################################################
# Create a service for monitoring the version of NSCLient++ that is installed
# Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name print80
service_description NSClient++ Version
check_command check_nt!CLIENTVERSION
}
# Create a service for monitoring the uptime of the server
# Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name print80
service_description Uptime
check_command check_nt!UPTIME
}
# Create a service for monitoring CPU load
# Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name print80
service_description CPU Load
check_command check_nt!CPULOAD!-l 5,80,90
}
# Create a service for monitoring
# Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name print80
service_description Memory Usage
check_command check_nt!MEMUSE!-w 80 -c 90
}
# Create a service for monitoring C:\ disk usage
# Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name print80
service_description C_Drive_Space
check_command check_nt!USEDDISKSPACE!-l c -w 80 -c 90
}
# Create a service for monitoring the W3SVC service
# Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name print80
service_description W3SVC
check_command check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
}
# Create a service for monitoring the Explorer.exe process
# Change the host_name to match the name of the host you defined above
define service{
use generic-service
host_name print80
service_description Explorer
check_command check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe
}
#主機組配置文件
[root@tech etc]# cat /usr/local/nagios/etc/servers/hostgroup.cfg
define hostgroup{
hostgroup_name linux-servers ; The name of the hostgroup
alias Linux Servers ; Long name of the group
members localhost,wiki ; Comma separated list of hosts that belong to this group
}
define hostgroup{
hostgroup_name windows-servers ; The name of the hostgroup
alias Windows Servers ; Long name of the group
members print80 ; Comma separated list of hosts that belong to this group
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
本文來自ChinaUnix博客,如果查看原文請點:http://blog.chinaunix.net/u3/109134/showart_2136050.html |
|