×


Install Nagios NCPA on Linux and Windows - Step by Step Process ?

NCPA is intended to simplify and universalize agent-based monitoring

across different operating systems.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related Nagios queries.

In this context, we shall look into how to Install Nagios NCPA.


How to Install Nagios NCPA on Linux and Windows ?

Here, you will learn how to install the Nagios Cross Platform Agent (NCPA) on Windows and Linux.


Overview of NCPA Installation

Firstly, we will install NCPA using the ready built packages for the following platforms:

1. Windows

i. EXE Package

2. Linux

i. RHEL/CentOS/Oracle Linux

a. Nagios Repository

b. RPM Package

ii. Ubuntu / Debian

i. DEB Package

Also, we can install NCPA from source.


Active vs Passive

NCPA can be used for both Active and Passive monitoring:

  • Active: Nagios is responsible for performing the check on a schedule.
  • Passive: NCPA is responsible for submitting check results in Nagios.


The NCPA installer may prompt for settings for active and passive. Active is the most common method used. If we are not using passive monitoring, then we do not need to configure those settings.


How to Download NCPA Packages ?

Please visit the downloads page given below to obtain the relevant download package for our operating system (OS):

https://www.nagios.org/ncpa/#downloads

If we are installing NCPA on Linux, then we do not need to download it right now.


How to Install NCPA On Windows ?

The following instructions are for the graphical install of NCPA:

  • Firstly, navigate to the location that the installer package was downloaded to and double-click the installer, this will bring up the Welcome screen.
  • Then, click Next to continue.
  • Then, the license agreement will be shown.
  • Next, click I Agree.
  • Next, the configuration screen for Passive checks will be shown.
  • The only setting that is required here is a Token. This is what Nagios server will use to authenticate with NCPA.
  • Then, the Bind IP of 0.0.0.0 means that NCPA will listen on all IPv4 addresses on the Windows machine. The default port of 5693 is used.
  • Finally, click Next to proceed. The configuration screen for Passive checks will be shown.


We will need to check the Send passive checks over NRDP box to enable passive checks.


We will also need to provide the following NRDP settings:

  • URL: This is the URL on Nagios Host that accepts passive check results to be submitted.
  • NRDP Token: This is the token we will be using when passing NCPA passive checks to Nagios for NRDP to accept the check. This is separate from the token that was provided for active checks.
  • The URL and NRDP token in Nagios XI are configured via Admin > Check Transfers > Inbound Transfers.
  • Hostname: The hostname that the passive checks belong to on the Nagios server.
  • Then, click Next to proceed.
  • Continuing with Passive checks, we will be presented with the default passive service checks that will be executed and send to Nagios server.
  • Again, click Next to proceed.
  • Click the Install button to install NCPA.
  • Wait while NCPA is installed and configured.
  • Click Finish once NCPA has been installed.


How to Install NCPA On Windows – Silent ?

The installer also supports a silent install, which allows system administrators to easily manage their network workstations without disrupting the workflow of the office.

The following arguments are currently supported:

  • /S: This is how we tell the installer we are performing a silent install.
  • /D: The directory to install NCPA to. This is optional, must be the last argument,
  • cannot contain quotes and must be an absolute path.
  • /TOKEN: The token that will be used to access the agent's API and web interface.
  • /IP: The IP address to bind to. The default is 0.0.0.0 which binds to all IPv4
  • addresses. Use :: for binding to IPv6 addresses.
  • /PORT: The port to bind to. The default is 5693.
  • /NRDPURL: This is the URL on Nagios Host that accepts passive check results to be
  • submitted.
  • /NRDPTOKEN: This is the token we will be using when passing NCPA passive checks to Nagios for NRDP to accept the check. This is separate from the token that was provided for active checks.
  • /NRDPHOSTNAME: The hostname that the passive checks belong to on the Nagios server.


Using the previous graphic install of NCPA as an example, here is how to install NCPA silently using those settings:

ncpa-2.1.6.exe /S /TOKEN=’Str0ngT0k3n’ /NRDPURL=’http://10.25.5.12/nrdp/’
/NRDPTOKEN=’NRDP_T0k3n’ /NRDPHOSTNAME=’S1601′


How to Install NCPA On Linux ?

