Project 10 for CNIT 122 - Installing Nagios (15 pts.)

What You Need

Starting the Linux Machine

Start your machine as usual. Open a Terminal window.

In a Terminal window, enter this commands, and then press Enter:

ping samsclass.info
Make sure you are getting replies, and then press Ctrl+C to stop the pings.

In a Terminal window, enter this commands, and then press Enter:

ifconfig
Find the interface that goes to the Internet and make a note of it. In my case it is eth2, as shown below:

Installing the Required Libraries

Many of these are already included, but it's best to make sure.

In a Terminal window, enter these commands, pressing Enter after each one:

apt-get install apache2

apt-get install build-essential

apt-get install libgd2-xpm-dev

Creating the nagios Account

In a Terminal window, enter these commands, pressing Enter after each one:
/usr/sbin/useradd nagios

passwd nagios

When prompted to, enter the password nagios twice. (This is a poor security practice, in a real-world situation, use a strong pasword.)

Create the nagcmd Group

In this section, you will 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.

In a Terminal window, enter these commands, pressing Enter after each one:

/usr/sbin/groupadd nagcmd

/usr/sbin/usermod -G nagcmd nagios

/usr/sbin/usermod -G nagcmd www-data

Download Nagios and the Plugins

In a Terminal window, enter these commands, pressing Enter after each one:
cd /tmp

wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.3.1.tar.gz

wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz

Compile and Install Nagios

In a Terminal window, enter these commands, pressing Enter after each one:
cd /tmp

tar xzf nagios-3.3.1.tar.gz

cd nagios

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

make all

make install

make install-init

make install-config

make install-commandmode

Many screens of messages scroll by, ending with the message "*** External command directory configured ***", as shown below:

Customize Configuration

In a Terminal window, enter this command, and then press Enter:
nano /usr/local/nagios/etc/objects/contacts.cfg
Change the email address to your own email address, as shown below:

Save the file with Ctrl+X, Y, Enter.

Configure the Web Interface

In a Terminal window, enter these commands, pressing Enter after each one:
make install-webconf

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

Enter a password of nagios twice when you are prompted to.

Again, this is highly insecure--on a real system, use a secure password!

You need to restart apache to use the new settings.

In a Terminal window, enter these commands, and then press Enter:

/etc/init.d/apache2 reload

/etc/init.d/apache2 start

Compile and Install the Nagios Plugins

In a Terminal window, enter these commands, pressing Enter after each one:
cd /tmp

tar xzf nagios-plugins-1.4.15.tar.gz

cd nagios-plugins-1.4.15

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

make

make install

Start Nagios

Configure Nagios to automatically start when the system boots.

In a Terminal window, enter this command, and then press Enter:

ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios
Verify the sample Nagios configuration files.

In a Terminal window, enter this command, and then press Enter:

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If there are no errors, start Nagios.

In a Terminal window, enter this command, and then press Enter:

/etc/init.d/nagios start

Login to the Web Interface

From the Backtrack desktop, click Applications, Internet, Firefox Web Browser.

Go to this URL:

http://localhost/nagios/

Log in with the username nagiosadmin and a password of nagios

You should see the Nagios web administration interface, as shown below:

Saving the Screen Image

Save a screen capture with a filename of "Proj 10 from YOUR NAME".

Turning In Your Project

Email the images to cnit.122sam@gmail.com with a subject of "Project 10 from YOUR NAME".


Sources

http://www.ubuntugeek.com/nagios-network-monitoring-system-setup-in-ubuntu.html

http://www.nagios.org/download/




Last modified 10-4-11 5 pm