What is nagios ?
Nagios is a host and service monitor designed to inform you of network problems before your clients, end-users or managers do. It has been designed to run under the Linux operating system. The monitoring daemon runs intermittent checks on hosts and services you specify using external "plugins" which return status information to Nagios. When problems are encountered, the daemon can send notifications out to administrative contacts in a variety of different ways (email, instant message, SMS, etc.). Current status information, historical logs, and reports can all be accessed via a web browser.
Nagios Features
Nagios has a lot of features, making it a very powerful monitoring tool. Some of the major features are listed below:
Monitoring of network services (SMTP, POP3, HTTP, NNTP, PING, etc.)
Monitoring of host resources (processor load, disk and memory usage, running processes, log files, etc.)
Monitoring of environmental factors such as temperature
What You'll End Up With
If you follow these instructions, here's what you'll end 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/
Required Packages
Make sure you've installed the following packages on your Ubuntu installation before continuing. - Apache 2
- PHP
- GCC compiler and development libraries
- GD development libraries
1. Installation Process............
For Linux and Fedora # yum -y install httpd* ( To install Apache)
# yum -y install php* (To install PHP)
# yum -y install gcc, yum -y install gcc-c++, yum -y install glibc (To Install GCC )
# yum -y install gd gd-devel (To Install GD)
For Ubuntu and Debian
$sudo apt-get install apache2
$sudo apt-get install libapache2-mod-php5
$sudo apt-get install build-essential
2. Create a new nagios user account and give it a password.
# useradd nagios
Create a new nag group for allowing external commands to be submitted through the web interface. Add both the nagios user and the apache user to that group.# groupadd nagcmd
# usermod -a -G nagcmd nagios
# usermod -a -G nagcmd apache
3. Download the Package # usermod -a -G nagcmd nagios
# usermod -a -G nagcmd apache
Download nagios tar file along with the plugins
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.3.tar.gzNow go to the folder or directory where you have downloaded the files. In my case it is Download or /tmp and the below command ...........To install Nagios
wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz
4. Install the Package
# cd /tmp
# tar xzf nagios-3.2.0.tar.gz
# cd nagios-3.2.0
# ./configure –with-command-group=nagcmd
# make all
# make install
# make install-init
# make install-config
# make install-commandmode
# tar xzf nagios-3.2.0.tar.gz
# cd nagios-3.2.0
# ./configure –with-command-group=nagcmd
# make all
# make install
# make install-init
# make install-config
# make install-commandmode
5. Configure the Web Interface
Install the Nagios web config file in the Apache conf.d directory. make install-webconfCreate a nagiosadmin account for logging into the Nagios web interface. Remember the password you assign to this account - you'll need it later.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadminRestart Apache to make the new settings take effect.
service httpd restart
7.Compile and Install the Nagios Plugins
# cd /tmp
# tar xzf nagios-plugins-1.4.11.tar.gz
# cd nagios-plugins-1.4.11
# ./configure –with-nagios-user=nagios –with-nagios-group=nagios
# make
# make install
# tar xzf nagios-plugins-1.4.11.tar.gz
# cd nagios-plugins-1.4.11
# ./configure –with-nagios-user=nagios –with-nagios-group=nagios
# make
# make install
8. Start Nagios
Now start Nagios and add it to the list of system services.# service nagios start
/etc/init.d/nagios start
# chkconfig nagios on
9. Login to the Web Interface
You should now be able to access the Nagios web interface at the URL below. You'll be prompted for the username (nagiosadmin) and password you specified earlier. http://localhost/nagios/
10. Add host to Configure file
We are done with the basic installation of nagios and its corresponding plugins. Now, I will show you how to monitor a group of hosts. On successful completion of the installation you will find localhost.cfg in the following path.
/usr/local/nagios/etc/objects/localhost.cfg
In short localhost.cfg is used to define the hosts and services that we want to monitor on the host system.(Host system here refers to the one we want to monitor)
open this file and add the following next to host definition lines.
define host{
use linux-server
host_name rahul-desktop
address 10.10.10.142
}
use – (uses the default template defined in templates.cfg)
host_name – (hostname can be anything)
address- (address of the host)
Now save the file and restart Nagios.
service nagios restart
NOTE: Make sure you dont add anything to this file because if you are new to nagios debugging would be difficult.
Now you can check the output in the browser.
http://localhost/nagios
11. You're Done
Congratulations! You sucessfully installed Nagios. Your journey into monitoring is just beginning. You'll no doubt want to monitor more than just your local machine, so check out the following docs of Nagios official website ..........
No comments:
Post a Comment