Up To: Contents
See Also: Quickstart Installation Guide, Monitoring Publicly Available Services
Introduction
This document describes how you can monitor "private" services and attributes of Windows machines, such as:
Publicly available services that are provided by Windows machines (HTTP, FTP, POP3, etc.) can be monitored easily by following the documentation on monitoring publicly available services.
Note: These instructions assume that you've installed Nagios according to the quickstart guide. The sample configuration entries below reference objects that are defined in the sample config files (commands.cfg, templates.cfg, etc.) that are installed if you follow the quickstart.
Monitoring private services or attributes of a Windows machine requires that you install an agent on it. This agent acts as a proxy between the Nagios plugin that does the monitoring and the actual service or attribute of the Windows machine. Without installing an agent on the Windows box, Nagios would be unable to monitor private services or attributes of the Windows box.
There are several steps you'll need to follow in order to monitor a new Windows machine. They are:
Before you can begin monitoring private services and attributes of Windows machines, you'll need to install an agent on those machines. We recommend using Nagios cross-platform agent, which can be found at https://www.nagios.org/ncpa/.
These instructions will take you through a basic installation of the NCPA agent, as well as the configuration of Nagios for monitoring the Windows machine.
Most of the configuration will be located in the C:\Program Files (x86)\Nagios\NCPA\etc\ncpa.cfg file. See detailed instructions on how to configure the NPCA agent on Windows in our Help Documentation. After modfying the configuration files and saving them, you will need to restart the NPCA services, so that changes can take effect. You can do this from the services administration panel (in the GUI) or from the command line (CMD Prompt):
net stop ncpalistener net start ncpalistener
net stop ncpapassive net stop ncpapassive
Knowing what you want to monitor will help you figure out what sort of checks you will need NCPA to perform. This could include your own custom plugins - or just data that NCPA can get itself. That is entirely up to the end user. For this example we will monitor the following using only NCPA built-ins:
There are many more endpoints, but you can read the help documentation to see more options.
Once you've decided what to monitor, you can choose how to monitor it. There are two types of checks you can use. Active checks are ran using a plugin on the Nagios Core side, which will put most of the load on the server. If you have a lot of checks and want to move some of the load or you have a system that sometimes drops connections, you might want to use a passive check. Passive checks run on the client side and send the check results to Nagios Core for processing. NCPA can do both kinds of checks, so it's up to you to choose.
The steps below will cover some basic information on how to install the check_ncpa.py plugin, create a new command, host, and service definitions in Nagios Core.
Run the following commands from the command line on your Nagios server:
cd /tmp wget https://assets.nagios.com/downloads/ncpa/check_ncpa.tar.gz tar xvf check_ncpa.tar.gz chown nagios:nagios check_ncpa.py chmod 775 check_ncpa.py mv check_ncpa.py /usr/local/nagios/libexec
Note: If you have a different path to the nagios plugins directory, you will need to modify the last command.
To verify the version of the check_ncpa.py plugin, run the following command from the command line:
/usr/local/nagios/libexec/check_ncpa.py -V
You should see something like this:
check_ncpa.py, Version 1.1.0
Create the check_ncpa command in your configuration files for Nagios Core, normally they are located in /usr/local/nagios/etc - you may have a commands.cfg file you will want to put this command in. The command below will allow us to pass most of the arguments in with $ARG1$, allowing it to be more dynamic.
define command { command_name check_ncpa command_line $USER1$/check_ncpa.py -H $HOSTADDRESS$ $ARG1$ }
You can create the checks in a config file in /usr/local/nagios/etc. For this example we will create a config file called ncpa.cfg with the following defined:
define host { host_name NCPA 2 Host address 192.168.1.10 check_command check_ncpa!-t 'mytoken' -P 5693 -M system/agent_version max_check_attempts 5 check_interval 5 retry_interval 1 check_period 24x7 contacts nagiosadmin notification_interval 60 notification_period 24x7 notifications_enabled 1 icon_image ncpa.png statusmap_image ncpa.png register 1 } define service { host_name NCPA 2 Host service_description CPU Usage check_command check_ncpa!-t 'mytoken' -P 5693 -M cpu/percent -w 20 -c 40 -q 'aggregate=avg' max_check_attempts 5 check_interval 5 retry_interval 1 check_period 24x7 notification_interval 60 notification_period 24x7 contacts nagiosadmin register 1 } define service { host_name NCPA 2 Host service_description Memory Usage check_command check_ncpa!-t 'mytoken' -P 5693 -M memory/virtual -w 50 -c 80 -u G max_check_attempts 5 check_interval 5 retry_interval 1 check_period 24x7 notification_interval 60 notification_period 24x7 contacts nagiosadmin register 1 } define service { host_name NCPA 2 Host service_description Process Count check_command check_ncpa!-t 'mytoken' -P 5693 -M processes -w 150 -c 200 max_check_attempts 5 check_interval 5 retry_interval 1 check_period 24x7 notification_interval 60 notification_period 24x7 contacts nagiosadmin register 1 }
Restart the Nagios service and you should see pending hosts/services appear. Once they do their initial checks, you should see your NCPA data in Nagios.
In order for passive checks to work, you have to configure your passive service to actually send the checks. By default in new installs of NCPA 2, no passive handler is configured. If you installed on Windows and set up NRDP during the install process then you will already have a configuration set up. However, it would be a good idea to take a closer look at your configuration just in case.
Add a new NCPA configuration file to the ncpa.cfg.d directory located in the base NCPA installation directory. Use the following outline for passive checks to send to the NRDP server of your choice.
[passive checks] %HOSTNAME%|__HOST__ = system/agent_version %HOSTNAME%|CPU Usage = cpu/percent --warning 60 --critical 80 --aggregate avg %HOSTNAME%|Memory Usage = memory/virtual --warning 80 --critical 90 --units Gi %HOSTNAME%|Process Count = processes --warning 300 --critical 400
%HOSTNAME%|CPU Usage|30 = cpu/percent --warning 60 --critical 80 --aggregate avg
Once you have your settings. Edit your ncpa.cfg file to look something like the following:
[nrdp] parent = http:/<nrdp address>/nrdp/ token = nrdptoken hostname = NCPA 2 Host
Enable the nrdp handler in the
[passive] handlers = nrdp
You should start receiving passive check results immediately after the service has been restarted. A service restart is always required when making changes to the passive check configuration