Centos 6.5 nagios监控Windows主机

NSClient的介绍:

NSClient++是用来监控Windows主机时安装在Windows主机上的组件。被监控机上安装NSClient,,当监控主机将监控请求发给NSClient后,NSClient直接完成监控,所有的监控是由NSClient完成的.不需要额外的插件。

客户端操作:

一、下载NSClient++插件

http://exchange.nagios.org/directory/Addons/Monitoring-Agents/NSClient%2B%2B/details

二、安装

1、关闭防火墙,或者在防火墙放通访问12489和5666端口
2、安装过程


默认,下一步


根据需求选择


填写nagios服务器IP地址,密码为空



查看12489和5666端口是否监听


根据需求修改配置文件,这里全部启用功能


重启客户端服务


服务器端操作

3、回到nagios服务器,测试监控客户端IP:192.168.2.81的CPU使用率和C盘空间
[root@ecs-4082 ~]# cd /usr/local/nagios/libexec/
[root@ecs-4082 libexec]# ./check_nt -H 192.168.2.81 -p 12489 -v CPULOAD -w 80 -c 90 -l 5,80,90
CPU Load 0% (5 min average) |   '5 min avg Load'=0%;80;90;0;100
[root@ecs-4082 libexec]# ./check_nt -H 192.168.2.81 -p 12489 -v USEDDISKSPACE -w 80 -c 90 -l C 
C:\ - total: 99.66 Gb - used: 40.10 Gb (40%) - free 59.55 Gb (60%) | 'C:\ Used Space'=40.10Gb;79.72;89.69;0.00;99.66
4、切换到/usr/local/nagios/etc/objects修改配置文件windows.cfg
[root@ecs-4082 objects]# pwd
/usr/local/nagios/etc/objects
[root@ecs-4082 objects]# vim windows.cfg 
#继承windows-server模板,指定客户端IP和别名:192.168.2.81
define host{
use windows-server ; Inherit default values from a template
host_name 192.168.2.81 ; The name we're giving to this host
alias 192.168.2.81 ; A longer name associated with the host
address 192.168.2.81 ; IP address of the host
}
#监控NSClinet++版本
define service{
use generic-service
host_name 192.168.2.81
service_description NSClient++ Version
check_command check_nt!CLIENTVERSION
}
#监控开机时间
define service{
use generic-service
host_name 192.168.2.81
service_description Uptime
check_command check_nt!UPTIME
}
#监控主机CPU
define service{
use generic-service
host_name 192.168.2.81
service_description CPU Load
check_command check_nt!CPULOAD!-l 5,80,90
}
#监控主机内容
define service{
use generic-service
host_name 192.168.2.81
service_description Memory Usage
check_command check_nt!MEMUSE!-w 80 -c 90
}
#监控C盘使用空间
define service{
use generic-service
host_name 192.168.2.81
service_description C:\ Drive Space
check_command check_nt!USEDDISKSPACE!-l c -w 80 -c 90
}
#监控E盘使用空间,有多个硬盘就以此类推
define service{
use generic-service
host_name 192.168.2.81
service_description E:\ Drive Space
check_command check_nt!USEDDISKSPACE!-l e -w 80 -c 90
}

保存退出

5、启用刚设置好的Windows文件
[root@ecs-4082 etc]# pwd
/usr/local/nagios/etc
[root@ecs-4082 etc]# vim nagios.cfg

6、验证配置文件
[root@ecs-4082 objects]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg 

Nagios Core 4.3.1
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 02-23-2017
License: GPL

Website: https://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 14 services.
	Checked 2 hosts.
	Checked 2 host groups.
	Checked 0 service groups.
	Checked 1 contacts.
	Checked 1 contact groups.
	Checked 24 commands.
	Checked 5 time periods.
	Checked 0 host escalations.
	Checked 0 service escalations.
Checking for circular paths...
	Checked 2 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
7、确认无误,重启服务
[root@ecs-4082 objects]# service nagios restart
Running configuration check...
Stopping nagios: done.
Starting nagios: done.
8、打开网页查看



猜你喜欢

转载自blog.csdn.net/tladagio/article/details/80667391
今日推荐