Nagios Server Installation

Installation and configuration Nagios Core 4.x

1. Install Required NPackages and Dependencies
[root@velocity-lab ~]#yum install httpd mod_ssl php php_cli gcc glibc gclib-common gd gd_devel net-snmp
[root@velocity-lab ~]#service httpd start
[root@velocity-lab ~]#chkconfig httpd on
2. Setup User Accounts
[root@velocity-lab ~]#useradd nagios
[root@velocity-lab ~]#passwd nagios
[root@velocity-lab ~]#groupadd nagcmd
[root@velocity-lab ~]#usermod -a -G nagcmd nagios
[root@velocity-lab ~]#usermod  -a -G nagcmd apache
3. Install Nagios Core Service
[root@velocity-lab ~]#cd /usr/local/src
[root@velocity-lab ~]#wget http://sourceforge.net/projects/nagios/files/nagios-4.x/nagios-4.1.1/nagios-4.1.1.tar.gz
[root@velocity-lab ~]#tar -xvzf nagios-4.1.0rc1.tar.gz
[root@velocity-lab ~]#cd nagios-4.1.0rc1
[root@velocity-lab ~]#ls
[root@velocity-lab ~]#./configure --with-command-group=nagcmd
[root@velocity-lab ~]#make all
[root@velocity-lab ~]#make install
[root@velocity-lab ~]#make install-init
[root@velocity-lab ~]#make install-config
[root@velocity-lab ~]#make install-commandmode
[root@velocity-lab ~]#make install-webconf
[root@velocity-lab ~]#make install-classicui
[root@velocity-lab ~]#make install-exfoliation

 

[root@velocity-lab ~]#cp -R /usr/local/src/nagios-4.1.0rc1/contrib/eventhandlers/ /usr/local/nagios/libexec/
[root@velocity-lab ~]#chown -R nagios:nagios /usr/local/nagios/libexec/

 

4.Configure Apache Authentication
[root@velocity-lab ~]#htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
[root@velocity-lab ~]#service httpd restart
5.Install Nagios Plugins
[root@velocity-lab ~]#cd /usr/local/src
[root@velocity-lab ~]#wget http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz
[root@velocity-lab ~]#tar -xvzf nagios-plugins-2.0.3.tar.gz
[root@velocity-lab ~]#cd nagios-plugins-2.0.3
[root@velocity-lab ~]#./configure --with-nagios-user=nagios --with-nagios-group=nagios
[root@velocity-lab ~]#make
[root@velocity-lab ~]#make install
6. Verify and Start Nagios
[root@velocity-lab ~]#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
[root@velocity-lab ~]#service nagios start
[root@velocity-lab ~]#chkconfig nagios on (chkconfig --add nagios)

 

7. Access Nagios in web Browser
# http://ipaddress/nagios/

###Note
templates are stored inside
cd /usr/local/nagios/etc/objects

 

nagios dashboard

Leave a Reply