Monitoring through NRPE



NRPE is a way to execute a monitoring plugin on a remote system. It requires, that the NRPE-Server is running on the remote system and the monitoring plugins are installed. The basic setup of NRPE is a bit complex but the benefit is, that you can execute any plugin on the remote host.

Install NRPE plugin for openITCOCKPIT

Also NRPE is available as a module for openITCOCKPIT. To install the check_nrpe plugin on your openITCOCKPIT server, please go to Administration Package Manager and install check_nrpe.

To use the new plugin, you need to create a new command at Basic Monitoring Commands "New".

Set check_nrpe_simple as command name, $USER1$/check_nrpe -H $HOSTADDRESS$ -c "$ARG1$" for Command line and don't forget to add the one argument.

To use the check_nrpe plugin, you also need to create a new service template at Basic Monitoring Service templates "New".

Set the container to /root so the service template will be available for all users. As name we use CHECK_BY_NRPE_SIMPLE and we set the notification interval to 7200. Also we enable notifications for the states Recovery, Warning and Critical.

Now click on "Expert settings" and select the command check_nrpe_simple. Leave the argument blank for now and set the check period to 24x7, max number of check attempts to 3 and check interval and retry interval to 60. Now press "Save".

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,172.16.166.132

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 the service to enable your changes via systemctl restart nagios-nrpe-server.service.

Create checks

Go to Basic Monitoring Services "New" to create a new service, which will be checked by NRPE.

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

Change the Name to CPU Load and click on Expert settings.

Now pass the command name you like to check to the argument Command. 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.

Now press on "Save" and repeat this step for every service.

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

The new services will be now monitored by the system: