Install Nagios on RHEL5

Dependencies

* Install Apache and PHP
* GCC
* GD development lib

Create User Account

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

Build and Install Nagios Core

wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.0.tar.gz
tar zxf nagios-3.2.0.tar.gz
cd nagios-3.2.0
./configure --with-command-group=nagcmd
 
make all
make install
# Installs the init script in /etc/rc.d/init.d
make install-init
# Installs and configures permissions on the directory for holding the external command file
make install-config
# Installs sample config files in /usr/local/nagios/etc
make install-commandmode
 
# Set contact email
vi /usr/local/nagios/etc/objects/contacts.cfg
 
# Install web interface
make install-webconf
# Create web interface account
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
 
# Restart Apache
/usr/local/apache2/bin/apachectl stop
/usr/local/apache2/bin/apachectl start
# Or
/sbin/service httpd restart

Compile and Install Nagios Plugins

wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.14.tar.gz
tar zxf nagios-plugins-1.4.14.tar.gz
cd nagios-plugins-1.4.14
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install

Start Nagios

# Auto start Nagios
/sbin/chkconfig --add nagios
/sbin/chkconfig nagios on
# Check config file
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
/sbin/service nagios start

Access Web Interface

http://myhost/nagios/index.php

References

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

This entry was posted in Linux. Bookmark the permalink.