To configure Nagios to monitor a remote Windows host, you’ll need to set up NSClient++ on the Windows Machine.
I did it in the Install Nagios Core on Oracle Linux 8.5 (OL8.5) post.
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 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
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 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 this is working without any errors and restart Nagios service on Nagios 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 the browser