之前我们装完nagios core ,我们查看host 页面只有一个主机,就是nagios 服务器本身

nagios3

现在我们来让nagios 监控window 主机
1. 编辑nagios 配置文件
vi /usr/local/nagios/etc/nagios.cfg

找到

#cfg_file=/usr/local/nagios/etc/objects/windows.cfg

去掉前面的"#"

2.编辑被监控主机的监控配置文件

vi /usr/local/nagios/etc/objects/windows.cfg

找到

define host{
        use             windows-server  ; Inherit default values from a template
        host_name       winserver       ; The name we're giving to this host
        alias           My Windows Server       ; A longer name associated with the host
        address         192.168.146.1   ; IP address of the host
        }

修改IP地址以及主机名

3. 主机上安装agent NSClient++
下载地址:

下载完成后双击安装。

4.配置nsclient++

找到配置文件nsclient.ini
找到并且编辑正确的IP地址
; ALLOWED HOSTS - A comaseparated list of allowed hosts. You can use netmasks (/ syntax) or * to create ranges.
allowed hosts = 192.168.146.136

5.重启nagios服务

[root@vnagios ~]# /etc/init.d/nagios restart
Restarting nagios (via systemctl):                         [  OK  ]
[root@vnagios ~]#

刷新页面可以看到已经可以看到windows 主机了

nagios4