Installing the nagios agent(NRPE)

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
digitallife
Posts: 27
Joined: Mon Nov 17, 2014 12:29 pm

Installing the nagios agent(NRPE)

Post by digitallife »

I untared the linux-nrpe-agent.tar.gz and ran the fullinstall script to install the nagios agent on my server and as it runs it tries to access the nagios web portal to download files to install on my server. Currently, my server is not internet accessible. Is there another tar file that I can download from the Nagios web site that has all the necessary packages, files, bin needed to install the agent without accessing the internet to pull files?
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: Installing the nagios agent(NRPE)

Post by jolson »

You can build NRPE from source quite simply:

Prerequisites

Make sure that you have the following packages installed:

Code: Select all

gcc glibc glibc-common openssl-devel perl

Downloading the Source

On the remote host (client system), log in as the root user to download and extract the NRPE tarball:

Code: Select all

cd /tmp
wget http://sourceforge.net/projects/nagios/files/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
tar zxvf nrpe-2.15.tar.gz


Compile and Installation

To compile and install NRPE, run the following commands:

Code: Select all

useradd nagios
cd nrpe-2.15
./configure
make
make install
The check_nrpe plugin will install into /usr/local/nagios/libexec by default.

Copy the sample nrpe.cfg file to your remote hosts' NRPE config directory:

Code: Select all

mkdir /usr/local/nagios/etc
cp sample-config/nrpe.cfg /usr/local/nagios/etc

Install xinetd

Once NRPE has been installed, you need to set up an init system - typically this is xinetd.
Many linux distributions come with xinetd pre-installed.


CentOS/RHEL/Fedora:

Code: Select all

yum install xinetd
Ubuntu/Debian:

Code: Select all

apt-get install xinetd


Configure xinetd

At this point, we need a configuration that tells xinetd about NRPE. This configuration is included - change directory to the NRPE source to install it:

Code: Select all

cd /tmp/nrpe-2.15
make install-xinetd
You should now have a config located at /etc/xinetd.d/nrpe - this file contains an “only_from” directive which specifies which ip addresses are allowed to talk to the daemon. It is a space separated list of ip addresses. Add your Nagios XI server's IP after the only_from setting:

Code: Select all

vi /etc/xinetd.d/nrpe
Change:

Code: Select all

only_from = 127.0.0.1
To:

Code: Select all

only_from = 127.0.0.1 x.x.x.x
Where x.x.x.x equals the IP address of your Nagios server.

Finally, we need to add the NRPE port and service declaration in /etc/services:

Code: Select all

echo "nrpe 5666/tcp" >> /etc/services
Let's test NRPE/xinetd to make sure it starts up cleanly:

Code: Select all

service xinetd start
cd /usr/local/nagios/libexec
./check_nrpe -H 127.0.0.1
You should see the following output:
NRPE v2.15
If you get the NRPE version number (as shown above), NRPE and xinetd are installed and configured correctly.



Downloading, Compiling, And Installing The Nagios Plugins

NRPE need plugins to operate properly. Before we dive into configuration, download and build the Nagios-plugins (visit Nagios-Plugins.org/downloads to find the latest version of the plugins and adjust the version number in the commands accordingly):

Code: Select all

cd /tmp
wget https://www.nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz tar
zxvf nagios-plugins-2.0.3.tar.gz
cd /tmp/nagios-plugins-2.0.3
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install 
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
Locked