NCPA Agent Install, Configuration and Example Usage

Nagios and NagiosXI

NagiosXI has a multitude of ways of monitoring hosts or services. Typically with a Microsoft Windows or Linux host you can monitor using SNMP, but you may also now want to check out the NCPA agent as a way to monitor from NagiosXI. Newer versions of NagiosXI also give the ability to administer, update and track the status of the NCPA agent on each monitored host, so you can tell when you need to upgrade the agent, handy!

The NCPA Agent is a custom monitoring agent that can be installed on Microsoft Windows or Linux machines for both active and passive monitoring of the standard CPU, RAM, Disk, Network and Services, but also for running of local custom plugins.

To avoid just repeating the official documentation, you can find the full installation and configuration guides here: NCPA Getting Started.

Once installed, you can use the NCPA Web Interface at: https://<FQDN>:5693, you need the Token you’ll specify during installation.

Microsoft Windows – Installation Quick Start

Download the latest version from: https://www.nagios.org/ncpa/#downloads, then install as follows:

ncpa-3.0.1.exe /S /TOKEN='<MY_TOKEN>'

The above installation only installs the NCPA agent in active monitoring mode, for enabling the passive monitoring mode you need to configure the ncpa.cfg file with additional options, but this is beyond the scope of this document.

You may also need to open the firewall for the Port 5693, it is strongly advised to restrict the sources to only the NagiosXI Servers.

Linux – Installation Quick Start

Download the latest version from: https://www.nagios.org/ncpa/#downloads and install using the following procedure:

# Add to the apt sources list
echo "deb https://repo.nagios.com/deb/$(lsb_release -cs) /" > /etc/apt/sources.list.d/nagios.list
 
# Add our public GPG key
wget -qO - https://repo.nagios.com/GPG-KEY-NAGIOS-V3 | apt-key add -
 
# Update your repositories
apt-get update
 
# Install NCPA Agent
apt-get install ncpa

The above installation only installs the NCPA agent in active monitoring mode, for enabling the passive monitoring mode you need to configure the ncpa.cfg file with additional options, but this is beyond the scope of this document.

You may also need to open the firewall as follows, it is strongly advised to restrict the sources to only the NagiosXI Servers.

ufw allow from <Nagios Server IP> to any port 5693

 
ufw status

Example Usage

Example CPU Average Utilisation active monitoring:

./check_ncpa.py -H server.domain.com -t '<MY_TOKEN>' -M 'cpu/percent' -w 70 -c 90 -q 'aggregate=avg'
OK: Percent was 50.00 % | 'percent'=50.00%;70;90;

Example service status monitoring (“Task Scheduler”):

./check_ncpa.py -H server.domain.com -t '<MY_TOKEN>' -M 'services' -q 'service=Schedule,status=running'OK: Schedule is running

For other available API endpoints you can monitor you can consult the NCPA Web Interface at: https://<FQDN>:5693 API section.

Leave a Reply

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