Nagios Remote Plugin Executor

NRPE can provide stats to a nagios daemon.

Installation

Install Nagios and NRPE as normal, with the requested plugins.

Client

The main Nagios server will request the stats from the remote client. To do so, make sure that the firewall on the clients will accept TCP connections from the source on port 5666.

iptables -A INPUT -p tcp -s 173.165.130.129 --dport 5666 -j ACCEPT

Server

Create a new config directory for the remote configuration files, like /etc/nagios/objects/remote

You will need three files in the directory.

When you are finished with the files, make sure you tell the Nagios configuration to read them in as well.

cfg_dir=/etc/nagios/objects/remote
nrpe-command.cfg
define command {
  command_name check_nrpe
  command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
nrpe-hosts.cfg
define host {
  use linux-server
  host_name gentoo
  alias Gentoo Linux Web Server
  address 192.168.13.2
}
nrpe-services.cfg

Every service mentioned here must exist on the remote client. Make sure nagios-plugins is installed with the correct set of matching plugins, since that is where they will be executed.

define service {
  use generic-service
  host_name gentoo
  service_description Local Users
  check_command check_nrpe!check_users
}

define service {
  use generic-service
  host_name gentoo
  service_description System Load
  check_command check_nrpe!check_load
}

define service {
  use generic-service
  host_name gentoo
  service_description root hdd
  check_command check_nrpe!check_hdd_root
}

define service {
  use generic-service
  host_name gentoo
  service_description var hdd
  check_command check_nrpe!check_hdd_var
}

define service {
  use generic-service
  host_name gentoo
  service_description Zombie Processes
  check_command check_nrpe!check_zombie_procs
}

define service {
  use generic-service
  host_name gentoo
  service_description Total Processes
  check_command check_nrpe!check_total_procs
}

Commands

Here are some examples for hadoop:

command[check_master]=/usr/lib64/nagios/plugins/check_procs -c 1:1 -u hadoop -a "internal_start master"
command[check_rest]=/usr/lib64/nagios/plugins/check_procs -c 1:1 -u hadoop -a "internal_start rest"
command[check_zookeeper]=/usr/lib64/nagios/plugins/check_procs -c 1:1 -u hadoop -a "internal_start zookeeper"