How to Install the NRPE daemon
How to Install the NRPE daemon
Step-1:
Download the source code tarball of the NRPE addon (visit https://www.nagios.org/downloads/nagios-coreaddons/ for links to the latest versions). At the time of writing, the latest version of NRPE was 3.2.1.
cd ~/downloads wget https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe3.2.1/nrpe-3.2.1.tar.gz
Extract the NRPE source code tarball:
tar xzf nrpe-3.2.1.tar.gz
Step-2:
cd nrpe-nrpe-3.2.1
Compile the NRPE addon:
./configure make all
If you didn't create the groups and users in (i) above, do it now:
make install-groups-users
Install the NRPE plugin (for testing), daemon, and sample daemon configuration file.
make install make install-config
Step-3:
If you want NRPE to run per-connection under inetd, xinetd, launchd, systemd, smf, etc. run the following
command:
make install-inetd
Step-4:
Make sure nrpe 5666/tcp is in your /etc/services file, if applicable.
If you want to run NRPE all the time under init, launchd, systemd, smf, etc. run the followning command:
make install-init
You may need to reload or restart the controlling daemon using one of the following (or similar) commands:
service xinetd restart systemctl reload xinetd # systemd systemctl enable nrpe && systemctl start nrpe
Step-5:
Test the NRPE daemon locally
Its time to see if things are working properly. Make sure the nrpe daemon is running:
netstat -at | egrep "nrpe|5666"
tcp 0 0 *:nrpe *:* LISTEN
Step-6:
If the second line above shows up, great! If it doesn't, make sure of the following
• You added the nrpe entry to your /etc/services file • The only_from directive in the /etc/xinetd.d/nrpe file contains an entry for "127.0.0.1" • xinetd is installed and started • The appropriate line in /etc/inetd.conf has been uncommented • Check the system log files for references about xinetd or nrpe and fix any problems that are reported
Next, check to make sure the NRPE daemon is functioning properly. To do this, run the check_nrpe plugin
that was installed for testing purposes. You should see the second line below:
/usr/local/nagios/libexec/check_nrpe -H localhost NRPE v3.2.1
If everything worked, add the hostname or IP address of the nagios server to the /etc/xinetd.d/nrpe
file, or /etc/hosts-allow and hosts-deny.
Step-7:
Open firewall rules
If the server has a firewall running, you need to allow access to the NRPE port (5666) from the Nagios
server.
In Fedora and Red Hat Linux, you would use the following commands:
iptables -I RH-Firewall-1-INPUT -p tcp -m tcp –dport 5666 -j ACCEPT service iptables save
On other systems and other firewalls, check the documentation or have an administrator open the port.
Customize the NRPE commands
The sample NRPE config file that got installed contains several command definitions that you'll likely use to
monitor this machine. The command definitions are used to (surprise) define commands that the NRPE
daemon will run to monitor local resources and services. The sample command definitions run some of the
plugins that were installed in step
2. You can edit the command definitions, add new commands, etc, by
editing the NRPE config file using your favorite editor:
vi /usr/local/nagios/etc/nrpe.cfg
More information on customizing the commands can be found on page 16 in the section titled
"Customizing Your Configuration".
For the time being, I'll assume you're using the sample commands that are defined. You can test some of
these by running the following commands:
/usr/local/nagios/libexec/check_nrpe -H localhost -c check_user
Step-8:
Customize the NRPE commands
The sample NRPE config file that got installed contains several command definitions that you'll likely use to
monitor this machine. The command definitions are used to (surprise) define commands that the NRPE
daemon will run to monitor local resources and services. The sample command definitions run some of the
plugins that were installed in step 2. You can edit the command definitions, add new commands, etc, by
editing the NRPE config file using your favorite editor:
vi /usr/local/nagios/etc/nrpe.cfg
More information on customizing the commands can be found on page 16 in the section titled
"Customizing Your Configuration".
For the time being, I'll assume you're using the sample commands that are defined. You can test some of
these by running the following commands:
/usr/local/nagios/libexec/check_nrpe -H localhost -c check_user