CentOS 8
Sponsored Link

Nagios 4 : Add Target Host (Windows)2020/01/15

 
It's possible to monitor Windows computers on the network.
For example, add Windows Server 2019 as monitoring target.
[1]
Download [NSClient++] on target Windows Host.
⇒ http://sourceforge.net/projects/nscplus/
[2] Install [NSClient++]. Input Nagios server's hostname or IP address and set any password during installation like follows. The password is used for the connection from Nagios server to Windows Host for monitoring.
[3] After installing, [NSClient++] has been started. It's not need to change Windows firewall settings because [NSClient++] installer has done it. But only for Ping monitoring, it does not use [NSClient++] program, so it needs to add ICMP allow rule manually.
[4] Configure Nagios server.
# install from EPEL

[root@dlp ~]#
dnf --enablerepo=epel -y install nagios-plugins-nt
[root@dlp ~]#
vi /etc/nagios/objects/commands.cfg
# line 225 : add the password you set on Windows [NSClient++] installer

define command {

    command_name    check_nt
    command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$ -s password
}

[root@dlp ~]#
vi /etc/nagios/servers/windows.cfg
# create new

# define target hosts

define host {
    use                      windows-server
    host_name                rx-7
    alias                    rx-7
    address                  10.0.0.101
}

define hostgroup {
    hostgroup_name          windows-servers
    alias                   Windows Servers
}

# for ping
define service {
    use                      generic-service
    host_name                rx-7
    service_description      PING
    check_command            check_ping!100.0,20%!500.0,60%
}

# for NSClient++ version
define service {
    use                     generic-service
    host_name               rx-7
    service_description     NSClient++ Version
    check_command           check_nt!CLIENTVERSION
}

# for uptime
define service {
    use                     generic-service
    host_name               rx-7
    service_description     Uptime
    check_command           check_nt!UPTIME
}

# for CPU load
define service {
    use                     generic-service
    host_name               rx-7
    service_description     CPU Load
    check_command           check_nt!CPULOAD!-l 5,80,90
}

# for memory usage
define service {
    use                     generic-service
    host_name               rx-7
    service_description     Memory Usage
    check_command           check_nt!MEMUSE!-w 80 -c 90
}

# for disk usage
define service {
    use                     generic-service
    host_name               rx-7
    service_description     C:\ Drive Space
    check_command           check_nt!USEDDISKSPACE!-l c -w 80 -c 90
}

# for explorer
define service {
    use                     generic-service
    host_name               rx-7
    service_description     Explorer
    check_command           check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe
}

# for IIS
define service {
    use                     generic-service
    host_name               rx-7
    service_description     W3SVC
    check_command           check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
}

[root@dlp ~]#
systemctl restart nagios

[5] It's possible to see the status for a new server on the admin site.
Matched Content