Nagios Core is an open source IT infrastructure monitoring and alerting platform built using PHP. It is used for monitoring mission-critical IT infrastructure components such as network infrastructure, servers, network protocols, system metrics, applications, and services.
In addition, Nagios Core supports alerting (when critical infrastructure components fail and recover), via email, SMS, or custom script, and reporting of the historical record of events, outages, notifications, and alert response for later analysis.
Importantly, Nagios Core ships with multiple API’s that provide integration with existing or third-party applications as well as community-developed add-ons.
This article will walk you through the process of installing Nagios Core 4.4.3 and Nagios Plugins 2.2.1 in RHEL 8 Linux distribution.
- RHEL 8 with Minimal Installation
- RHEL 8 with RedHat Subscription Enabled
- RHEL 8 with Static IP Address
Step 1: Install Required Dependencies
1. To install Nagios Core package from sources, you need to install following dependencies including Apache HTTP server and PHP using the default dnf package manager.
# dnf install -y gcc glibc glibc-common perl httpd php wget gd gd-devel
2. Next, start the HTTPD service for now, enable it to automatically start at system boot and check its status using the systemctl commands.
# systemctl start httpd # systemctl enable httpd # systemctl start httpd
Step 2: Downloading, Compiling and Installing Nagios Core
3. Now download the Nagios Core source package using wget command, extract it and move into the extracted directory as shown.
# wget -O nagioscore.tar.gz https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.3.tar.gz # tar xzf nagioscore.tar.gz # cd nagioscore-nagios-4.4.3/
4. Next, run the following commands to configure the source package and build it.
# ./configure # make all
5. After that create the Nagios User and Group, and add the Apache user to the Nagios Group as follows.
# make install-groups-users # usermod -a -G nagios apache
6. Now install the binary files, CGIs, and HTML files with using the following commands.
# make install # make install-daemoninit
7. Next, run the following commands to install and configure the external command file, a sample configuration file and the Apache-Nagios configuration file.
# make install-commandmode #installs and configures the external command file # make install-config #installs the *SAMPLE* configuration files. # make install-webconf #installs the Apache web server configuration files.
8. In this step, you need to secure the Nagios Core web console using HTTP basic authentication. So, you’ll need to create an Apache user account to be able to log into Nagios – this account will act as the Nagios Administrator account.
# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Step 3: Installing Nagio Plugins in RHEL 8
9. Next, you need to install necessary Nagios plugins. But before you download and install the Nagios plugins, you need to install the required packages for compiling and building the plugin package.
# dnf install -y gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils
10. Then download and extract the latest version of the Nagios Plugins using the following commands.
# wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugins/nagios-plugins/archive/release-2.2.1.tar.gz # tar zxf nagios-plugins.tar.gz
11. Move into the extracted directory, compile, build and install the Nagios Plugins install the Nagios Plugins as follows.
# cd nagios-plugins-release-2.2.1/ # ./tools/setup # ./configure # make # make install
12. At this point, you have set up the Nagios Core service and configured it to work with the Apache HTTP server. Now you need to restart the HTTPD service. Also, start and enable the Nagios service and check if it is up and running as follows.
# systemctl restart httpd.service # systemctl start nagios.service # systemctl start nagios.service # systemctl start nagios.service
13. If you have firewall running, you need to open port 80 in the firewall.
# firewall-cmd --permanent --zone=public --add-port=80/tcp # firewall-cmd --reload
14. Next disable SELinux which is in enforcing mode by default or you can set it in permissive mode.
# sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config # setenforce 0
Step 4: Accessing Nagios Web Console in RHEL 8
15. In this final step, you can now access the Nagios web console. Open your web browser and point it to Nagios Core web directory, for example (replace the IP address or FDQN with your own values).
http://192.168.56.100/nagios OR http://tecmint.lan/nagios
You will be prompted to enter a username and password to access the web interface. Provide the credentials you created in point 8 (i.e username is nagiosadmin and the password).
After a successful login, you will be presented with the Nagios interface as shown in the following screenshot.
Congratulations! You have successfully installed Nagios Core on your RHEL 8 server. If you have any questions, use the feedback form below to reach us.