Nagios Core Configuration |
tags: nagios, nagios monitoring, nagios tutorial, nagios xi, nagios download, nagios configuration, nagios interview questions, nagios core, nagios core installation, nagios core installation, nrpe nagios, nrpe unable to read output, nagios client, nagios in linux
Question: how to configure Nagios in Linux?
Question : step by step nagios configuration in centos ?
Question: Linux monitoring tool
Nagios is an 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
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 Plugins |
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
## Compile and install all the binaries with make command and make install command
make all
make install
Step 5:
## Install the init scripts for Nagios:
make install-init
## install command-mode.
make install-commandmode
## Install sample nagios files
make install-config
## Install & Configure Web Interface for Nagios
make install-webconf
Step 6:
## --- Install Nagios Plugins
cd ..
cd nagios-plugins-*
./configure --with-nagios-user=nagios --with-nagios-group=nagiosgroup
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
## 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 ******
Step 8:
## Configure check_nrpe Command
vi /usr/local/nagios/etc/objects/commands.cfg
## 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
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.
## 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
Dashboard Window
Hosts Window
Services Windows
Part 1: Nagios Core 4.X configuration in Linux
Part 2: Add Remote hosts and service in Nagios
Part 3: Monitor MySQL/MariaDB Using check_mysql Plugin
Part 4: Monitor Tomcat using check_tomcat Plugin