Nagios Installation on Linux - Step by Step Nagios Tutorial

Nagios Installation on Linux, nagios installation step by step, nagios installation step by step in linux, install nagios, install nagios on linux

Nagios Installation on Linux step by step procedure
As far as Infrastructure management is concerned, Nagios is one of the most powerful and open source software that can be used for network and infrastructure monitoring. Nagios will monitor servers, switches, applications and services. It alerts the System Administrator when something went wrong and also alerts back when the issues has been rectified.

With Nagios you can:

– Monitor your entire IT infrastructure.
– Identify problems before they occur.
– Know immediately when problems arise.
– Share availability data with stakeholders.hypothetical question
– Detect security breaches.
– Plan and budget for IT upgrades.
– Reduce downtime and business losses.

Our Scenario is to install nagios on Linux Server.

Nagios server:
Operating system : Red Hat 6.5 (RHEL6.5) minimal installation
IP Address       : 192.168.2.1


1. Install Required Dependencies Packages

Please install all below required dependencies for Nagios through yum server, because installing these packages individually  is more complicated. So we recommended to go with Yum server.
# yum install gd gd-devel gcc glibc glibc-common httpd php make net-snmp
2. Download Nagios (Nagios Core) Software and Nagios Plugins

If you wish to download the latest version, please visit https://www.nagios.org/download/core

I have downloaded from the below direct link and kept in my linux server already in the folder /home/learnitguide.

Nagios Core Link : http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.1.0rc1.tar.gz
Nagios Plugin Link : http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz
[learnitguide@nagiosserver ~]# cd /home/learnitguide/
Extract Nagios Core and its Plugins:
[learnitguide@nagiosserver ~]# tar -xvf nagios-4.1.0rc1.tar.gz
[learnitguide@nagiosserver ~]# tar -xvf nagios-plugins-2.0.3.tar.gz
Before going for installation, please create a dedicated user and group for nagios.
[learnitguide@nagiosserver ~]# useradd nagios
[learnitguide@nagiosserver ~]# passwd nagios
Changing password for user nagios.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

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.


[learnitguide@nagiosserver ~]# groupadd nagcmd
[learnitguide@nagiosserver ~]# /usr/sbin/usermod -a -G nagcmd nagios
[learnitguide@nagiosserver ~]# /usr/sbin/usermod -a -G nagcmd apache

3. Basic Configuration and Installation of Nagios

Now, first we will configure Nagios Core and to do so we need to go to Nagios directory and run configure file and if everything goes fine, it will show the output in the end as type 'make all' to compile the main program and CGIs.


[learnitguide@nagiosserver ~]# cd nagios-4.1.0rc1
[learnitguide@nagiosserver nagios-4.1.0rc1]# ./configure --with-command-group=nagcmd

Now, after configuring we need to Compile and install all the binaries with make command and make install command will install all the needed libraries in your machine and we can proceed further.


[learnitguide@nagiosserver nagios-4.1.0rc1]# make all
[learnitguide@nagiosserver nagios-4.1.0rc1]# make install

Sample Output:

*** Main program, CGIs and HTML files installed ***

You can continue with installing Nagios as follows (type 'make'
without any arguments for a list of all possible options):

  make install-init
     - This installs the init script in /etc/rc.d/init.d

  make install-commandmode
     - This installs and configures permissions on the
       directory for holding the external command file

  make install-config
     - This installs sample config files in /usr/local/nagios/etc


Execute all commands as show in the above output one by one as follows,

Following command will install the init scripts for Nagios.


[learnitguide@nagiosserver nagios-4.1.0rc1]# make install-init
/usr/bin/install -c -m 755 -d -o root -g root /etc/rc.d/init.d
/usr/bin/install -c -m 755 -o root -g root daemon-init /etc/rc.d/init.d/nagios

*** Init script installed ***

To make nagios work from command line we need to install command-mode.

[learnitguide@nagiosserver nagios-4.1.0rc1]# make install-commandmode
/usr/bin/install -c -m 775 -o nagios -g nagcmd -d /usr/local/nagios/var/rw
chmod g+s /usr/local/nagios/var/rw

