Building a Linux Monitoring Infrastructure With Nagios 3.0

January 21, 2017 | Views: 6949

Begin Learning Cyber Security for FREE Now!

FREE REGISTRATIONAlready a Member Login Here

Estimated reading time: 3 minutes

This post describes the installation and configuration of a system’s monitoring infrastructure on Nagios, an open source network monitoring application. This is the first in two series. Enjoy!

Nagios is an open source infrastructure system and enterprise network monitoring application. It monitors hosts and services, alerting users when things go wrong and again when they get better. It was originally created under the name Netsaint, was written and is currently maintained by Ethan Galstad, along with a group of developers actively maintaining both official and unofficial plugins.

It was originally designed to run under Linux, but also runs well on other Unix variants and nowadays on Windows Operating Systems. It is a free software licensed under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

FUNCTIONS
Some of the functions performed by Nagios include

Monitoring of network services (SMTP, POP3, HTTP, SSH)
Monitoring of host resources (processesor load, disk usage, system logs) on a majority of Network Operating System, including Microsoft Windows with the NRPE_NT plugins.
Remote monitoring supported through SSH or SSL encrypted tunnels.
Simple plugin design that allows users to easily develop their own service checks depending on needs, by using the tools of choice (Bash, C++, Perl, Ruby, Python, PHP, C#, etc.)
Contact notifications when service or host problems occur and get resolved (via e-mail, pager, SMS, or any user-defined method through plugin system)
Automatic log file rotation
Support for implementing redundant monitoring hosts
Optional web-interface for viewing current network status, notifications, problem history, log files, etc

Found on Sourceforge.net

INSTALLATION

This particular deployment was carried out on Ubuntu Server 8.04. By default, Nagios would be installed underneath /usr/local/nagios and would be configured to monitor a few aspects of our local system (CPU load, disk usage, etc.). The Nagios web interface would be accessible at http://localhost/nagios/

Package Requirements
For the proper functioning of our installation, the following software packages are required:

Apache 2
GCC compiler and development libraries
GD development libraries

And in order to install them, just issue the following commands
aayoola@Nagios:~$ sudo apt-get install apache2
aayoola@Nagios:~$ sudo apt-get install build-essential
aayoola@Nagios:~$ sudo apt-get install libgd2-xpm-dev

For starters, I would like to explain the above. “aayoola” is the username on the server, which you would have given during or after the OS installation.

1. Create Account Information
Become the root user.
aayoola@Nagios:~$ sudo -s

Create a new nagios user account and give it a password.
root@Nagios:~#/usr/sbin/useradd -m nagios passwd nagios

On Ubuntu server edition (6.01 and possible newer versions), you will need to also add a nagios group. You should be able to skip this step on desktop editions of Ubuntu.
root@Nagios:~#/usr/sbin/groupadd nagios
root@Nagios:~#/usr/sbin/usermod -G nagios 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.
root@Nagios:~# /usr/sbin/groupadd nagcmd
root@Nagios:~# /usr/sbin/usermod -a -G nagcmd nagios
root@Nagios:~#/usr/sbin/usermod -a -G nagcmd www-data

2. Download Nagios and the Plugins
Create a directory for storing the downloads.
root@Nagios:~#mkdir downloads

Enter the created folder
root@Nagios:~#cd downloads

Download Nagios as follow
root@Nagios:~/Downloads#wget http://osdn.dl.sourceforge.net/sourceforge/nagios/nagios-3.0.5.tar.gz

root@Nagios:~/Downloads# wget http://osdn.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz

Be sure to confirm the links are still valid.

3. Compile and Install Nagios
Extract the Nagios source code tarball
root@Nagios:~/Downloads# tar xzf nagios-3.0.5.tar.gz cd nagios-3.0.5

Enter Nagios folder
root@Nagios:~/Downloads# cd nagios-3.0.5

Run the Nagios configure script, parsing the name of the group you created earlier like this:
root@Nagios:~/Downloads/nagios-3.0.5# ./configure —with-command-group=nagcmd

Compile the Nagios source code.
root@Nagios:~/Downloads/nagios-3.0.5# make all


Fedora installation instructions can be found here.

Alternate instructions for Ubuntu are also available here.

Share with Friends
FacebookTwitterLinkedInEmail
Use Cybytes and
Tip the Author!
Join
Share with Friends
FacebookTwitterLinkedInEmail
Ready to share your knowledge and expertise?
4 Comments
  1. Ok good stuff

  2. thanks for sharing. why did you use ubuntu srv 8.04?

  3. As an addendum to the above article here is an article that talks about creating plugins for nagios in python.
    http://www.linux-mag.com/id/7706/

Comment on This

You must be logged in to post a comment.

Our Revolution

We believe Cyber Security training should be free, for everyone, FOREVER. Everyone, everywhere, deserves the OPPORTUNITY to learn, begin and grow a career in this fascinating field. Therefore, Cybrary is a free community where people, companies and training come together to give everyone the ability to collaborate in an open source way that is revolutionizing the cyber security educational experience.

Support Cybrary

Donate Here to Get This Month's Donor Badge

 
Skip to toolbar

We recommend always using caution when following any link

Are you sure you want to continue?

Continue
Cancel