In this article, we will have explained the necessary steps to install and configure Nagios on CentOS 8. Before continuing with this tutorial, make sure you are logged in as a user with
sudo privileges. All the commands in this tutorial should be run as a non-root user.
Nagios is an open source monitoring tool used to monitor different Linux Machines or different client hosts. It monitors the HTTP, FTP, SSH, SMTP, etc along-with the CPU usage, RAM, Disk Usage, and different process that are running.
Nagios Core Features
- Monitoring of network services e.g SMTP, POP3, HTTP, NNTP, ICMP, SNMP, FTP, SSH
- Monitoring of host resources such as processor load, disk usage, system logs on a majority of operating systems, including Microsoft Windows
- Monitoring of any hardware (like probes for temperature, alarms, etc.) which have the ability to send collected data via a network to specifically written plugins
- A simple plugin design that allows users to easily develop their own service checks depending on needs, by using their tools of choice (shell scripts, C++, Perl, Ruby, Python, PHP, C#, etc.)
- A web-interface for viewing current network status, notifications, problem history, log files, etc.
- Support for implementing performance data graphing
- Support for database backend such as NDOUtils
- Push notifications
Install Nagios on CentOS 8
Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.
Step 2. Install Required Build Tools.
Run the command below to dependency packages:
Step 3. Download Nagios Core Source Code.
Nagios Core 4.4.6 is the latest stable release at the time of this writing. The source code is available at GitHub and we can easily download it by using
wget the command:
After downloading the tarball file, extract it using the command:
Next, configure the Nagios Core source according to our CentOS 8 environment:
Then, add Apache user to the Nagios group:
Step 4. Install Nagios Core on CentOS 8.
Run the following command to install Nagios:
After that, create the Nagios service by using the following command:
Next, install and configure the external command file as well as the permissions on the directory holding the external commands file:
Install Nagios Sample configuration file:
Next, install the Apache HTTP server configuration files for Nagios:
Step 5. Configure Nagios Apache Authentication.
Create an Admin user and add it to htaccess password file:
Once you are done with the configuration, start and enable Apache to run on system boot:
If firewallD is running on your system, be sure to enable external access to Apache:
Step 6. Install Nagios Plugins.
Download Nagios Plugins to
/tmp the directory and extract it:
Compile and install the Nagios plugins:
Step 7. Access Nagios Web Interface.
Now access the Nagios web interface by going following URL in your web browser:
Congratulation, you have learned how to install and configure Nagios on CentOS 8. If you have any questions, please leave a comment below.