Adding Windows hosts to Nagios for monitoring
Nagios core is one of the most widely used free & open-source software for monitoring our IT infrastructure. We can monitor resource utilization like memory, cpu etc of servers, firewalls, switches , network etc. In our earlier tutorial, we installed & configured a nagios server which was monitoring the resources of the localhost on which it was installed.
In this tutorial, we are going to add a windows client machine to nagios for monitoring. The way we do this is by using a software called, NSClient ++. It is a monitoring agent that is used with nagios to monitor the resources of a window system. NSClient ++ can also be used with other monitoring tools like icinga, naemon, OP5 etc. Its installation on windows machine is very simple, so we will now install NSClient++ on our Windows client machine & will then configure Nagios server to receive resource updates from Windows client machine via NSClient ++.
STEP 1 – Installing NSclient++
We need to grab the latest version of NSClient++, which is available on the link mentioned below,
If other versions are needed, they can be located at,
The downloaded file will be a .msi file. To install it, goto the folder with downloaded package & double click on the package to run it,
1- Once the setup starts, click next on the initial screen,
2- On the next screen , accept the License agreement & click on next,
3- On the setup type, choose ‘Typical’ (although you can also select other options but make sure you know what you are doing)
4- Leave the configuration screen as it is, & hit next,
5- This now is the most important step, here you need to enter the IP address of the nagios server, which in our case is 192.168.1.100
6- Once the Nagios server ip address has been entered, hit next & on next screen hit install to start the setup. Once the setup completes, press finish to complete the setup.
Our setup Windows client machine is now complete & we will now configure our nagios server to receive update from client machine.
STEP 2 – Configuring Nagios
We will firstly edit the nagios configuration file i.e. nagios.cfg, so open the file to edit it,
$ vi /usr/local/nagios/etc/nagios.cfg
& then uncomment the following line
# Definitions for monitoring a Windows machine
We need to uncomment this line because we want nagios server to identify this file as part of its configuration. Windows.cfg is the file where we will enter the details related to Windows client machines.
Next we will edit the windows.cfg file & add the information regarding our Windows Client machine,
$ vi /usr/local/nagios/etc/objects/windows.cfg
Already there is a sample host definition written into the file, copy it or edit it to enter details regarding our Windows client machine.
After we have added our client information , we will now edit Service Definitions, which are present in the same file just under host definition. Though these don’t require any changes but you can add more services to the present list of services that you need monitored. Once all the changes have been made, save & exit the file.
Lastly verify the nagios configuration file to make sure that all the changes made are correct. To check nagios configuration file, run
$ /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Output should show no errors & warning found, & then we will restart nagios server for changes to take effect.
$ service nagios restart
STEP 3 Open Web-console
Now we will login to our nagios webcosole, by entering the IP address of the nagios server
Then provide the login credentials, once authenticated goto services overview. We will now find that all the windows services are also being shown here along with our localhost services.