compile and install nagios nrpe 2.15 on ubuntu 12.04 lts
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.3 LTS"
download and install gz'd code in /usr/local/src
add nagios user
# useradd -c "nagios system user" -d /usr/local/nagios -m nagios
# groupadd nagios
# chown nagios:nagios /usr/local/nagios
compile and install nrpe
# gunzip nrpe-2.15.tar.gz
# tar xvf nrpe-2.15.tar
# cd nrpe-2.15
# ./configure --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu
# make && make install
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/bin
/usr/bin/install -c -m 775 -o nagios -g nagios nrpe /usr/local/nagios/bin
# make install-daemon-config
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc
/usr/bin/install -c -m 644 -o nagios -g nagios sample-config/nrpe.cfg /usr/local/nagios/etc
# gunzip nagios-plugins-1.4.16.tar.gz
# tar xvf nagios-plugins-1.4.16.tar
# cd nagios-plugins-1.4.16/
# ./configure --without-mysql
# make && make install
...
* note
i'm hardcoding the libs for nrpe because
configure does this...
checking for type of socket size... size_t
checking for SSL headers... SSL headers found in /usr
checking for SSL libraries... configure: error: Cannot find ssl libraries
meh
# apt-get install libssl-dev
# ldconfing
# apt-file search libssl | grep libssl-dev
...
set up the nrpe daemon
# echo 'nrpe 5666/tcp # NRPE' >> /etc/services
# cp /usr/local/src/nrpe-2.15/init-script.debian /etc/init.d/nrpe
# chmod +x /etc/init.d/nrpe
# sysv-rc-conf
set to runlevels 2 3 4 5
q to exit :^)
edit nrpe.cfg to site specs
# vi /usr/local/nagios/etc/nrpe.cfg
run nrpe daemon
# /etc/init.d/nrpe start
running?
# netstat -an |grep 5666
tcp 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN
tcp6 0 0 :::5666 :::* LISTEN
check if npre is accessible. the rev show show up.
# /usr/local/nagios/libexec/check_nrpe -H localhost
NRPE v2.15
make it easy on yourself with a script as opposed to copy/paste.
useradd -c "nagios system user" -d /usr/local/nagios -m nagios ;
chown nagios:nagios /usr/local/nagios ;
mkdir -p /usr/local/src ;
cd /usr/local/src ;
scp you@somewhere:/dir/nrpe-2.15.tar.gz . ;
scp you@somewhere:/dir/nagios-plugins-1.4.16.tar.gz . ;
scp you@somewhere:/dir/templates/* . ;
gunzip nrpe-2.15.tar.gz ;
tar xvf nrpe-2.15.tar ;
gunzip nagios-plugins-1.4.16.tar.gz ;
tar xvf nagios-plugins-1.4.16.tar ;
cd nrpe-2.15 ;
./configure --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu ;
make && make install ;
make install-daemon-config ;
cd ../nagios-plugins-1.4.16 ;
./configure --without-mysql ;
make && make install ;
cp /usr/local/src/nrpe.cfg /usr/local/nagios/etc/ ;
echo 'nrpe 5666/tcp # NRPE' >> /etc/services ;
cp /usr/local/src/nrpe-2.15/init-script.debian /etc/init.d/nrpe ;
chmod +x /etc/init.d/nrpe
common prereqs:
libssl-dev
apt-file
sysv-rc-conf
note:
if you see the make error in npre section (make will not tell you, you have to watch the process):
./nrpe.c:269: undefined reference to `get_dh512'
a hint is when you rn /etc/init.d/nrpe and do not see the output:
Starting nagios remote plugin daemon: nrpe.
edit dh.h with C-code output if openssl is installed.
# openssl dhcparam -C 512 > /usr/local/src/nrpe-2.15/include/dh.h
and removing all between:
-----BEGIN DH PARAMETERS-----
-----END DH PARAMETERS-----
if running openssl comes up as not found,
apt-get install openssl
for ubuntu 10 and lower:
--with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib
if you do not want to roll your own:
apt-get install nagios-nrpe-server
apt-get install nagios-plugins
apt-get install nagios-plugins-basic
apt-get install nagios-plugins-standard
all the conf stuff resides in:
/etc/nagios
...
a basic-o-rama template (npre.cfg):
#############################################################################
# NRPE Config File
#
# Last Modified: TODAY!
#############################################################################
# LOG FACILITY
log_facility=daemon
# PID FILE
pid_file=/var/run/nrpe.pid
# PORT NUMBER
server_port=5666
# SERVER ADDRESS
#server_address=127.0.0.1
# NRPE USER
nrpe_user=nagios
# NRPE GROUP
nrpe_group=nagios
# ALLOWED HOST ADDRESSES
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
# losthost and monitoring servers
allowed_hosts=127.0.0.1,128.6.6.6,10.5.5.5
# COMMAND ARGUMENT PROCESSING
dont_blame_nrpe=0
# BASH COMMAND SUBTITUTION
allow_bash_command_substitution=0
# DEBUGGING OPTION
# Values: 0=debugging off, 1=debugging on
debug=0
# COMMAND TIMEOUT
command_timeout=60
# COMMAND DEFINITIONS
# The following examples use hardcoded command arguments...
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_root]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 600 -c 900