Search This Blog

How to install Nagios Core on CentOS8

Nagios Core is an open source Monitoring System. It is used for monitoring such as network infrastructure, switch, router, server, printer, network service, application and protocols. In this guide we are going to show how to install Nagios Core on CentOS 8.

Update our system

yum -y update

Disable Selinux

sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
setenforce 0

Install require package

yum -y install gcc glibc glibc-common perl httpd php php-cli wget net-snmp gd gd-devel

Download Nagios Source

After install packages required by Nagios, donwload Nagios source from the official site below.

wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.5.tar.gz

Extract Nagios Source

Extract Nagios Source and go to Nagios source directory.

tar -xvf nagios-4.4.5.tar.gz

Compile Nagios

Run ./configure script, it will check all the required package and dependencies that Nagios need and compile the main program and CGIs.

cd nagios-4.4.5
./configure
make all

Create user and group

The following command will create user nagios, group nagios and add Apache user to nagios group.

make install-groups-users
usermod -a -G nagios apache

Install Binaries

Install nagios binary , CGIs, and HTML files.

make install

Install service daemon

make install-daemoninit

Install the external command file

make install-commandmode

Install Configuration file

make install-config

Install Apache config file

make install-webconf

Allow port apache service on firewalld

firewall-cmd --zone=public --add-port=80/tcp
firewall-cmd --zone=public --add-port=80/tcp --permanent

Create nagiosadmin User Account

htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Install Nagios plugins

Install dependencies.

yum install -y gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils epel-release
yum --enablerepo=PowerTools,epel install perl-Net-SNMP

Download Nagios plugins source.

cd /tmp/
wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugins/nagios-plugins/archive/release-2.2.1.tar.gz

Extract plugin source.

tar zxf nagios-plugins.tar.gz

Compile and Install Plugin

cd /tmp/nagios-plugins-release-2.2.1/
./tools/setup
./configure
make
make install

Now, we almost done for Nagios Core installation. To verify our Nagios is working or not.
Restart service

systemctl restart httpd
systemctl restasrt nagios

Open favorite web browser and type http://server_ip/nagios. Put the correct user and password(nagiosadmin:yourpassword).


Now our Nagios Core installation is done.


Conclusion

Nagios Core is an open source Monitoring System. It is used for monitoring such as network infrastructure, switch, router, server, printer, network service, application and protocols.

No comments:

Post a Comment

How to install zabbix Server on Rocky Linux 9

How to set up Zabbix Server on Rocky Linux 9 1. Set Selinux to permissive mode sudo setenforce 0 sudo sed -i...