There are several methods for installing NCPA on Linux depending on OS distribution. We will need to establish a terminal session as a root user to complete these steps.

1. Using Nagios Repository

The Nagios Repository can be used to install NCPA on RHEL/CentOS/Oracle Linux.

i. Firstly, install the repository depending on the version of Linux.

6.x
rpm -Uvh http://repo.nagios.com/nagios/6/nagios-repo-6-4.el6.noarch.rpm
7.x
rpm -Uvh http://repo.nagios.com/nagios/7/nagios-repo-7-4.el7.noarch.rpm
8.x
rpm -Uvh http://repo.nagios.com/nagios/8/nagios-repo-8-1.el8.noarch.rpm

ii. Once the repository has been installed, we will need to execute the following command to install NCPA:

# yum install ncpa -y


2. Using RPM Package

An RPM package can be used to install NCPA on RHEL/CentOS/Oracle Linux. The step below depends on the version and architecture of Linux we are running.

RHEL/CentOS/Oracle Linux 6.x i386
rpm -Uvh https://assets.nagios.com/downloads/ncpa/ncpa-latest.el6.i386.rpm
RHEL/CentOS/Oracle Linux 6.x x86_64
rpm -Uvh https://assets.nagios.com/downloads/ncpa/ncpa-latest.el6.x86_64.rpm
RHEL/CentOS/Oracle Linux 7.x
rpm -Uvh https://assets.nagios.com/downloads/ncpa/ncpa-latest.el7.x86_64.rpm
RHEL/CentOS/Oracle Linux 8.x
rpm -Uvh https://assets.nagios.com/downloads/ncpa/ncpa-latest.el8.x86_64.rpm


i. Using DEB Package

An DEB package can be used to install NCPA on Ubuntu/Debian. The steps below depends on the version and architecture of Linux we are running.


Debian 8.x i386
wget https://assets.nagios.com/downloads/ncpa/ncpa-latest.i386.deb
dpkg -i ./ncpa-latest.i386.deb
Debian 8.x amd64
wget https://assets.nagios.com/downloads/ncpa/ncpa-latest.amd64.deb
dpkg -i ./ncpa-latest.amd64.deb
Debian 9.x i386
wget https://assets.nagios.com/downloads/ncpa/ncpa-latest.d9.i386.deb
dpkg -i ./ncpa-latest.d9.i386.deb
Debian 9.x amd64
wget https://assets.nagios.com/downloads/ncpa/ncpa-latest.d9.amd64.deb
dpkg -i ./ncpa-latest.d9.amd64.deb
Debian 10.x amd64
wget https://assets.nagios.com/downloads/ncpa/ncpa-latest.d10.amd64.deb
dpkg -i ./ncpa-latest.d10.amd64.deb
Ubuntu i386
wget https://assets.nagios.com/downloads/ncpa/ncpa-latest.i386.deb
sudo dpkg -i ./ncpa-latest.i386.deb
Ubuntu amd64
wget https://assets.nagios.com/downloads/ncpa/ncpa-latest.amd64.deb
sudo dpkg -i ./ncpa-latest.amd64.deb


How to Configure NCPA ?

Linux installations do not provide configuration options as part of the installer.

However, the configuration file in Windows is the same, hence the information here is also valid for Windows.

Here we can configure NCPA for Active checks.

The NCPA configuration file is located here:

/usr/local/ncpa/etc/ncpa.cfg


i. Firstly, open the file in any text editor.

ii. Then, find the following line:

community_string = mytoken

iii. Change it to our required token, for example:

community_string = Str0ngT0k3n

iv. When we have finished, save the changes and close the file.

v. We will now need to restart the ncpa_listener service for these changes to take effect.

vi. Then, restart Service.

The command required for this will differ depending on OS and version.

RHEL/CentOS/Oracle Linux 6.x
# service ncpa_listener restart
RHEL/CentOS/Oracle Linux 7.x+
# systemctl restart ncpa_listener.service
Ubuntu 12.x/13.x/14.x
$ sudo service ncpa_listener restart
Ubuntu 15.x+
$ sudo systemctl restart ncpa_listener.service
Debian 7.x
# service ncpa_listener restart
Debian 8.x +
# systemctl restart ncpa_listener.service


How to Configure Firewall – Windows ?

