Tuesday, January 23, 2024

Configure Nagios to monitor Remote Windows Host

To configure Nagios to monitor a remote Windows host, you'll need to set up NSClient++ on the Windows machine. 

Install Nagios on the Monitoring Server 

I did it in Install Nagios Core on Oracle Linux 8.5 (OL8.5) post.

On the Windows Server

1. Download NSClient++ using this link  Nsclient05.2

2. For Installing Nsclient++ on the Windows server dot the following steps

Double-click on the installation file


Choose the generic option

Choose the typical option

Enter the Nagios server's IP address and check the (check_nt) option

Click install and finish

Go to the file C:\Program Files\NSClient++  path and edit nsclient.ini file and enable the following Item by changing disabled to enabled or (=1)

CheckExternalScripts = 1
CheckHelpers = 1
CheckEventLog = 1
CheckNSCP = 1
CheckDisk =1
CheckSystem = 1

Restart the nsclient service on windows


On the Nagios Server

1. In nagios server, edit nagios.cfg file and uncomment windows



2. Test whether the Nagios server can monitor the Windows server or not.

##Example: checking the Windows server uptime
[root@emcl libexec]# ./check_nt -H 192.168.56.4 -p 12489 -v UPTIME
System Uptime - 0 day(s) 1 hour(s) 27 minute(s) |uptime=87

##Example: Checking memory used in the Windows server
[root@emcl libexec]# ./check_nt -H 192.168.56.4 -p 12489 -v MEMUSE
Memory usage: total:11839.65 MB - used: 1655.86 MB (14%) - free: 10183.79 MB (86%) | 'Memory usage'=1655.86MB;0.00;0.00;0.00;11839.65

3. Edit windows.cfg file, and add the new Windows host machine that we want to monitor.


[root@emcl ~]# vi /usr/local/nagios/etc/objects/windows.cfg

define host {
        use                             windows-server         ; Inherit default values from a template
        host_name                       WIN-VV69BDNGNH2        ; The name we're giving to this server
        alias                           windows-servers         ; A longer name for the server
        address                         192.168.56.4           ; IP address of Windows remote
}

define hostgroup {

    hostgroup_name          windows-servers         ; The name of the hostgroup
    alias                   Windows Servers         ; Long name of the group
}

define service{
        use                     generic-service
        host_name               WIN-VV69BDNGNH2
        service_description     NSClient++ Version
        check_command           check_nt!CLIENTVERSION
        check_interval          1
        max_check_attempts      1
        retry_interval          1
        }

define service{
        use                     generic-service
        host_name               WIN-VV69BDNGNH2
        service_description     Drive C Disk usage
        check_command           check_nt!USEDDISKSPACE!-l C
        check_interval          1
        max_check_attempts      1
        retry_interval          1
        }
Save the file and check if every this is working without any errors and restart nagios service on Nageios server
[root@emcl etc]#  /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
[root@emcl libexec]# systemctl restart nagios


Check the Nagios in browser






No comments:

Post a Comment

Enhancing Query Performance: Leveraging In-Memory Optimized Dates in Oracle 23ai

In-Memory Column Store Unlike traditional row-based storage, The  In-Memory Column Store  (IM column store) stores tables and partitions in ...