Skip to main content

You are here

Nagios

Installing Nagios Remote Plugin Executor in FreeBSD 9.1

This also installs the Nagios plugins in addition of nrpe. Follow the text-based menu install options. The installer will create and configure the nagios user account, and will install the naios and nrpe plugins in /usr/local/libexec/nagios .

cd /usr/ports/net-mgmt/nrpe2
make install clean

Update permissions.

chown -R nagios:nagios /usr/local/libexec/nagios

Create nrpe config file.

cd /usr/local/etc
cp nrpe.cfg-sample nrpe.cfg

Add the following entry to /etc/rc.conf .

nrpe2_enable="YES"

Edit nrpe.cfg (Example: 192.168.1.5 is my nagios server)

allowed_hosts=192.168.1.5

Start the nrpe daemon.

/usr/local/etc/rc.d/nrpe2 start

Awesome Applications: 

Unix: 

Installing Nagios Remote Plugin Executor in Solaris 11

Install gcc

pkg install pkg://sfe/runtime/gcc pkg://sfe/sfe/developer/gcc

Install system headers (not really sure if all listed were necessary):

pkg install SUNWhea SUNWbinutils SUNWarc SUNWgcc SUNWgccruntime SUNWlibsigsegv SUNWgm4 SUNWgnu-automake-110 SUNWaconf

Update your PATH:

PATH=$PATH:/usr/gcc/bin:/usr/sfw/bin:/usr/ccs/bin
export PATH

Manually create nagios user account, home directory, group, and assigned him a password.

mkdir -p /usr/local/nagios
useradd -d /usr/local/nagios -m nagios
groupadd nagios
usermod -G nagios nagios
passwd nagios

Download, extract, compile and install nrpe.

wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.13.tar.gz
tar -xvf http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.13.tar.gz
cd /opt/nrpe-2.13
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make install
make install-daemon-config
cp src/check_nrpe /usr/local/nagios/libexec

Update permissions.

chown -R nagios:nagios /usr/local/nagios/

Add the following entry to /etc/services

nrpe 5666/tcp # NRPE

Add the following entry to /etc/inetd.conf

nrpe stream tcp nowait nagios /usr/sbin/tcpd /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -i

Convert and add the new legacy inetd entry to SMF.

inetconv
inetconv -e

Awesome Applications: 

Unix: 

Installing Nagios Remote Plugin Executor

CentOS

yum install openssl openssl-devel gcc make autoconf xinetd

Debian/Ubuntu

apt-get install openssl build-essential libssl-dev gcc make autoconf xinetd

Create nagios user and give it a password.

/usr/sbin/useradd -m nagios
passwd nagios

Download and extract the latest stable Nagios Plugins from http://www.nagios.org/download/plugins/
Configure, compile and install the Nagios plugins.

./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install

Download the latest NRPE plugin from http://exchange.nagios.org/directory/Addons/Monitoring-Agents/NRPE--2D-N...
Extract, configure, compile and install the plugin with xinetd configuration.

./configure
make all
make install-daemon
make install-xinetd

Edit the /etc/xinetd.d/nrpe file and add the IP address of the monitoring server to the only_from directive.

only_from = 127.0.0.1 

Add the following entry for the NRPE daemon to the /etc/services file.

nrpe 5666/tcp # NRPE

Restart the xinetd service.

/etc/init.d/xinetd restart

Copy over sample config file.

mkdir /usr/local/nagios/etc/
cp sample-config/nrpe.cfg /usr/local/nagios/etc/nrpe.cfg

Copy over check_nrpe binary to /usr/local/nagios/libexec

cp src/check_nrpe /usr/local/nagios/libexec/

Update permissions.

chown nagios.nagios /usr/local/nagios
chown -R nagios.nagios /usr/local/nagios/libexec

Update firewall.

iptables -A INPUT -p tcp -m tcp --dport 5666 -j ACCEPT

Testing Communication
Issue the following command to test communication on the Nagios monitoring server. Replace IP "192.168.0.1", with the NRPE client's IP.

/usr/local/nagios/libexec/check_nrpe -H 192.168.0.1

You should get a string back that tells you what version of NRPE is installed on the remote host, like this:

NRPE v2.13

Awesome Applications: 

Installing Nagios in CentOS 6

Make sure you've installed the following packages on your CentOS installation before continuing.

Apache
PHP
GCC compiler
GD development libraries

Performed on monitor.rubyninja.org

yum install httpd php gcc glibc glibc-common gd gd-devel make autoconf

Create nagios user and give it a password.

/usr/sbin/useradd -m nagios
passwd nagios

Create a new nagcmd group for allowing external commands to be submitted through the web interface. Add both the nagios user and the apache user to the group.

/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -a -G nagcmd nagios
/usr/sbin/usermod -a -G nagcmd apache

Download and extract the latest stable Nagios Core from http://www.nagios.org/download/core/
Run the Nagios configure script, passing the name of the group you created earlier:

./configure --with-command-group=nagcmd

Compile Nagios

make all

Install Nagios

make install

Update the email address associated with the nagiosadmin contact definition in /usr/local/nagios/etc/objects/contacts.cfg .

Install the Nagios web config file in the Apache conf.d directory.

make install-webconf

Install Nagios init config

make install-init

Create htaccess user to access the Nagios web interface.

htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Restart Apache to make the new settings take effect.

service httpd restart

Add Nagios to the list of system services and have it automatically start when the system boots.

chkconfig --add nagios
chkconfig nagios on

Download and extract the latest stable Nagios Plugins from http://www.nagios.org/download/plugins/
Configure, compile and install the Nagios plugins.

./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install

Update permissions

chown nagios.nagios /usr/local/nagios
chown -R nagios.nagios /usr/local/nagios/libexec

Verify the sample Nagios configuration files.

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

If there are no errors, start Nagios.

service nagios start

Post Installation
To make things easier to myself, the ncheck and nrestart aliases were created in /root/.bashrc to check the nagios configuration and restart the service respectively.

alias ncheck='/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg'
alias nrestart='service nagios restart'

Reference:
http://nagios.sourceforge.net/docs/3_0/quickstart-fedora.html

Linux: 

Awesome Applications: 

Pages

Premium Drupal Themes by Adaptivethemes