*** External command directory configured ***

Next, install sample nagios files, please run following command.


[learnitguide@nagiosserver nagios-4.1.0rc1]# make install-config


4. Customizing Nagios Configuration:

Open the “contacts.cfg” file with your choice of editor and set the email address associated with the nagiosadmin contact definition to receiving email alerts.


[learnitguide@nagiosserver nagios-4.1.0rc1]# vi /usr/local/nagios/etc/objects/contacts.cfg

##############################################################################
 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   admin@learntiguide.net    ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
        }


5. Install and configure Web Interface for Nagios:

We are done with all configuration in the backend, now we will configure Web Interface for Nagios with following command. The below command will Configure Web interface for Nagios and a web admin user will be created “nagiosadmin”.


[learnitguide@nagiosserver ~]# make install-webconf
/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/httpd/conf.d/nagios.conf

*** Nagios/Apache conf file installed ***

In this step, we will be creating a password for “nagiosadmin”. After executing this command, please provide a password twice and keep it remember because this password will be used when you login in the Nagios Web interface.


[learnitguide@nagiosserver ~]# htpasswd -s -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Restart Apache to make the new settings take effect.


[learnitguide@nagiosserver ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

6. Compile and Install Nagios Plugin:

We have downloaded nagios plugins in /home/learnitguide/nagios-plugins-2.0.3, Go there and configure and install it as directed below.


[learnitguide@nagiosserver nagios-plugins-2.0.3]# cd /home/learnitguide/nagios-plugins-2.0.3
[root@RHEL5 downloads]# cd nagios-plugins-1.5
[learnitguide@nagiosserver nagios-plugins-2.0.3]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios
[learnitguide@nagiosserver nagios-plugins-2.0.3]# make
[learnitguide@nagiosserver nagios-plugins-2.0.3]# make install

7. Verify Nagios configuration file:

Now we are all done with Nagios configuration and its time to verify it and to do so please insert following command. If everything goes smooth it will show up similar to below output.


[learnitguide@nagiosserver nagios-plugins-2.0.3]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

8. Add Nagios Services to System Startup:

To make Nagios work across reboots, we need to add nagios and https with chkconfig command.

[learnitguide@nagiosserver nagios-plugins-2.0.3]# chkconfig --add nagios
[learnitguide@nagiosserver nagios-plugins-2.0.3]# chkconfig --level 35 nagios on
[learnitguide@nagiosserver nagios-plugins-2.0.3]# chkconfig --add httpd
[learnitguide@nagiosserver nagios-plugins-2.0.3]# chkconfig --level 35 httpd on

Restart Nagios to make the new settings take effect.


[learnitguide@nagiosserver nagios-plugins-2.0.3]# service nagios start
nagios is stopped
Starting nagios:                                           [  OK  ]

Note : Please turn off your iptables and selinux or add the nagios ports to allow.

Login to Nagios Web Interface:

Your nagios is ready to work, please open it in your browser with “http://Your-server-IP-address/nagios” or “http://192.168.2.1/nagios” and provide the username “nagiosadmin” and password.
Nagios Installation on Linux step by step procedure, how to setup nagios, nagios installation step by step in ubuntu, nagios installation step by step in linux, nagios installation step by step in linux pdf, nagios installation and configuration, nagios installation step by step in windows, nagios installation centos, nagios installation linux, nagios monitoring, how to install nagios on redhat linux step by step, how to install nagios on ubuntu, how to install nagios on centos
Please check other posts for configuring or adding linux clients and windows clients to the nagios server.
Leave a comments if you have any concerns. Thank You.
how to install nagios on windows 7, how to install nagios on linux step by step, how to install nagios plugins, nagios setup, how to configure nagios on linux, install nagios on redhat 6, install nagios on redhat 7, install nagios on redhat 5, install nagios on rhel5, install nagios on rhel6, install nagios on rhel7
June 18, 2015

Post a Comment

[disqus][facebook][blogger]

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget