nagios监控windows主机实战教程-定位原创
nagios监控windows主机(windows7 32位)首先服务端已配置好,现在配置客户端即可(被监控端)
监控端是linux主机,如果linux主机监控windows的话,需要在windows上安装NSClient++程序,之间也是通过插件来完成的,这里就不详述了。
版本号:0.3.8(NSClient++)
安装步骤:
这里先确保NSClient++服务已启动,默认是使用check_nt来检测windows主机上的资源的
打开运行窗口:services.msc
接着配置服务端(监控端)
cd /service/nagios/etc/objects
vim commands.cfg
在底端添加如下程序:(如果存在就叫不用添加了)
define command{
command_name check_nt
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
}
接着修改当前路径下的windows.cfg,并且添加相应的监控服务
define host{
use windows-server
host_name winhost (自定义修改)
alias My Windows Server (自定义修改)
address 192.168.10.127 (windows主机,即被控端的ip)
}
添加程序:
define service{
use generic-service
host_name winhost
service_description NSClient++ Version
check_command check_nt!CLIENTVERSION
}
define service{
use generic-service
host_name winhost
service_description Uptime
check_command check_nt!UPTIME
}
define service{
use generic-service
host_name winhost
service_description CPU Load
check_command check_nt!CPULOAD!-l 5,80,90
}
define service{
use generic-service
host_name winhost
service_description Memory Usage
check_command check_nt!MEMUSE!-w 80 -c 90
}
define service{
use generic-service
host_name winhost
service_description C: Drive Space
check_command check_nt!USEDDISKSPACE!-l c -w 80 -c 90
}
define service{
use generic-service
host_name winhost
service_description W3SVC
check_command check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
}
define service{
use generic-service
host_name winhost
service_description Explorer
check_command check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe
}
define service{
use generic-service
host_name winhost
service_description Web Server
check_command check_http
}
define service{
use generic-service
host_name winhost
service_description MySQL Server
check_command check_mysql!root!admin
}
最后在nagios主配置文件当中添加windows.cfg文件,如下:
vim /service/nagios/etc/nagios.cfg
cfg_file=/service/nagios/etc/objects/windows.cfg (添加的内容,如果存在,就不需要了)
检测nagios配置文件是否存在错误:
/service/nagios/bin/nagios -v /service/nagios/etc/nagios.cfg
如果出现如下,就没有错误:
Nagios Core 4.0.7
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 06-03-2014
License: GPL
Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Read object config files okay...
Running pre-flight check on configuration data...
Checking objects...
Checked 30 services.
Checked 4 hosts.
Checked 3 host groups.
Checked 0 service groups.
Checked 1 contacts.
Checked 1 contact groups.
Checked 26 commands.
Checked 5 time periods.
Checked 0 host escalations.
Checked 0 service escalations.
Checking for circular paths...
Checked 4 hosts
Checked 0 service dependencies
Checked 0 host dependencies
Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 0
Total Errors: 0
Things look okay - No serious problems were detected during the pre-flight check
最后一步:重启nagios服务:
service nagios restart
验证:打开浏览器,输入IP地址
这里当然也可以通过nrpe来检测。这里就不详述了。
这个还不错啊
页:
[1]