How To Add Windows Host To Nagios Using NSClient++

In the previous article, we already explain how to add Linux host to Nagios. Now, the article will explain how to add Windows host to Nagios. If we want to add Windows host to Nagios, we must install NSClient++ agent in windows host. You can download the agent in SourceForge site and choose whether using 32 bit or 64 bit based on your Windows architecture. I use IP 192.168.56.101 for Nagios Server, IP 192.168.56.103 for Windows host and 64 bit 0.4.1.90 version of NSClient++ for this article.

After you download the agent, click twice the installer and when the installer asks about configuration installation, I create like this:
nsclient++
After installation, go to Services page on Windows and find NSClient++:

Then right-click on NSClient++ and choose Properties. In Log On tab, click Allow Service to interact with desktop and then click OK.

After that, open installation folder in C:\Program Files\NSClient++ and open file nsclient.ini and add the script like this:

Go to Nagios server and in /usr/local/nagios/etc/nagios.cfg and uncomment windows.cfg:

And then go to /usr/local/nagios/etc/objects/windows.cfg file and change the IP of the host. After that go to /usr/local/nagios/etc/objects/commands.cfg file and change check_nt item become like this:

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

Finally, type the following commands and make sure there are no errors:

Go to browser and it should be a windows host display in Nagios.

And if you click Services, there is display like this:

So, we can monitor our Windows host on Nagios. If windows host status is Down in Nagios, please disable the firewall on Windows/Linux or insert port 12489 in the firewall on Windows/Linux.

References:
tecmint.com
thegeekstuff.com
middlewareprimer.com

Leave a Reply

Your email address will not be published. Required fields are marked *