Installing Nagios On Ubuntu 10.10
In last post I have shown how to install zabbix on ubuntu 10.10 now I will show you how to install Nagios on Ubuntu 10.10 Desktop.
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
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
sudo apt-get install libgd2-xpm-dev
Create User Account for Nagios :-
Become root using
Sudo –s
Create a new nagios user account and give it a password.
/usr/sbin/useradd -m -s /bin/bash Nagios
passwd 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.
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -a -G nagcmd Nagios
/usr/sbin/usermod -a -G nagcmd www-data
Download Nagios and the Plugins
mkdir ~/downloads
cd ~/downloads
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.0.tar.gz
wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz
OR you can download from :-
Compile and Install Nagios
cd ~/downloads
tar xzf nagios-3.2.0.tar.gz
Run the Nagios configure script, passing the name of the group we created earlier :-
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
Customize Configuration
Sample configuration files have now been installed in the /usr/local/nagios/etc directory. These samplefiles should work fine for getting started with Nagios. You’ll need to make just one change before you proceed...Edit the /usr/local/nagios/etc/objects/contacts.cfg config file with your favorite editor and change the email address associated with the nagiosadmin contact definition to the address you’d like to use for receiving alerts
vi /usr/local/nagios/etc/objects/contacts.cfg
As I have change to sandeep@example.com highlight for your continuous
###############################################################################
#
# CONTACTS
#
###############################################################################
###############################################################################
# Just one contact defined by default - the Nagios admin (that's you)
# This contact definition inherits a lot of default values from the 'generic-contact'
# template which is defined elsewhere.
define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Nagios Admin ; Full name of user
email sandeep@example.com ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}
###############################################################################
Save the file.
Configure the Web Interface
make install-webconf
Create a nagiosadmin account for logging into the Nagios web interface. Remember the password you assign to this account – this password is required later to access.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
set the password and confirm it.
Now, restart or reload Apache to make the new settings take effect. Using following command
/etc/init.d/apache2 reload
Compile and Install the Nagios Plugins
cd ~/downloads
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
Configure Nagios to automatically start when the system boots.
ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios
Verify the sample Nagios configuration files.
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Start Nagios
/etc/init.d/nagios start
http://localhost/nagios/
OR
http://ipaddress/nagios/
Note:- to allow nagios to send Email notification you have to install and configure mailx and postfix
sudo apt-get install mailx
sudo apt-get install postfix
No comments:
Post a Comment