nagios监控window主机(上)

一、被监控端--window系统

1)下载NSClient++软件

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

2)NSClient安装

3)关闭 防火墙,并查询 12489 和 5666 两个端口的监听状态


二、监控端--linux系统

 1)在监控端,通过脚本方式查看被监控端(即window系统)的CPU和C盘使用率

[root@svr5 libexec]# ./check_nt -H 192.168.174.100 -p 12489 -v CPULOAD -w 80 -c 90 -l 5,80,90
CPU Load 50% (5 min average) |   '5 min avg Load'=50%;80;90;0;100          #能看到监控结果,说明之前安装在window上的 NSClient 软件正常工作
[root@svr5 libexec]# 

2)修改windows.cfg文件之前,对该文件进行备份

[root@svr5 objects]# cd /usr/local/nagios/etc/objects
[root@svr5 objects]# cp windows.cfg windows.cfg.bak
[root@svr5 objects]# 

3)修改windows.cfg 文件(该文件指明了监控哪台主机,以及监控的资源)

   这里只是将 windows.cfg 模板文件中的监控主机 IP 地址进行修改 , 该文件中还有很多默认的监控服务。

[root@svr5 objects]# vim windows.cfg

4) 在主配置文件(nagios.cfg)中添加 监控主机文件

主配置文件: /usr/local/nagios/etc/nagios.cfg

监控主机文件: /usr/local/nagios/etc/objects/****.cfg   

扫描二维码关注公众号,回复: 5671226 查看本文章
[root@svr5 etc]# vim /usr/local/nagios/etc/nagios.cfg

5)检测一下配置文件有没有错误

[root@svr5 etc]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg 

Nagios Core 4.4.3
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2019-01-15
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 15 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                                        # 0 个警告
Total Errors:   0                                        # 0 个错误

Things look okay - No serious problems were detected during the pre-flight check
[root@svr5 etc]# 

 6)重启nagios服务

[root@svr5 etc]# service nagios restart
Running configuration check... Stopping nagios: done.
Starting nagios: Running configuration check... done.
[root@svr5 etc]# 

三、测试监控window主机是否成功

address

四、总结

①、监控多台window主机时, 监控端的配置基本都是一致的

②、监控多台window主机时,服务端的操作思路:

     a)可以拷贝windows.cfg 文件作为末班进行修改, 文件名可以改为 "IP地址.cfg"(这样命名可以一目了然知道该文件配置的是哪个主机的监控)

     b )修改 ***.cfg 监控主机文件的内容,

           define host {             ------定义监控哪台主机

                  host_name       -----给该文件的主机命名, 可以使用命名为被监控主机的ip地址

                 address             ---- 指定 监控哪个IP 的主机

           }

          

        define service {                 --------定义监控什么内容

               use                     generic-service
               host_name               winserver
               service_description     NSClient++ Version
              check_command           check_nt!CLIENTVERSION
        }
 

猜你喜欢

转载自blog.csdn.net/u010559460/article/details/88642728
今日推荐