Nagios NSClient++ to Monitor Remote Windows Server

Scenario / Question:

How do I monitor a remote Windows system using Nagios

Solution / Answer:

Use the NSClient++ addon to execute Nagios plugins on the remote server and report back to the monitoring host server.

NSClient++ Remote Server Installation and Setup

Make a directory:

C:\NSClient++

Download NSClient++ from sourceforge into directory C:\NSClient++:

NSClient++

Install the NSClient++.msi:

NSClient++ Install

NSClient++ Install

NSClient++ Install2

NSClient++ Install2

NSClient++ Install3

NSClient++ Install3

NSClient++ Install4

NSClient++ Install4

NSClient++ Install5

NSClient++ Install5

NSClient++ Install6

NSClient++ Install6

Configure NSClient++ Windows Service Settings:

NSClient++ Windows Service Settings:

NSClient++ Windows Service Settings:

Enable “Allow service to interact with desktop”

NSClient++ Windows Service Settings:

NSClient++ Windows Service Settings:

Configure Windows Firewall to allow NSClient++ access:

Add on Exception to the Windows Firewall to allow access to nsclient++

Start – > Control Panel -> Windows Firewall -> Exceptions -> Add Program -> Browse

C:\Program Files\NSClient++\nsclient++.exe

Nagios Monitoring Host Server Setup

Activate windows.cfg object template file by editing nagios.cfg and uncomment (remove the #):

# vi /usr/local/nagios/etc/nagios.cfg

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

Configure NSClient++ password protection:

# vi /usr/local/nagios/etc/objects/commands.cfg

Change the check_nt command to include the password argument “-s”. Change “yourpassword” to the password you chose during the NSClient++ software install:

define command{

	command_name	check_nt

	command_line	$USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -s yourpassword -v $ARG1$ $ARG2$

	}

Edit Windows Object Template:

Replace the values “host_name” “alias” “address” with the values that match your setup:

** The “host_name” you set for the “define_host” section must match the “host_name” in the “define_service” section **

# vi /usr/local/nagios/etc/objects/windows.cfg
define host{

	use		windows-server	; Inherit default values from a Windows server template (make sure you keep this line!)

	host_name		mywinserver

	alias		Windows Server

	address		192.168.1.100

	}

define service{

	use			generic-service

	host_name			mywinserver

	service_description	NSClient++ Version

	check_command		check_nt!CLIENTVERSION

	}

Verify Nagios Configuration Files:

# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Total Warnings: 0
Total Errors:   0

Restart Nagios:

# service nagios restart

NSClient++ Port Forwarding and Firewall

The default port for NSClient++ is 12489

You must allow the firewall at your remote server to allow this port access.

Changing NSClient++ port:

You can change the NSClient++ port by modifying the NSC.ini file located at C:\Program Files\NSClient++ (remove “;”)

;# NSCLIENT PORT NUMBER
;  This is the port the NSClientListener.dll will listen to.
port=12489

Restart the NSClient++ service

Change check_nt -p 12489 argument 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 portnumber -s cjr-nagios -v $ARG1$ $ARG2$
        }
Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
Fabio Milano has written 79 articles for us. Fabio Milano is a certified RHCE, MCP, and CFOI. He runs an IT consulting and services company called RDS Support inc. Website:http://www.rdssupport.com
The information provided is for educational purposes only. All content including links and comments is provided "as is" with no warranty, expressed or implied. Use is at your own risk and you are solely responsible for what you do with it.

11 Comments so far

  1. Charles on September 4th, 2009

    My question pertains to the scalability and manageability of the password security implementation of Nagios/NSClient .

    It appears that the password is specified when NSClient is installed and can only be changed by going into NSClient on the monitored server.

    What is the best practice for Nagios deployed in an environment of 50 , 100 , 500 Windows servers where the passwords for service accounts must be changed periodically?

  2. Michael on March 30th, 2010

    What about submitting passive checks to the Nagios server, for monitored entities behind firewalls and routers that hide individual IP addresses of workstations and servers?

    Passive mode means that only one IP needs to be exposed to the internet – the Nagios server doing the monitoring. Otherwise this is just mucking around, no client wants their Desktop Workstations addressable from the wider internet.

    Passive monitoring is a requirement in this day and age, and I’m surprised this client still doesn’t do this.

  3. Fabio Milano on March 30th, 2010

    Passive checks are possible.

    Check out this page

    http://nagios.sourceforge.net/docs/2_0/passivechecks.html

  4. [...] Nagios NSClient++ a?a??daki rehberde anlat?ld??? ?ekilde kurun: http://www.kernelhardware.org/nagios-nsclient-to-monitor-remote-windows-… [...]

  5. Ramya on September 29th, 2010

    I have enabled SNMP instead of using NSClinet now i would like to monitor services like IIS ADMIN Services

  6. Babu on February 3rd, 2011

    How to monitor the log file in Windows as we have check_log for UNIX.

  7. Arman on March 28th, 2011

    Will the same client work for Windows 64 server also.

  8. Confluence: JPBerlin on July 7th, 2011

    VCenter…

    Installation von NSClient\ Quelle:…

  9. Confluence: JPBerlin on September 19th, 2011

    Heinlein vCenterServer…

    Systemdokumentation: Basissystem: Windows Server 2008 64 Bit. ServerManager: Zu Aktivieren und Konfigurieren gilt es: Multipath E/A für die Anbindung des vCenters an die Storagesysteme,……

  10. Confluence: Heinlein HOSTING on January 11th, 2012

    Heinlein vCenterServer…

    Systemdokumentation: Basissystem: Windows Server 2…

  11. Confluence: Heinlein HOSTING on January 24th, 2012

    VcenterServer…

    Systemdokumentation: Basissystem: Windows Server 2…

Leave a reply