Nagios

From MattWiki

Installing Nagios

Installing Nagios Prerequisites

You can use yum to install these packages by running the following commands (as root):

yum install httpd
yum install gcc
yum install glibc glibc-common
yum install gd gd-devel

Nagios Account Setup

/usr/sbin/useradd nagios
passwd nagios
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -G nagcmd nagios
/usr/sbin/usermod -G nagcmd apache

Downloading and Compiling Nagios

wget http://superb-west.dl.sourceforge.net/sourceforge/nagios/nagios-3.0.1.tar.gz
wget http://superb-west.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz
tar xzf nagios-3.0.1.tar.gz
cd nagios-3.0.1
./configure --with-command-group=nagcmd 
make all
make install
make install-init
make install-config
make install-commandmode

Customize Nagios Configuration

make install-webconf
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
/sbin/service httpd restart

Compile and Install the Nagios Plugins

Extract the Nagios plugins source code tarball.

cd ~/downloads
tar xzf nagios-plugins-1.4.11.tar.gz
cd nagios-plugins-1.4.11

Compile and install the plugins.

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

Starting and Running Nagios

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

chkconfig --add nagios
chkconfig nagios on

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.

/sbin/service nagios start

Configuring you Nagios Install

Documentation