A firewall rule needs to be created on our Windows machine to allow incoming traffic to NCPA on TCP Port 5693:

  • To change the firewall settings, select Start and type firewall in the search dialog box and open Windows Firewall with Advanced Security.
  • Server 2012/2016 this is located at Server Manager > Tools > Windows Firewall with Advanced Security.
  • In the left hand pane, click Inbound Rules.
  • In the right hand pane, click New Rule.
  • Select Port.
  • Click Next.
  • Select TCP.
  • Select Specified local ports and type 5693 in the field.
  • Click Next.
  • Then, select Allow the connection.
  • Click Next.
  • Then, make any changes to where the rule should apply and click Next.
  • Then, give the rule a Name.
  • Finally, click Finish to create the rule.


How to Configure Firewall – Linux ?

A firewall rule needs to be created on our Linux machine to allow incoming traffic to NCPA on TCP Port 5693.

The command required for this will differ depending on OS and version:

RHEL/CentOS/ Oracle Linux 5.x/6.x
# iptables -I INPUT -p tcp –destination-port 5693 -j ACCEPT
# service iptables save
# ip6tables -I INPUT -p tcp –destination-port 5693 -j ACCEPT
# service ip6tables save
RHEL/CentOS/ Oracle Linux 7.x+
# firewall-cmd –zone=public –add-port=5693/tcp
# firewall-cmd –zone=public –add-port=5693/tcp –permanent
On Ubuntu:
$ sudo mkdir -p /etc/ufw/applications.d
$ sudo sh -c “echo ‘[NCPA]’ > /etc/ufw/applications.d/ncpa”
$ sudo sh -c “echo ‘title=Nagios Cross Platorm Agent’ >> /etc/ufw/applications.d/ncpa”
$ sudo sh -c “echo ‘description=Nagios Monitoring Agent’ >> /etc/ufw/applications.d/ncpa”
$ sudo sh -c “echo ‘ports=5693/tcp’ >> /etc/ufw/applications.d/ncpa”
$ sudo ufw allow NCPA
$ sudo ufw reload
On Debian:
# iptables -I INPUT -p tcp –destination-port 5693 -j ACCEPT
# apt-get install -y iptables-persistent
Answer yes to saving existing rules


How to Test NCPA ?

To ensure that the installation is successful and NCPA is now listening, try accessing the web interface of the agent. In order to do this, we will need to know:

  • The IP Address of the machine we installed NCPA on.
  • The token/community_string we configured NCPA to use.
  • Open a web browser and connect to the NCPA web interface using the following URL:
  • https://<NCPA IP Address>:5693/
  • We will be presented with a security message. This is completely OK and expected. NCPA is using self signed certificates as it allows the communication to be encrypted. Our web browser is warning because it does not know about the certificate.
  • We will need to click Advanced and then Add Exception or Proceed to xxx to allow us to use the NCPA page.
  • We will then be shown the NCPA login page.
  • Type the token in the field and then click the Log In button.
  • Once we log in, we will be placed on the Dashboard page with a summary of the NCPA version and machine it is running on.
  • NCPA is now ready to be monitored by Nagios.


How to configure Nagios ?

Now that NCPA is installed on the remote machine, we can monitor the machine using the NCPA monitoring wizard in Nagios XI.

The NCPA agent has built-in documentation in web interface, this is located on the Help tab. 

This gives the options to view or change configuration settings remotely as well as access additional info on NCPA.


[ Need urgent assistance set up WMI monitoring with Nagios? – We're available 24*7 ]


Conclusion

This article covers how to Install Nagios NCPA on Linux and Windows. Basically, NCPA simplifies monitoring configurations and maintenance by allowing Nagios to monitor servers using the same agent regardless of platform. NCPA is intended to simplify and universalize agent-based monitoring

across different operating systems.


To monitor Windows Machines you will need to follow several steps and they are:

  • Install NSClient++ addon on the Windows Machine.
  • Configure Nagios Server for monitoring Windows Machine.
  • Add new host and service definitions for Windows machine monitoring.
  • Restart the Nagios Service.


Why do we need Nagios?

Here, are the important reasons to use Nagios monitoring tool: 

  • Detects all types of network or server issues. 
  • Helps you to find the root cause of the problem which allows you to get the permanent solution to the problem. 
  • Active monitoring of your entire infrastructure and business processes.