From KlavoWiki
Jump to: navigation, search


Preparing for Installation

Install required Linux components.

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

Create an account for nagios to use.

useradd 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.

groupadd nagcmd
usermod -G nagcmd nagios
usermod -G nagcmd apache

Downloading nagios

Create an area to download required nagios files.

mkdir /usr/src/nagios
cd /usr/src/nagios

The latest relase of nagios at time of writing is 2.9. For the latest relase visit


Now download the latest nagios plugins. Visit for the latest releases. Version is the latest at time of writing.


Extract the Nagios source code tarball.

tar xzf nagios-2.9.tar.gz
cd nagios-2.9

Run the Nagios configure script, passing the name of the group you created earlier like so:

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

Compile the Nagios source code.

make all

Install binaries, init script, sample config files and set permissions on the external command directory.

make install
make install-init
make install-config
make install-commandmode

Don’t start Nagios yet - there’s still more that needs to be done...

Setup Alert Email Address

Sample configuration files have now been installed in the /usr/local/nagios/etc directory. These sample files should work fine for getting started with Nagios. You’ll need to make just one change before you proceed... Edit the /usr/local/nagios/etc/objects/contacts.cfg config file with your favorite editor and change the email address associated with the nagiosadmin contact definition to the address you’d like to use for receiving alerts.

nano /usr/local/nagios/etc/objects/contacts.cfg

Configure the Web Interface

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

make install-webconf

Create a nagiosadmin account for logging into the Nagios web interface. Remember the password you
assign to this account - you’ll need it later.

htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Restart Apache to make the new settings take effect.
service httpd restart