How to Install Nagios NRPE on Ubuntu 14.04

Create Nagios User and Group
useradd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios

Update your apt-get package lists:
apt-get update

Then install the required packages:
apt-get install build-essential libgd2-xpm-dev openssl libssl-dev apache2-utils unzip -y

Install Nagios
apt-get install nagios3 -y

–Local Only
–Create Web Admin (not needed)
user: nagios
pw: nagios

Now we will install NRPE:
apt-get install nagios-nrpe-server -y

Open the nrpe.cfg in an editor:

vi /etc/nagios/nrpe.cfg

Below this line: allowed_hosts=
Add this line: allowed_hosts=216.x.x.x

Now add percona commands to nrpe.cfg

Add the following commands below this line include_dir=/etc/nagios/nrpe.d/.

command[pmp-check-mysql-status]=/usr/lib/nagios/plugins/pmp-check-mysql-status -x Threads_connected -o / -y max_connections -T pct -w 90
command[pmp-check-mysql-processlist]=/usr/lib/nagios/plugins/pmp-check-mysql-processlist -w 60 -c 90
command[pmp-check-mysql-replication-delay]=/usr/lib/nagios/plugins/pmp-check-mysql-replication-delay -w 2000 -c 3000
command[]=/usr/lib/nagios/plugins/ -v -u nrpe -p “update-nrpepw” -w 6000 -c 8000

Note: Do not forget to update the nrpe password for check_mysql_longqueries and run this command:

aptitude install libnagios-object-perl libnagios-plugin-perl -y
Create mysql nrpe users. ****On cluster or replication this only has to done on one server****

CREATE USER ‘nrpe’@’localhost’ IDENTIFIED BY ‘new-password’;

GRANT ALL PRIVILEGES ON * . * TO ‘nrpe’@’localhost’;

Create mysql.cnf

vi /etc/nagios/mysql.cnf

Add these lines
Install percona-nagios-plugins:

cd /usr/lib/nagios/plugins

Now install nagios percona plugins.
apt-get install percona-nagios-plugins

Now restart nagios and naigos-nrpe-server
service nagios-nrpe-server restart
service nagios3 restart
Note: If probes are not working and on status you see: Reason: Gave up connecting to port 5666 after 0 seconds. Also in tail -n 50 /var/log/syslog:
Host 216.x.x.x is not allowed to talk to us!

Edit vi /etc/sudoers
Add: nagios ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/