How to install NSClient on Windows

Share on Social Media

In this tutorial, you will learn, how to install NSClient on Windows. #centlinux #linux #nagios

Problem Definition:

We have already configured our Nagios Monitoring Server in my previous post Install Nagios Core on CentOS 6. Now, its time to add some hosts to our Nagios Monitoring Server. For this purpose, we need to install a Monitoring Agent software in our Host. There are many Monitoring Agents are available, that works well with not only Nagios, but also with other forks of Nagios (such as Icinga). But after having some research we have selected NSClient++.

In this post, we will install NSClient++ Nagios Core Agent on a Windows host to add it to Nagios Monitoring Server.

Before moving forward, it is required to have basic concepts of Nagios Core 4. Therefore, it is highly recommended that you should have Learning Nagios – Third Edition (PAID LINK). It will be really helpful for you during your Nagios journey.

System Specification:

1) Nagios Monitoring Server – A working Nagios Core Server.

  • Hostname – nagios01.example.com
  • IP Address – 192.168.229.129/24

2) Windows Host – A windows machine, in which we are going to install NSClient++.

  • Hostname – winserver.example.com
  • IP Address – 192.168.229.1/24

Install NSClient on Windows:

Download NSClient++ from Nagios Exchange.

NSClient++ Download Page

We are installing NSClient++ on a 64-bit host, therefore, we have downloaded 64-bit Setup.

Install the downloaded plugin.

NSClient++ Setup - Welcome

Click on Next.

NSClient++ Setup - License

Read and Agree with the License, then click on Next.

NSClient++ Setup - Setup Type

Move on with the Typical setup type.

NSClient++ Setup - Configuration 1

Click on Next.

NSClient++ Setup - Configuration 2

Append the IP address of Nagios Monitoring Server to Allowed Hosts. Check two options as shown in the screenshot and click on Next. Also note down the Password, because we will need it later.

NSClient++ Setup - Ready to Install

Click on Install.

NSClient++ Setup - Install Progress
NSClient++ Setup - Completed

NSClient++ has been installed successfully. Click on Finish to complete installation.

Open command prompt and execute following to check status of NSClient++ Agent Service.

C:UsersAdministrator>sc getdisplayname nscp
[SC] GetServiceDisplayName SUCCESS
Name = NSClient++ (x64)

C:UsersAdministrator>sc query nscp

SERVICE_NAME: nscp
        TYPE               : 10  WIN32_OWN_PROCESS
        STATE              : 4  RUNNING
                                (STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0

C:UsersAdministrator>netstat -a -n -o | findstr 12489
  TCP    0.0.0.0:12489          0.0.0.0:0              LISTENING       6980
  TCP    0.0.0.0:12489          0.0.0.0:0              LISTENING       6980
  TCP    [::]:12489             [::]:0                 LISTENING       6980

C:UsersAdministrator>

The NSClient++ service runs on Port 12489/tcp. Our tests show that it is up and listening for the requests.

Now, log on to Nagios Monitoring Server thru ssh and add server-side configurations.

A sample template for windows-servers is already located at /usr/local/nagios/etc/objects/windows.cfg. we added the IP address of my Windows host in it, and keep the remaining services definitions unchanged.

# vi /usr/local/nagios/etc/objects/windows.cfg
define host{
        use             windows-server   ; Inherit default values from a template
        host_name       winserver        ; The name we're giving to this host
        alias           My Windows Server       ; A longer name associated with the host
        address         192.168.229.1    ; IP address of the host
        }

We also need to add this configuration file to nagios.cfg.

# cat >> /usr/local/nagios/etc/nagios.cfg << EOF
> cfg_file=/usr/local/nagios/etc/objects/windows.cfg
> EOF

Edit the commands.cfg file in the vi editor and add the Password of NSClient++ in the check_nt command as follows.

# vi /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 -s frAQBc8Wsa1xVPfv -v $ARG1$ $ARG2$
        }

Restart Nagios service to reload changes.

# systemctl restart nagios.service 

Now open Nagios Web UI in browser.

Nagios Web UI

Checkout the winserver that we have added recently. A couple of services are already defined by the Nagios here.

Conclusion – Install NSClient on Windows:

We have successfully install NSClient on Windows and add that Windows host to Nagios Monitoring Server.

Scroll to Top