What is NAGIOS:
Nagios is a powerful monitoring system that enables organizations to identify and resolve IT infrastructure problems before they affect critical business processes.
Nagios monitors your entire IT infrastructure to ensure systems, applications, services, and business processes are functioning properly. In the event of a failure, Nagios can alert technical staff of the problem, allowing them to begin remediation processes before outages affect business processes, end-users, or customers. With Nagios you’ll never be left having to explain why an unseen infrastructure outage hurt your organization’s bottom line
STEP 1:
1) Install the below listed packages and their binaries & libraries with necessary dependencies:
[stextbox id=”Default” mode=”css” bwidth=”7″ color=”FFFFFF” ccolor=”000000″ bcolor=”1A52EA” bgcolor=”000000″ bgcolorto=”000000″ image=”null”]
[root@quickfixlinux ~]# yum install -y gcc glibc glibc-common gd make net-snmp [/stextbox]
Additionally, httpd and php will reuqired to install on the nagios monitoring server.
STEP 2:
To Create the nagios user in the client Machine:
STEP 3:
Extract the Nagios Plugin. Create a directory for nagios:
[stextbox id=”Default” mode=”css” bwidth=”7″ color=”FFFFFF” ccolor=”000000″ bcolor=”1A52EA” bgcolor=”000000″ bgcolorto=”000000″ image=”null”]
[root@quickfixlinux ~]# mkdir /root/nagios
[root@quickfixlinux ~]# cd /root/nagios
[root@quickfixlinux ~]# wget https://nagios-plugins.org/download/nagios-plugins-2.1.4.tar.gz#_ga=1.261271620.835141296.1490864076 [/stextbox]
STEP 4:
After the download of nagios-plugin 2.1.4, need to extract it out:
[stextbox id=”Default” mode=”css” bwidth=”7″ color=”FFFFFF” ccolor=”000000″ bcolor=”1A52EA” bgcolor=”000000″ bgcolorto=”000000″ image=”null”]
[root@quickfixlinux ~]# tar xvf nagios-plugin-2.1.4.tar.gz [/stextbox]
STEP 5:
Compile and Install Nagios Plugin:
[stextbox id=”Default” mode=”css” bwidth=”7″ color=”FFFFFF” ccolor=”000000″ bcolor=”1A52EA” bgcolor=”000000″ bgcolorto=”000000″ image=”null”]
[root@quickfixlinux ~]#cd nagios-plugins-2.1.4
[root@quickfixlinux~]# ./configure –with-nagios-user=nagios –with-nagios-group=nagios
[root@quickfixlinux ~]# make
[root@quickfixlinux ~]# make install [/stextbox]
STEP 6:
Set the permission for the compiled plugin directories:
STEP 7:
Mostly, the xinetd package will be installed, if not try to install that package as well.
[stextbox id=”Default” mode=”css” bwidth=”7″ color=”FFFFFF” ccolor=”000000″ bcolor=”1A52EA” bgcolor=”000000″ bgcolorto=”000000″ image=”null”]
[root@quickfixlinux ~]# yum install xinetd [/stextbox]
STEP 8:
NRPE allows you to remotely execute Nagios plugins on other Linux/Unix machines. This allows you to monitor remote machine metrics (disk usage, CPU load, etc.). NRPE can also communicate with some of the Windows agent addons, so you can execute scripts and check metrics on remote Windows machines as well.
[stextbox id=”Default” mode=”css” bwidth=”7″ color=”FFFFFF” ccolor=”000000″ bcolor=”1A52EA” bgcolor=”000000″ bgcolorto=”000000″ image=”null”]
[root@quickfixlinux ~]# cd /root/nagios
[root@quickfixlinux ~]# wget https://github.com/NagiosEnterprises/nrpe/archive/3.0.1.tar.gz [/stextbox]
Extract the NRPE tar file now:
[stextbox id=”Default” mode=”css” bwidth=”7″ color=”FFFFFF” ccolor=”000000″ bcolor=”1A52EA” bgcolor=”000000″ bgcolorto=”000000″ image=”null”]
[root@quickfixlinux ~]# tar xvf 3.0.1.tar.gz [/stextbox]
Now,
[stextbox id=”Default” mode=”css” bwidth=”7″ color=”FFFFFF” ccolor=”000000″ bcolor=”1A52EA” bgcolor=”000000″ bgcolorto=”000000″ image=”null”]
[root@quickfixlinux ~]# cd /root/nagios/nrpe-3.0.1
[root@quickfixlinux ~]# ./configure –with-nagios-user=nagios –with-nagios-group=nagios
[root@quickfixlinux ~]# make all [/stextbox]
The installation should be successfully completed now.. So next…
STEP 9:
Create a nrpe file under the path as /etc/xinetd.d/nrpe:
# default: off
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
flags = REUSE
type = UNLISTED
port = 5666
socket_type = stream
wait = no
user = nagios
group = nagios
server = /usr/local/nagios/bin/nrpe
server_args = -c /etc/nagios/nrpe.cfg –inetd
log_on_failure += USERID
disable = no
only_from = space
} |
STEP 10:
Next, you need to make an entry in the /etc/service file.. Before you edit take a backup of this file for safety consideration:
[stextbox id=”Default” mode=”css” bwidth=”7″ color=”FFFFFF” ccolor=”000000″ bcolor=”1A52EA” bgcolor=”000000″ bgcolorto=”000000″ image=”null”]
[root@quickfixlinux ~]# cp /etc/services /etc/services.31MAR17 [/stextbox]
and add the below line at the file :
Now, restart the xinetd service:
[stextbox id=”Default” mode=”css” bwidth=”7″ color=”FFFFFF” ccolor=”000000″ bcolor=”1A52EA” bgcolor=”000000″ bgcolorto=”000000″ image=”null”]
[root@quickfixlinux ~]# service xinetd restart [/stextbox]
STEP 11:
To verify the nrpe service is running and responding in the client machine:
And to verify the nrpe daemon is listening as expected:
STEP 12:
To make changes in the nagios configuration file:
Open the path /usr/local/nagios/etc/nagios.cfg [ Make a backup of this file before making changes].
Search for the word “allowed_hosts” = 127.0.0.1 and replace with your server IP address
NOTE: Place your client IP address and Hostname in /etc/hosts as well as in Nagios monitoring server too.
Then, create a directory under /etc for nagios:
[stextbox id=”Default” mode=”css” bwidth=”7″ color=”FFFFFF” ccolor=”000000″ bcolor=”1A52EA” bgcolor=”000000″ bgcolorto=”000000″ image=”null”]
[root@quickfixlinux ~] # mkdir /etc/nagios
[root@quickfixlinux ~]# cp /usr/local/nagios/etc/nrpe.cfg /etc/nagios/ [/stextbox]
Once done, restart the xinetd service.. to verify the NRPE daemon service is working or not:
Now, the communication is working fine, which can be verified using the ip address loaded in the web browser.
……….