1-888-310-4540 (main) / 1-888-707-6150 (support) info@spkaa.com
Select Page

How to monitor Windows servers using Nagios and NSClient

Published by SPK Blog Post
on July 12, 2011

One of the best monitoring software packages available for system administrators is Nagios. It’s free, open source, has a large community of developers and users for support and can be relied upon to provide outstanding monitoring for mission critical devices.

As part of our infrastructure management service, SPK uses Nagios to give us quick and helpful information at our various clients to resolve issues before the end user does. It can be used for basic connectivity checks or more complex checks like automated web page logins or remote server checks for available disk space. Nagios is native to the Unix environment and as such, it is very easy to setup monitoring on remote Unix-based hosts. Typically, your Nagios server will do basic checks right out of the box for your servers, such as connectivity checks. But to handle more in depth monitoring, you would need to install a NRPE (Nagios Remote Plugin Execution) client on the servers that you want to monitor. Nagios provides a  native Unix-based client, but does not provide a Windows-based client. That’s where NSClient comes in. It’s a Windows-native NRPE service that can run on a wide variety of Windows-based servers and even workstations.

Here’s a diagram of how it works:

As you can see, the Nagios servers in the above diagram send a request to the Windows computers, asking them to execute a command called CheckCPU. The NSClient service running on the Windows computers runs the command, checks the CPU and returns the result to the Nagios server. The Nagios server parses the OK message and reports everything is fine. If something was wrong, it would report back a CRITICAL error and Nagios would send an alert if one has been defined.

So, how do we set this up? For this example, I am going to assume that you have a functioning Nagios monitoring server setup and functional.

1. First, we need to download the NSClient program for Windows. You can obtain this at http://www.nsclient.org

2. Next, after downloading the client, install it on your Windows computer. I recommend not modifying any of the options in the installation wizard as we will be customizing the installation a bit later. Make sure NOT to start the client after installing. There is an option in the wizard to start the service after installation, we don’t want to do that just yet.

3. After the program is installed, navigate to the NSClient++ directory which should be in your C:\Program Files directory.

4. There is a file named NSC.ini in there. This is the main configuration file for NSClient. Open this in your favorite text editor.

5.  In the first section [Modules] uncomment the following:


6. Further down in the NSC.ini file, in the [Settings] section make sure these are set:

allowed_hosts=<set to the IP address of your Nagios server(s)>

7. Now in the [NRPE] section we need to enable the following:


This will allow us to send commands to the Windows client that require arguments. Alternatively, you can create aliases for commands and leave this option unset, but I find it easier for testing to leave it enabled.

8. In the [External Script] section, there is an option for allow_arguments=1, make sure that is enabled as well.

9. And that’s it for a basic, working configuration. Now click on your Start Menu, Programs, NSClient++, and then click on Start NSClient++, this will start the client and specifically the NRPE listener.

10. Now, from your Nagios server, head over to the libexec directory for Nagios, typically in the /usr/local/nagios/libexec directory and type the following command:

check_nrpe -H <IP or name of Windows computer>

You should get a response like this:

I ( 2008-07-02) seem to be doing fine...

If it’s not working, make sure you check the log file on the Windows computer in the main NSClient++ directory under Program Files. This should give you an indication of what’s wrong. Also make sure there’s no firewall rules blocking incoming connections on the Windows machine.

11. If you got a response, you’ve now got a working NRPE client for Nagios on Windows! Congrats!

There’s a lot more configuration and commands that can be added, but I will be discussing those in my next post. Stay tuned!

Have any thoughts or comments regarding Windows monitoring with Nagios or NSClient tips and tricks? Feel free to share in the comments section below!

Bradley Tinder
Systems Integrator, SPK and Associates

Latest White Papers

Three Trends Are Transforming The Service Desk

Three Trends Are Transforming The Service Desk

Your IT service desk is about to change. Find out what's shaping the future. Three factors — enterprise service management (ESM), collaboration, and intelligent service management — are driving the transformation of the service desk. To better meet customers’ needs...

Related Resources

Is The IT Department Really “Dead?”

Is The IT Department Really “Dead?”

“It’s Time to Get Rid of the IT Department.”  That was the title of an opinion piece recently published in the Wall Street Journal.  Provocative?  Sure.  My answer to this is not “yes,” but many of the author’s points are valid.  The Same Old IT Department? No, the IT...

How To Add More Disk Space To Your Redhat Server Without Reformatting

How To Add More Disk Space To Your Redhat Server Without Reformatting

(Originally published in 2012, updated January 2022.) One of the common tasks for any system administrator is managing disk space on a server. A common question is how to increase disk space on a linux system. I won't go into a boring lecture on why managing disk...

January 2022 vCAD feature updates

January 2022 vCAD feature updates

Happy New Year vCAD Users! It was a busy 2021 in terms of vCAD development and feature enhancements. We've been receiving lots of feedback regarding the platform, and we're assembling a roadmap for 2022 based on our users' needs. Here's what to expect in 2022:...