nagios configuration in Linux step by step

nagios configuration in Linux step by step

nagios configuration in Linux  step by step, monitoring tools of  Linux; nagios tutorial; nagios installation, nagios core, nagios plugins, nagios configuration, nagios monitoring

Question: how to configure Nagios in Linux?


Question : step by step nagios configuration in centos ?

Question: Linux monitoring tool
Nagios is an awesome Open Source monitoring tool, it provides you more comprehensive monitoring environment to always keep an eye on your all machines/networks whether you are in your data center or just your small labs.With Nagios, you can monitor your remote hosts and their services remotely in a single window. It shows warnings and indicates if something goes wrong on your servers which eventually helps us to detect some problems before they occur. It helps us to reduce downtime and business losses.

OS - CentOS 7 64 bit

IP  - 172.17.20.100

Hostname - nagiosserver.linuxtopic.com


Step 1:

## Install  Dependencies
    yum install -y httpd php gcc glibc glibc-common gd gd-devel make net-snmp

nagios configuration in Linux  step by step, monitoring tools of  Linux; nagios tutorial; nagios installation, nagios core, nagios plugins, nagios configuration, nagios monitoring

Step 2:

## Create Nagios user & group:
useradd nagios

groupadd nagiosgroup
## Add Nagios and apache user to the nagcmd group
usermod -G nagiosgroup nagios

usermod -G nagiosgroup apache
Step 3:

## Download Nagios 4.3 from Offical site "https://www.nagios.org/downloads/" and unpack any directory "or" Download sourceforge.net
mkdir /tmp/nagios

cd /tmp/nagios

wget https://excellmedia.dl.sourceforge.net/project/nagios/nagios-4.x/nagios-4.3.1/nagios-4.3.1.tar.gz

wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz

nagios configuration in Linux  step by step, monitoring tools of  Linux; nagios tutorial; nagios installation, nagios core, nagios plugins, nagios configuration, nagios monitoring

tar xvf nagios-4.3.1.tar.gz

tar xvf nagios-plugins-2.2.1.tar.gz
Step 4:

## Configure Nagios & Compile 
./configure --with-command-group=nagiosgroup

nagios configuration in Linux  step by step, monitoring tools of  Linux; nagios tutorial; nagios installation, nagios core, nagios plugins, nagios configuration, nagios monitoring


##  Compile and install all the binaries with make command and make install command
make all

nagios-compile-2.png
make install

nagios1-make-install.png

Step 5:

## Install the init scripts for Nagios:
   make install-init
## install command-mode.
   make install-commandmode
nagios configuration in Linux  step by step, monitoring tools of  Linux; nagios tutorial; nagios installation, nagios core, nagios plugins, nagios configuration, nagios monitoring

## Install sample nagios files
   make install-config
nagios1-make-install-config.png

## Install & Configure Web Interface for Nagios
   make install-webconf
nagios configuration in Linux  step by step, monitoring tools of  Linux; nagios tutorial; nagios installation, nagios core, nagios plugins, nagios configuration, nagios monitoring

Step 6:

## --- Install Nagios Plugins
cd ..
cd nagios-plugins-*
./configure --with-nagios-user=nagios --with-nagios-group=nagiosgroup

nagios configuration in Linux  step by step, monitoring tools of  Linux; nagios tutorial; nagios installation, nagios core, nagios plugins, nagios configuration, nagios monitoring
   
make
make install

Step 7:

##------ Customize nagios configuration:
vi /usr/local/nagios/etc/nagios.cfg
## Now find an uncomment this line by deleting the #:

   #cfg_dir=/usr/local/nagios/etc/servers
   cfg_dir=/usr/local/nagios/etc/servers

nagios3-custm.png

## Create Directory
mkdir /usr/local/nagios/etc/servers
chown nagios:nagios /usr/local/nagios/etc/servers
## Configure Nagios Contacts
vi /usr/local/nagios/etc/objects/contacts.cfg
   email                           nagios@linuxtopic.com        ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******

nagios configuration in Linux  step by step, monitoring tools of  Linux; nagios tutorial; nagios installation, nagios core, nagios plugins, nagios configuration, nagios monitoring

Step 8:

## Configure check_nrpe Command
   vi /usr/local/nagios/etc/objects/commands.cfg
nagios configuration in Linux  step by step, monitoring tools of  Linux; nagios tutorial; nagios installation, nagios core, nagios plugins, nagios configuration, nagios monitoring

## Add the following to the end of the file:

define command{
       command_name check_nrpe
       command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}

Step 9:

## Verify nagios configuration file :
   /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
nagios6-verify.png

Step 10:
   
## --- Configure Apache
    sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
   >Enter a password at the prompt & Remember it as you will need it to access the Nagios web interface.

nagios7-webuser.png

## Note: Add user name in "/usr/local/nagios/etc/cgi.cfg" if your user not a nagiosadmin

Step 11:

## Restart Service
/etc/init.d/nagios restart

systemctl start nagios.service

systemctl restart httpd.service
Step 12:

Access Nagios on Web Browser


nagios configuration in Linux  step by step, monitoring tools of  Linux; nagios tutorial; nagios installation, nagios core, nagios plugins, nagios configuration, nagios monitoring


Dashboard Window

nagios8-access2.png

Hosts Window

nagios8-hosts.png

Services Windows

nagios configuration in Linux  step by step, monitoring tools of  Linux; nagios tutorial; nagios installation, nagios core, nagios plugins, nagios configuration, nagios monitoring



Previous
Next Post »