分类: BSD
2010-08-24 21:13:32
1.windows设置
把nsclient++0.3.3.zip解压到C盘然后进入命今窗口安装
C:\>cd "NSClient++-Win32-0.3.5"
C:\NSClient++-Win32-0.3.5>nsclient++ /install
l \NSClient++.cpp(193) Service installed!
编辑NES.ini
[modules] #去掉注释符号”;”除了CheckWMI.dll和RemoteConfiguration.dll
FileLogger.dll
CheckSystem.dll
CheckDisk.dll
NSClientListener.dll
[Settings]
allowd_host=192.168.0.20/32 #些处为nagios服务的IP
[NSClient]
port=12489 #去掉注释就可以了!
启动nsclient服务并确认端口是否打开
C:\NSClient++-Win32-0.3.5>netstat -an | more
Active Connections
Proto Local Address Foreign Address State
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING
TCP 0.0.0.0:5666 0.0.0.0:0 LISTENING
TCP 0.0.0.0:12489 0.0.0.0:0 LISTENING
2.nagios设置
接下来我们开始配置nagios服务器里面的内容
因为nagios是模块化调用,先到配置文件打开windows相关模块
vi /usr/local/nagios/etc/nagios.cfg
# Definitions for monitoring the local (Linux) host
cfg_file=/usr/local/nagios/etc/objects/localhost.cfg
# Definitions for monitoring a Windows machine
cfg_file=/usr/local/nagios/etc/objects/windows.cfg #去掉这句话的注释
打开模块后配置windows.cfg
vi /usr/local/nagios/etc/objects/windows.cfg
define host{
use windows-server
host_name winserver #被监控主机名
alias My Windows Server
address 192.168.0.8 ; 被监控的windows地址
#把下面的host_name都改成winserver
define service{
use generic-service
host_name winserver
service_description CPU Load
check_command check_nt!CPULOAD!-l 5,80,90 #监控CPU使用
}
define service{
use generic-service
host_name winserver
service_description Memory Usage
check_command check_nt!MEMUSE!-w 80 -c 90 #监控内存
}
打开windows模块,设置windows.cfg中相关被监控主机与监控内容后nagios服务器就配置完了,下面重启nagios然后看一下监控结果.
service nagios start