HOW TO INSTALL NAGIOS CORE 4.4 SERVER ON CENTOS7/RHEL 7

HOW TO INSTALL NAGIOS CORE 4.4 SERVER ON CENTOS/RHEL 7


INTRODUCTION:

Nagios is a industry slandered IT infrastructure monitoring solutions. Which is one of the most popular, open source , powerful server and network monitoring system. It enables organizations to identify and resolve IT infrastructure problems before they affect critical business processes. Nagios has the capability of monitoring application, services with an entire IT infrastructure.
Which can monitor host resources such as CPU Load,CPU Usage, DISK Throughput, Disk Iops, Network Speed, Network Throughput and finally trigger an alert via email.
LAB SETUP
HostIP
Nagios 4 Server172.25.10.50
Client172.25.10.100
OS / PackageVersion
CentOS - Nagios Server7
CentOS - Client Host7
Nagios Core4.4.5
Nagios Plugin2.2.1
NRPE Package3

SERVER SIDE CONFIGURATIONS

STEP 01: COMPLETE PREREQUISITES

A. SELINUX CONFIGURATION:
SELinux need to disabled & set it into permissive mode.
sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
Initially, We need to have a freshly installed CentOS7 / RHEL7 operating system.
B. UPDATE AN OPERATING SYSTEM.
yum -y update
C. INSTALL REQUIRED PACKAGES.
Now, We need to install Apache, PHP, SNMP and some other packages.
yum install -y gcc glibc glibc-common wget unzip httpd php gd gd-devel perl postfix net-snmp

STEP 02: INSTALL NAGIOS CORE

A. DOWNLOAD NAGIOS CORE SOURCE PACKAGE.
Create a download directory. And download Nagios Core version 4.4 into that directory.
mkdir /nagios
cd /nagios

wget -O nagioscore.tar.gz https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.5.tar.gz
Extract nagios source package.
tar xvzf nagioscore.tar.gz
B. COMPILE NAGIOS PACKAGE.
Configure Nagios settings.
cd /nagios/nagioscore-nagios-4.4.5/

./configure
C. COMPILE THE MAIN PROGRAM & CGIS.
make all
D. CREATE NAGIOS USER & GROUP.
This adds the users and groups if they do not exist This will creates a user and a group named “nagios”. The apache user is also added to the nagios group.
make install-groups-users

usermod -a -G nagios apache
E. INSTALL THE MAIN PROGRAM, CGIS AND HTML FILES.
make install
H. SETUP SERVICES & DAEMONS.
make install-init
I. INSTALL SERVICE / DAEMON
This installs the service or daemon files and also configures them to start on boot.
make install-daemoninit
J. SET PERMISSIONS ON THE EXTERNAL COMMANDS DIRECTORY.
make install-commandmode
K. INSTALL SAMPLE CONFIG FILES.
This installs SAMPLE config files in /usr/local/nagios/etc You’ll have to modify these sample files before you can use Nagios.
make install-config
L. INSTALL APACHE CONFIGS FOR NAGIOS WEB INTERFACE.
make install-webconf
M. INSTALL NAGIOS INTERFACE THEME.
This installs the Exfoliation theme for the Nagios web interface.
make install-exfoliation
M. FIREWALL CONFIGURATION.
Allow inbound traffic via tcp port 80.
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
O. CREATE “NAGIOSADMIN” USER ACCOUNT.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
P. START & ENABLE APACHE WEB SERVER.
Enable service to start automatically while system boot.
systemctl start httpd.service
systemctl enable httpd.service
Q. ENABLE & START SERVICE
systemctl enable nagios.service 
systemctl restart nagios.service
Q. ACCESSING THE NAGIOS WEB INTERFACE
Now, Nagios Core server installation and configuration has been completed.
Now you can log into the Nagios Web Interface through the web browser.
<3.png> <4.png>
Note: You will notice there some error unders the hosts & service,Eventhough We have installed Nagios Core.
(No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_load, ...) failed. errno is 2: No such file or directory 
These errors wiil be resoloved once you installed nagios pluings.

STEP 04: INSTALLING NAGIOS PLUGINS FROM YUM REPOSITORY

A. Install Prerequisites
yum install -y gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils epel-release
yum install -y perl-Net-SNMP
B. Install Nagios Plugins
yum -y install nagios-plugins-all
C. Copy plugins if not available in the directory.
cp /usr/lib64/nagios/plugins/check_* /usr/local/nagios/libexec/

STEP 05: RESTART NAGIOS, APACHE AND NRPE SERVERS

systemctl restart nagios httpd nrpe

STEP 06: HOW TO INSTALL NRPE V3 FROM YUM REPOSITORY

A. Install Prerequisites
yum install -y gcc glibc glibc-common openssl openssl-devel perl wget
B. Install Latest EPEL Repository And System Updates
Install Latest EPEL YUM Repository
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y update
C. Install (NRPE v3) Nagios Remote Plugin Executor
yum -y install nrpe
D. Allow NRPE service Port Through the Firewall
[root@nagios /]# firewall-cmd --permanent --add-port=5666/tcp
[root@nagios /]# firewall-cmd --reload
F. Enable NRPE Service To Start at Boot
systemctl enable nrpe.service
systemctl restart nrpe.service




Comments