Setting up Client and Daemon NRPE
Introduction
This guide will cover the intallation and basic configuration of check_nrpe and nrpe service for CentOS7 distributions.
It is assumed that Nagios Core (source code) has already been installed.
What will you do ?
By following the instructions, you’ll learn to configure:
- Source compiled NRPE running standalone (without xinetd).
- NRPE settings, regarding association with localhost only plugins and enabling arguments for these plugins through NRPE.
- Nagios Core integration and the basic check_nrpe command definition in commands.cfg and in a host cfg file.
Prerequisites
During the installation, you will need root access on the machine.
Make sure the packets below are available and updated in your system.
- Apache
- PHP
- Compilador GCC
- GD development libraries
- SSL development libraries
You can use yum to install these packets, but it must be executed with root privelege:
yum install openssl-devel
1) Installing NRPE Client
Download NRPE 2.15 packet into the tmp folder.
cd /tmp/ wget http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
Unpack the file and enter the generated subdirectory.
tar zxvf nrpe-2.15.tar.gz cd nrpe-2.15/
Run the configure script and proceed by compiling and installing.
./configure --enable-command-args --enable-ssl make && make install
Allocate the NRPE initialization script and config file towards their respective default directories.
cp init-script /etc/init.d/nrpe cp sample-config/nrpe.cfg /usr/local/nagios/etc/nrpe.cfg/
Assign the permissions for command processing.
chmod +x /etc/init.d/nrpe chown -R nagios:nagios /usr/local/nagios/etc/nrpe.cfg chmod 664 /usr/local/nagios/etc/nrpe.cfg chown -R nagios:nagios /usr/local/nagios/libexec/check_nrpe chmod 755 /usr/local/nagios/libexec/check_nrpe
2) Configuring NRPE service (daemon)
Open NRPE config file and edit the following lines as follows.
vi /usr/local/nagios/etc/nrpe.cfg
{LINE 81} allowed_hosts=127.0.0.1,[IP DO CLIENTE NRPE REMOTO] {LINE 97} dont_blame_nrpe=1 {LINES 219 TO 223} [COMMENT (#) THE LINES] {LINES 236 TO ...} command[check_*)=/usr/local/nagios/libexec/check_* $ARG1$
Launch NRPE service and its autostart on boot.
service nrpe restart systemctl enable nrpe
3) NRPE settings sample in Nagios
Open Nagios commands.cfg file and add the following lines.
vim /usr/local/nagios/etc/objects/commands.cfg
define command{ command_name check_nrpe command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$ }
Open any desired service/host configuration file (if custom, don’t forget to add it to nagios.cfg !!!) and add the following lines.
vim /usr/local/nagios/etc/objects/localhost.cfg define service{ use local-service host_name localhost service_description NRPE check_command check_nrpe!check_disk!-a '-w 20% -c 10% -p /' }
Save the changes and restart Nagios. You can already see the execution of the service through the web interface: http://localhost/nagios.
Posted in: Nagios Core, Plugin, Uncategorized
Leave a Comment (0) ↓