1) Install Required Dependencies
#yum install -y httpd php gcc glibc glibc-common gd gd-devel make net-snmp
2) Create Nagios User and Group
#useradd nagios
#groupadd nagcmd
3) Next, add both the nagios user and the apache user to the nagcmd group.
#usermod -G nagcmd Nagios
#usermod -G nagcmd apache
4) Create Nagios directory.
#mkdir /root/nagios
#cd /root/nagios
5) Download the latest Nagios and Plugin.
#wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.1.tar.gz
#wget https://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz
6) Extract Nagios Core and its Plugins.
#tar -xvf nagios-4.0.1.tar.gz
#tar –xvf nagios-plugins-1.5.tar.gz
7) Configure Nagios
#cd nagios-4.0.1
#./configure –with-command-group=nagcmd
8) Compile and Install.
#make all
#make install
#make install-init
#make install-commandmode
#make install-config
9) Edit and add your email address in contacts.cfg.
#vi /usr/local/nagios/etc/objects/contacts.cfg
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 nagios@webserverpage.com.com ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}
10) Compile/install web configuration of Nagios.
#make install-webconf
#htpasswd -s -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password: mypassword
Re-type new password: mypassword
Adding password for user nagiosadmin.
#service httpd start
#cd /root/Nagios
#cd nagios-plugins-1.5
#./configure –with-nagios-user=nagios –with-nagios-group=Nagios
#make
#make install
#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
# chkconfig –add nagios
# chkconfig –level 35 nagios on
# chkconfig –add httpd
# chkconfig –level 35 httpd on
# service nagios start
Continuation: