Nagios

From KlavoWiki
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Installaton

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 http://www.nagios.org/download/

wget http://optusnet.dl.sourceforge.net/sourceforge/nagios/nagios-2.9.tar.gz

Now download the latest nagios plugins. Visit http://sourceforge.net/project/showfiles.php?group_id=29880 for the latest releases. Version 1.4.9.1 is the latest at time of writing.

wget http://optusnet.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.9.tar.gz

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