Thursday, January 6, 2011

Simple Nagios Installation and Configuration.

Nagios Prerequisites:

1. Packages - Apache Web Server, PHP, gcc & gd libraries for compilation.

2. Should be configured with static IP & valid FQDN.

3. All the monitoring devices should be accessible from Nagios Host.

A. Installation of Apache :

#yum install httpd*

Note : Now after httpd installation start webserver by,

#service httpd start

#chkconfig httpd on

B. Install all dependency packages like,

#yum install php* gcc* gd*

C. Download Nagios "nagios-3.2.3.tar.gz" & "nagios-plugins-1.4.15.tar.gz" packages from below website,


D. Nagios Installation :

1. Extract nagios-3.2.3.tar.gz package,

#cd /root/Desktop/

#tar -zxvf nagios-3.2.3.tar.gz

It will extract all files in "nagios-3.2.3" folder,

2. Add User "nagios"  & provide password,

#useradd nagios
#passwd nagios

#usermod -a -G nagios apache

Note : The above command will permit users to execute commands through Web Interface.

3. Go to "nagios-3.2.3" folder,

#cd nagios-3.2.3


Copy it's configuration output in a file for your info as below,


*** Configuration summary for nagios 3.2.3 10-03-2010 ***:

 General Options:
        Nagios executable:  nagios
        Nagios user/group:  nagios,nagios
       Command user/group:  nagios,nagios
            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


Next, execute these commands;

#make all
#make install
#make install-init
#make install-config
#make install-commandmode
#make install-webconf

4. Create a user & provide password to access nagios on web,

#htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

#service httpd restart (Restart httpd service)

5. Nagios Plug-in installation:

#tar -zxvf nagios-plugins-1.4.15.tar.gz
#cd nagios-plugins-1.4.15
#make install

6. Add nagios service in chkconfig,

#cd /etc/init.d/
#chkconfig --add nagios
#chkconfig nagios on

E. Checking nagios configuration for errors;

#/usr/local/nogios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

F. Accessing Nagios through Web, open Web browser;

Login Cridentials will be same as u configured in #Step D.4  i.e.

Username - nagiosadmin
Password - *******

G. Configuring remotehost or device in nagios:

#cp /usr/local/nagios/etc/objects/localhost.cfg  /usr/local/nagios/etc/objects/LinuxHost1.cfg

Note : Comment the hostgroup entries in order to prevent duplicate entries and change the localhost entries to the remote machine hostname and IP address.]

No comments:

Post a Comment