Monitoring through NRPE



NRPE is a way to execute a monitoring plugin on a remote system. It requires, that the NRPE-Server is running and the monitoring plugins are installed on the remote system.

It is recommended to use the openITCOCKPIT Monitoring Agent to execute plugins on a remote host because the setup is way less complex. How ever it's up to you which method you prefer.

Install NRPE plugin for openITCOCKPIT

Establish an SSH connection to your openITCOCKPIT Server and install the following package:

apt-get install --no-install-recommends nagios-nrpe-plugin

To use the new plugin, you need to create a new command at Objects Commands and press on + New

Command defenition
Command type Service check command
Command name check_nrpe_simple
Command line /usr/lib/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c "$ARG1$"
Command arguemnt ($ARG1) Command name

To use the check_nrpe plugin, you also need to create a new service template. Go to Templates Service templates and press on + New

Set the container to /root so the service template will be available for all users. As name we use CHECK_BY_NRPE_SIMPLE.

Service Template defenition
Template name CHECK_BY_NRPE_SIMPLE
Template Type Generic templates
Service name CHECK_BY_NRPE_SIMPLE
Check period 24x7
Enable active checks Yes
Check command check_nrpe_simple
Command name (ARG1) blank
Notification period 24x7

Install NRPE server on target host

To use NRPE, it is required that the nagios-nrpe-server is running on the remote host. Establish an SSH connection to your remote host and install the following packages:

apt-get install nagios-plugins nagios-nrpe-server

Open the file /etc/nagios/nrpe.cfg with your favorite editor.

Search for allowed_hosts and add the ip address of your openITCOCKPIT server.

allowed_hosts=127.0.0.1,::1,172.16.166.154

The default configuration comes with some predefined basic checks. We are going to use this example checks right now.

The default configuration will check the disk /dev/hda1 which doesn’t exist on the most systems anymore... In our case, we replace this with /dev/vda1.

command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_vda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/vda1
command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200

Whenever you change the config, you need to restart nagios-nrpe-server.service to apply the changes.

systemctl restart nagios-nrpe-server.service

Create services

Go to Services and press on + New

First of all you have to select the host you like to create the service for and select the CHECK_BY_NRPE_SIMPLE service template. The system will now load all predefined values of the service template.

Change the Service name to CPU Load and set check_load as Command name ($ARG1$) and click on Create service

Repeat this step for all defeind NRPE commands. The command names are defined in your nrpe.cfg on the target host. In this case we have the default commands which are: check_users, check_load, check_vda1, check_zombie_procs and check_total_procs.

Once you created all services, you need to Refresh monitoring configuration.

Press Launch refresh to apply the new configuration.

The new services will be now monitored by the system: