NSClient++ is a monitoring agent/daemon for Windows systems that makes it easier to collect performance metrics by Nagios.
In this tutorial, we are going to learn how to install and configure NSClient++ nagios monitoring agent for Windows systems. Follow through the following steps to install NSClient++.
Download NSClient Agent
Download the latest version of NSClient from here.
Once the download is done, run the binary installer as an administrator to install the application.
Once the installation launches, accept the default options until where you are prompted to choose the setup type.
Select the Typical installation setup type and click Next. This takes you to agent configuration window as shown in the screenshot below;
Edit the default configurations shown above as follows;
- Under Allowed hosts: replace the loopback-v6 address, ::1, with the IP of the Nagios Server. (In case of AlienVault, enter the IP of the Sensor)
- Under the Password: delete the existing string and set a Strong Password for use for communication between the Server and the Client.NOTE: The Password has to be same for a group of hosts.
- Under “Modules to load:”
- Check “Enable common check plugins” and “Enable nsclient server (check_nt)“
- Uncheck the “Enable NRPE Server (check_nrpe)”
Click Next and then Install button to launch the installation.
Once the Installation is complete, click finish button to run the client.
Note that the NSClient service (nscp) will automatically run after installation. It will also set a firewall rule to allow it access. Also note that nscp service listens on port 12489.
Enable System Service and Disk Space Checks
Open the NSClient configuration file, C:\Program Files\NSClient++\nsclient.ini, with file editor such as Notepad and enable Disk space as well as System check that are disabled by default. See the highlighted lines below.
# If you want to fill this file with all available options run the following command: # nscp settings --generate --add-defaults --load-all # If you want to activate a module and bring in all its options use: # nscp settings --activate-module <MODULE NAME> --add-defaults # For details run: nscp settings --help ; TODO [/settings/default] ; Undocumented key password = STRONGPASSWORD ; Undocumented key allowed hosts = 127.0.0.1,192.168.43.101 ; TODO [/modules] ; Undocumented key CheckExternalScripts = disabled ; Undocumented key CheckHelpers = disabled ; Undocumented key CheckEventLog = disabled ; Undocumented key CheckNSCP = disabled ; Undocumented key CheckDisk = enabled ; Undocumented key CheckSystem = enabled ; Undocumented key NSClientServer = enabled
Once the changes are made, save the file and restart the NSClient service (nscp).
You can also use powershell to restart the service.
net stop nscp net start nscp
The installation and configuration of the NSClient is now complete. You can test from the server that the services are actually being monitored.
For example to test for cpu load from Nagios server,
# /usr/lib/nagios/plugins/check_nt -H 192.168.43.218 -p 12489 -s STRONGPASSWORD -v CPULOAD -l 5,80,90 CPU Load 0% (5 min average) | '5 min avg Load'=0%;80;90;0;100