Nagios, known as Nagios Core, is a open source and most powerful application that monitors systems, networks and infrastructure. Nagios offers monitoring and alerting services for servers, switches, applications and services.
It alerts users when things go wrong and alerts them a second time when the problem has been resolved. Using a monitoring system, like Nagios, is an essential tool for any production server environment.
Installation of Nagios
First, update your apt-get package lists and upgrade the installed packages.
$ sudo apt-get update $ sudo apt-get upgrade
$ sudo apt-get install build-essential xinetd apache2
Let’s install Nagios now
$ sudo apt-get install nagios3 nagios-nrpe-plugin
You should be prompted to to configure mail server. Select No configuration for now.
Next, It will ask for nagiosadmin user’s password. Enter your nagiosadmin user’s password as shown below.
Then installation will continue and will finish.
Verify Nagios installation.
$ sudo nagios3 Nagios Core 3.5.1 Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors Copyright (c) 1999-2009 Ethan Galstad Last Modified: 08-30-2013 License: GPL Website: http://www.nagios.org Usage: nagios3 [options] <main_config_file> Options: -v, --verify-config Verify all configuration data -s, --test-scheduling Shows projected/recommended check scheduling and other diagnostic info based on the current configuration files. -x, --dont-verify-paths Don't check for circular object paths - USE WITH CAUTION! -p, --precache-objects Precache object configuration - use with -v or -s options -u, --use-precached-objects Use precached object config file -d, --daemon Starts Nagios in daemon mode, instead of as a foreground process Visit the Nagios website at http://www.nagios.org/ for bug fixes, new releases, online documentation, FAQs, information on subscribing to the mailing lists, and commercial support options for Nagios.
Login into Nagios Monitoring tool.
Get the IP address of the server and open browser, use below url to login.
URL : http://<<Server IP address>>/nagios3
Enter username as nagiosadmin and given password during the installation and click on Login.
Be sure to access your Nagios web interface, and check out the Services page to see all of your monitored hosts and services.
Use the following command to set your nagiosadmin user’s password
$ sudo htpasswd -c /etc/nagios3/htpasswd.users nagiosadmin
Proceed with adding Apache’s
www-data user to the
$ sudo usermod -a -G nagios www-data
Edit Nagios3 configuration file in
/etc/nagios3/nagios.cfg and enable external commands by setting
check_external_commands from 0 to 1
$ sudo vi /etc/nagios3/nagios.cfg check_external_commands=1
Add write permission to the group users for following directories.
$ sudo chmod g+w /var/lib/nagios3/rw $ sudo chmod g+w /var/lib/nagios3
Restart Nagios and Apache.
$ sudo service apache2 restart $ sudo service nagios3 restart