Nagios on Ubuntu 8.1

So I thought I’d try to find oout why my desktop and NAS keep arguing. Nagios. That will help. So I fired-up a spare piece of tin, dropped Ubuntu 8.1 onto it and followed some instructions. The instructions are a bit out of date so I thought I’d record how I actually did it in case it helps somebody else.

Ubuntu

I assume you have installed it with LAMP to save a lot of farting around. If not, aptitude yourself to a point where you have then come back here.

Compilers and Libraries

sudo apt-get install build-essential

sudo apt-get install libgd2-xpm-dev

Nagios

cd ~

sudo wget http://downloads.sourceforge.net/nagios/nagios-3.1.0.tar.gz?use_mirror=voxel

sudo wget http://downloads.sourceforge.net/nagiosplug/nagios-plugins-1.4.13.tar.gz?use_mirror=voxel

Extract it (If you have a newer build of Nagios, change the path names below):

sudo tar -zxvf nagios-3.1.0.tar.gz

cd nagios-3.1.0

Create a user and Group:
sudo useradd -m nagios

sudo passwd nagios

sudo groupadd nagcmd

sudo usermod -a -G nagcmd nagios

sudo usermod -a -G nagcmd www-data

Now we can install….

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

sudo make all

sudo make install

sudo make install-init

sudo make install-config

sudo make install-commandmode

sudo make install-webconf

Create an Apache user we can login as called nagiosadmin:

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

Extract and compile the plugins that were downloaded earlier:

cd ~

tar -zxvf nagios-plugins-1.4.13.tar.gz

cd nagios-plugins-1.4.13

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

sudo make

sudo make install

Create a link to start the service:
sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios

Verify the config:
sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Restart Apache:
sudo /etc/init.d/apache2 restart

Start Nagios:
sudo /etc/init.d/nagios start

You should now be able to log into the Nagios web interface (http://localhost/nagios) using the nagiosadmin user and password.

Customise your installation…

sudo vim /usr/local/nagios/etc/nagios.cfg

I have to credit thedailyadmin.com for helping me out with a lot of the above. I urge you to go visit that site if only to stop me feeling guilty .