Monitor Remote Windows Machine Using Nagios on Linux

Monitoring private services or attributes of a Windows machine requires that you install an agent on it. This agent acts as a proxy between the Nagios plugin that does the monitoring and the actual service or attribute of the Windows machine. Without installing an agent on the Windows box, Nagios would be unable to monitor private services or attributes of the Windows box.

For this example, we will be installing the NSClient++ addon on the Windows machine and using the check_nt plugin to communicate with the NSClient++ addon. The check_nt plugin should already be installed on the Nagios server

Configurations in Windows Server

1) Install NSClient++ on the remote windows server

http://sourceforge.net/projects/nscplus/  ( only for 64bit processors )

( 32 bit version can be downloaded from : http://www.nsclient.org/nscp/downloads )

In this new version , we can very easily install and configure the NSClient.
While installaling in the 4th step it will ask for the allowed hosts, here you can sepecify the nagios server. No need to set the password.

Once the installation is completed then the service will start automatically.

2) Confirm port=12489 is uncommented in NSC.in )

( Edit the C:\Program Files\NSClient++\NSC.ini file and uncomment the port# under [NSClient] section)

3) Open the services manager and make sure the NSClientpp service is allowed to interact with the desktop (see the ‘Log On’ tab of the services manager). If it isn’t already allowed to interact with the desktop, check the box to allow it to.

( Go to Control Panel -> Administrative Tools -> Services. Double click on the “NSClientpp” service and select the check-box that says “Allow service to interact with desktop” )

Configurations in Nagios Server

1) Confirm check_nt command is enabled in /usr/local/nagios/etc/objects/commands.cfg

# ‘check_nt’ command definition
define command{
command_name    check_nt
command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
}

2) create new services.cfg file for the windows server .

vi  /usr/local/nagios/etc/objects/clients/windows-server.cfg

# Define the host

define host{
host_name               windows-adminlogs.info
alias                   remote-windows-server
address                 192.168.0.50
check_command           check-host-alive
contact_groups          admins
use                     generic-host
}

# Define the services

define service{
use                     generic-service
host_name               windows-adminlogs.info
service_description     Uptime
contact_groups          admins
check_command           check_nt!UPTIME
}

define service{
use                     generic-service
host_name               windows-adminlogs.info
service_description     CPU Load
check_command           check_nt!CPULOAD!-l 5,80,90
}

define service{
use                     generic-service
host_name               windows-adminlogs.info
service_description     Memory Usage
check_command           check_nt!MEMUSE!-w 80 -c 90
}

define service{
use                     generic-service
host_name               windows-adminlogs.info
service_description     C:\ Drive Space
check_command           check_nt!USEDDISKSPACE!-l c -w 80 -c 90
}

define service{
use                     generic-service
host_name               windows-adminlogs.info
service_description     D:\ Drive Space
contact_groups          admins
check_command           check_nt!USEDDISKSPACE!-l c -w 80 -c 90

3) Add the new configuration file in nagios configuration

vi /usr/local/nagios/etc/nagios.cfg
cfg_file=/usr/local/nagios/etc/objects/clients/windows-server.cfg

4) Verify the configurations and syntax are correct

nagios -v /usr/local/nagios/etc/nagios.cfg

5) Restart nagios

Yes, now you can monitor your windows servers from linux

More nagios docs here : Adminlogs Nagios Docs