TECH SOLUTIONS

Click here to edit subtitle

Forums

Post Reply
Forum Home > Monitoring Tools > NAGIOS Installation on Ubuntu

Sourav Gulati
Site Owner
Posts: 83

Here's what you'llend up with:

Nagios and the plugins will be installed underneath /usr/local/nagios

Nagios will be configured to monitor a few aspects of your local system (CPU load, disk usage, etc.)

The Nagios web interface will be accessible at http://localhost/nagios/


RequiredPackages

Make sure you'veinstalled the following packages on your Ubuntu installation beforecontinuing.

Apache 2

PHP

GCC compiler and development libraries

GD development libraries

You can use apt-getto install these packages by running the following commands:

 

 

sudo apt-get install apache2

 

 

sudo apt-get install libapache2-mod-php5

 

 

sudo apt-get install build-essential


 

 

1) CreateAccount Information

Become the rootuser.

sudo-s

 

 

Create a new nagiosuser account and give it a password.

 

 

/usr/sbin/useradd-m -s /bin/bash nagios

 

 

passwd nagios

 

 

Create a new nagcmdgroup for allowing external commands to be submitted through the webinterface. Add both the nagios user and the apache user to the group.

 

 

/usr/sbin/groupadd nagcmd

 

 

/usr/sbin/usermod-a -G nagcmd nagios

 

 

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


 

 

2) Download Nagios and the Plugins

Create a directory for storing the downloads.

 

 

mkdir~/downloads

 

 

cd~/downloads

 

 

Download the sourcecode tarballs of both Nagios and the Nagios plugins (visit http://www.nagios.org/download/for links to the latest versions). These directions were tested withNagios 3.4.1 and Nagios Plugins 1.4.11.

 

 

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

 

 

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


 

 

3) Compile and Install Nagios

Extract the Nagios source code tarball.

 

 

cd ~/downloads

 

 

tar xzf nagios-3.2.3.tar.gz

 

 

cd nagios-3.2.3

 

 

Run the Nagiosconfigure script, passing the name of the group you created earlierlike so:

 

 

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

 

 

Compile the Nagiossource code.

 

 

make all

 

 

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

 

 

make install

 

 

make install-init

 

 

make install-config

 

 

make install-commandmode

 

 

Don't start Nagiosyet - there's still more that needs to be done...


4) CustomizeConfiguration

Sample configurationfiles have now been installed in the /usr/local/nagios/etcdirectory. These sample files should work fine for getting startedwith Nagios. You'll need to make just one change before youproceed...

Edit the/usr/local/nagios/etc/objects/contacts.cfgconfig file with your favorite editor and change the email addressassociated with the nagiosadmincontact definition to the address you'd like to use for receivingalerts.

 

 

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


 

 

5) Configure the Web Interface

Install the Nagiosweb config file in the Apache conf.d directory.

 

 

make install-webconf

 

 

Create a nagiosadminaccount for logging into the Nagios web interface. Remember thepassword you assign to this account - you'll need it later.

 

 

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

 

 

Restart Apache tomake the new settings take effect.

 

 

/etc/init.d/apache2 reload


 

 

6) Compile andInstall the Nagios Plugins

Extract the Nagiosplugins source code tarball.

 

 

cd ~/downloads

 

 

tarxzf nagios-plugins-1.4.11.tar.gz

 

 

cdnagios-plugins-1.4.11

 

 

Compile and installthe plugins.

 

 

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

 

 

make

 

 

make install


 

 

7) Start Nagios

Configure Nagios toautomatically start when the system boots.

 

 

ln-s /etc/init.d/nagios /etc/rcS.d/S99nagios

 

 

Verify the sampleNagios configuration files.

 

 

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

 

 

If there are noerrors, start Nagios.

 

 

/etc/init.d/nagios start


 

 

8 ) Login to the Web Interface

You should now beable to access the Nagios web interface at the URL below. You'll beprompted for the username (nagiosadmin)and password you specified earlier.

 

 

http://localhost/nagios/

 

 

Click on the"Service Detail" navbar link to see details of what's beingmonitored on your local machine.

Note: It will take afew minutes for Nagios to check all the services associated with yourmachine, as the checks are spread out over time.

_______

Click here for Nagios Configuration

--


February 1, 2013 at 5:51 AM Flag Quote & Reply

You must login to post.