Wednesday 18 January 2012

Nagios Server Installation (Linux)


Nagios Installation Steps (Linux):  PDF version


1. Download  nagios-core and plugins

Download the required files from http://nagios.org/download

You would need :-
nagios-3.0.1.tar.gz
nagios-plugins-1.4.15.tar.gz


2. The following prerequisites are to be satisfied :

a) Make sure Apache (Default installation will do) is installed and running.
It can be checked using the URL http://localhost


b) Verify whether gcc is installed

[root@localhost]#rpm -qa | grep gcc

gcc-3.4.6-8
compat-gcc-32-3.2.3-47.3
libgcc-3.4.6-8
compat-libgcc-296-2.96-132.7.2
compat-gcc-32-c++-3.2.3-47.3
gcc-c++-3.4.6-8


c) Verify whether GD is installed

[root@localhost]# rpm -qa gd
gd-2.0.28-5.4E

3. Create the  user and group for nagios

[root@localhost]# useradd nagios
[root@localhost]# passwd nagios
[root@localhost]# groupadd nagcmd
[root@localhost]# usermod -G nagcmd nagios
[root@localhost]# usermod -G nagcmd apache


4. Install nagios packages.

 Go to the location where you have downloaded the nagios core and plugin packages :-

[root@localhost]# tar xvf nagios-3.0.1.tar.gz
[root@localhost]# cd nagios-3.0.1
[root@localhost]# ./configure --with-command-group=nagcmd --with-nagios-user=nagios  --with-nagios-group=nagios
[root@localhost]# make all
[root@localhost]# make install
[root@localhost]# make install-config
[root@localhost]# make install-commandmode

At the end of configure, the configuration Summary is displayed :

General Options:
-------------------------
Nagios executable: nagios
Nagios user/group: nagios,nagios
Command user/group: nagios,nagcmd
Embedded Perl: no
Event Broker: yes
Install ${prefix}: /usr/local/nagios
Lock file: ${prefix}/var/nagios.lock
Check result directory: ${prefix}/var/spool/checkresults
Init directory: /etc/rc.d/init.d
Apache conf.d directory: /etc/httpd/conf.d
Mail program: /bin/mail
Host OS: linux-gnu
Web Interface Options:
------------------------
HTML URL: http://localhost/nagios/
CGI URL: http://localhost/nagios/cgi-bin/
Traceroute (used by WAP): /bin/traceroute



5. Configure the web interface.

[root@localhost]# make install-webconf
[root@localhost# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password:
Re-type new password:
Adding password for user nagiosadmin..


6. Install Nagios Plugins

[root@localhost]# tar xvf nagios-plugins-1.4.11.tar.gz
[root@localhost]# cd nagios-plugins-1.4.11
[root@localhost]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
[root@localhost]# make
[root@localhost]# make install

Note:- In Redhat systems in case the above configure command might not work and the process might hang. when it displays the message  'checking for redhat spopen problem... ' . Use ' --enable-redhat-pthread-workaround' to the ./configure command as a solution for the problem.


7. Start Nagios

a) Add the nagios to the startup scripts.
[root@localhost]# chkconfig --add nagios
[root@localhost]# chkconfig nagios on

b) To verify there are no errors in the Nagios Configuration file use :
[root@localhost]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

c) Start the nagios
[root@localhost]# service nagios start
Starting nagios: done.


8. Web Interface Login.

Nagios Web URL: http://localhost/nagios/

You should use the User ID and Password that was created from Step 5 to login.



No comments:

Post a Comment