Aug 092014
 
Article Server Administration

This post explains the steps to follow for the installation and setup of the elements in a Nagios monitoring system on a Debian/Ubuntu system. The installation instructions explained here can be adapted to work for most Linux distros with only minor changes.

Pre-requisites

Several software packages must be present in the system to successfully compile and run Nagios. These dependencies can be easily installed with apt-get:

A user “nagios” must be added to the system, to run the monitoring service with the privileges of this user:

Finally, a “nagcmd” user group needs to be created, and users “nagios” and “www-data” added to it. This will enable running external commands from the web interface:

 

Downloading and installing Nagios Core

First, create a “nagios” directory to hold the source code

From the nagios website, download the source code of the free (DIY) version of Nagios. The name of the downloaded file in our case is nagios-4.0.7.tar.gz

Next, extract the content of the downloaded tarball, and run the initial configuration:

The “configure” command finishes printing a configuration summary:

The next step is compiling the source code:

Once the compilation finished without errors, proceed to perform the installation. We will need superuser privileges for this step:

  • The “make install” command copies the nagios executable under the /usr/local/nagios directory
  • The “make install-init” command copies the script used to start and stop the nagios service under the /etc/init.d directory.
  • The “make install-commandmode” command sets the required permissions to the “/usr/local/nagios/var/rw” directory for the execution of command-line nagios commands.
  • The “make install-config” command installs under /usr/local/nagios/etc a set of sample configuration files. These files will have to be edited before starting the nagios service.
  • Finally, the “make install-webconf” command copies under the /etc/apache/conf.d directory the “nagios.conf” configuration file for the nagios web frontend.

Optionally, the “Exfoliation” theme can be installed as well:

Initial configuration

The only required modification on the sample configuration files to start using nagios right away is to specify the email address that will receive notifications. This email address is set up in /usr/local/nagios/etc/objects/contacts.cfg. This files needs to be edited to replace the default ‘nagios@localhost’ with the email address where we want alerts and other notifications to be sent.

Finally, create a “nagiosadmin” user to validate in nagios web frontend:

Installing nagios plugins

From the nagios web site, download the plugin installation file. In our case, the file downloaded is  “nagios-plugins-2.0.3.tar.gz”.

Extract the content of the tarball, and perform the installation as follows:

Accesing Nagios

After the plugins have been successfully installed, we are almost ready to access the nagios web frontend for the first time.

First, check that there is no issue in the nagios configuration:

Restart the web server:

and access the nagios frontend main page with the URL http://localhost/nagios.

After validating with user “nagiosadmin” and the password previously set, the main page of the administration panel is shown:

nagios-home

 

References

 Posted by at 4:34 pm

 Leave a Reply

(required)

(required)