On this tutorial, we will focus on how to install Nagios Server on RHEL 9 / CentOS Stream 9. Monitoring is the process of analyzing the system resources including application servers and databases using monitoring tools. It involves gathering telemetry data on the operation of an IT environment to gauge performance and troubleshoot issues. Monitoring helps in observing how and why different systems behave in a specific way and provide insights to offer advanced analytics. Some of the monitoring tools include Amazon CloudWatch, Nagios, New Relic, Prometheus, InfluxDB, and others.


Nagios is a powerful monitoring software that monitors critical IT infrastructure components, including system metrics, network protocols, applications, services, servers, and network infrastructure. It ensures systems are running and functioning properly, alerts technical staff of any identified problem, and allows them to begin remediation processes to fix the issues before any outages occur.

Nagios offers different monitoring solutions including;

  • Nagios Core is Open Source system and network monitoring application
  • Nagios XI is an enterprise server and Network Monitoring Software.
  • Nagios Log Server sets up alerts to notify you when potential threats arise, or simply filters your data to quickly audit your system.
  • Nagios Network Analyzer is a commercial-grade network flow data analysis solution.
  • Nagios Fusion is designed to scale with your organization.

Nagios Core has a vibrant community with over 1+ million users and 10 years of active development. It is a stable and reliable platform that scales to thousands of nodes with failover capabilities to ensure continuous monitoring of critical IT infrastructure components. Other features include;

  • Comprehensive Monitoring of applications, services, networks, and systems.
  • Problem remediation by alert acknowledgments and event handlers.
  • Centralized view of entire monitored IT infrastructure.
  • Availing reports ensure SLAs are being met.
  • Customizable Code as it is open-source.
  • Parallelized service checks.
  • Multi-user access to the web interface to allow users to view infrastructure status.
  • Extendable Architecture with the integration of third-party applications.

Install Nagios Server on RHEL 9 / CentOS Stream 9

Set SELinux to permissive mode.

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

Install required packages for Nagios installation.

sudo dnf install -y gcc glibc glibc-common perl httpd php wget gd gd-devel
sudo dnf install -y openssl-devel
sudo dnf groupinstall "Development Tools"
sudo dnf update -y

Create the Nagios user and group and add the Nagios and apache user to the Nagios group.

sudo useradd nagios
sudo groupadd nagcmd
sudo usermod -a -G nagcmd nagios
sudo usermod -a -G nagcmd apache

Download the source and compile it with the following command

cd /tmp
wget -O nagioscore.tar.gz https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.7.tar.gz
tar xzf nagioscore.tar.gz
cd /tmp/nagioscore-nagios-4.4.7/
sudo ./configure
sudo make all

Install binaries, and daemon files and also configure them to start on boot.

sudo make install
sudo make install-daemoninit
sudo systemctl enable httpd.service

Install Command-mode, sample configuration files to start Nagios and Apache configuration files

sudo make install-commandmode
sudo make install-config
sudo make install-webconf

Create a Nagios web user with the username nagiosadmin to log in to Nagios. Provide a password for the account.

$ sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
New password: 
Re-type new password: 
Adding password for user nagiosadmin

Install Nagios Plugins on RHEL 9|CentOS 9

Change to the home directory

cd ~

Install required packages

sudo dnf install -y gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils

Download the source

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

Compile and install the plugins with the following command.

cd /tmp/nagios-plugins-release-2.3.3/
sudo ./configure
sudo make
sudo make install

Verify Nagios installation has no errors.

$ sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.4.7
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2022-04-14
License: GPL

Website: https://www.nagios.org
Reading configuration data...
   Read main config file okay...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
	Checked 8 services.
	Checked 1 hosts.
	Checked 1 host groups.
	Checked 0 service groups.
	Checked 1 contacts.
	Checked 1 contact groups.
	Checked 24 commands.
	Checked 5 time periods.
	Checked 0 host escalations.
	Checked 0 service escalations.
Checking for circular paths...
	Checked 1 hosts
	Checked 0 service dependencies
	Checked 0 host dependencies
	Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check

Start Apache service

sudo systemctl start httpd.service

Start and enable the Nagios Core service

sudo systemctl enable nagios.service
sudo systemctl start nagios.service

Check for the service status.

$ sudo systemctl status nagios.service
 nagios.service - Nagios Core 4.4.7
     Loaded: loaded (/usr/lib/systemd/system/nagios.service; enabled; vendor pr>
     Active: active (running) since Thu 2022-08-25 23:27:43 EAT; 23s ago
       Docs: https://www.nagios.org/documentation
   Main PID: 71807 (nagios)
      Tasks: 6 (limit: 48809)
     Memory: 2.7M
        CPU: 25ms

In the case you run into an error such as the one below;

× nagios.service - Nagios Core 4.4.7
     Loaded: loaded (/usr/lib/systemd/system/nagios.service; enabled; vendor pr>
     Active: failed (Result: exit-code) since Thu 2022-10-27 04:09:13 EDT; 2min>
   Duration: 673ms
       Docs: https://www.nagios.org/documentation
    Process: 279599 ExecStartPre=/usr/local/nagios/bin/nagios -v /usr/local/nag>
    Process: 279600 ExecStart=/usr/local/nagios/bin/nagios -d /usr/local/nagios>
    Process: 279606 ExecStopPost=/bin/rm -f /usr/local/nagios/var/rw/nagios.cmd>
   Main PID: 279601 (code=exited, status=254)
        CPU: 227ms

Oct 27 04:09:10 centos9 nagios[279601]: qh: echo service query handler register>
Oct 27 04:09:10 centos9 nagios[279601]: qh: help for the query handler register>
Oct 27 04:09:10 centos9 nagios[279601]: wproc: Successfully registered manager >
Oct 27 04:09:11 centos9 nagios[279601]: wproc: Registry request: name=Core Work>
Oct 27 04:09:11 centos9 nagios[279601]: wproc: Registry request: name=Core Work>
Oct 27 04:09:11 centos9 nagios[279601]: wproc: Registry request: name=Core Work>
Oct 27 04:09:11 centos9 nagios[279601]: wproc: Registry request: name=Core Work>
Oct 27 04:09:11 centos9 nagios[279601]: Caught SIGSEGV, shutting down...
Oct 27 04:09:11 centos9 systemd[1]: nagios.service: Main process exited, code=e>
Oct 27 04:09:13 centos9 systemd[1]: nagios.service: Failed with result 'exit-co

Just proceed to your terminal, then run the command;

sudo vi /etc/systemd/system/nagios.service

Then proceed to add the following;



ExecStart=/usr/local/nagios/bin/nagios /usr/local/nagios/etc/nagios.cfg

Then proceed to run the following commands;

sudo reboot
sudo systemctl enable /etc/systemd/system/nagios.service
sudo systemctl  start nagios
sudo systemctl status nagios.service

Accessing Nagios Web Interface On RHEL 9|CentOS 9

Now head over to your browser on http://[IP/Hostname]/nagios and test Nagios. You will be prompted with Login credentials. Enter the password you created with the username nagiosadmin.

The Start page appears as below.

Click on Hosts to check the systems being monitored. At the moment it is only monitoring the Host system.

Click on Services to view the services being monitored.

Monitor Remote System with Nagios

You can monitor a remote system with the Nagios Remote Plugin Executor (NRPE) plugin that allows you to monitor applications and services running on remote hosts. It helps Nagios to monitor local resources like CPU, Memory, Disk, Swap, etc. of the remote host

Remote System

Install Nagios on the remote system using the Installation Process above.

Enable the EPEL repository on the system to install the NRPE plugin.

Install NRPE and Nagios plugins with the following command.

sudo dnf install -y nrpe nagios-plugins-all

Edit the configuration file to accept connection from the Server.

$ sudo vi /etc/nagios/nrpe.cfg


Also configure Nagios checks with basic commands to check attributes like CPU, Users, root usage, etc.

command[check_users]=/usr/lib64/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_root]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /
command[check_swap]=/usr/lib64/nagios/plugins/check_swap -w 20% -c 10%
command[check_total_procs]=/usr/lib64/nagios/plugins/check_procs -w 150 -c 200

Save and exit the file

Configure the Firewall to allow NRPE service.

sudo firewall-cmd --permanent --add-port=5666/tcp
sudo firewall-cmd --reload

Start and enable the NRPE service.

sudo systemctl start nrpe
sudo systemctl enable nrpe

Host System

Enable the EPEL repository to install the NRPE plugin

Install the NRPE plugin with the following command.

sudo dnf -y install nagios-plugins-nrpe

Create a configuration directory for the configuration files.

sudo mkdir /usr/local/nagios/etc/servers

Edit the Server configuration file to include all .cfg files

sudo vi /usr/local/nagios/etc/nagios.cfg

You can uncomment the following line or just add it to enable the directory


Save and exit the file.

Configure Nagios Server to Monitor the remote client. Create a command definition file

sudo vi /usr/local/nagios/etc/objects/commands.cfg

Add the following definition to use the NRPE-check plugin

# .check_nrpe. command definition
define command{
command_name check_nrpe
command_line /usr/lib64/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$

Save and exit the file

Add the remote system to the Nagios server by creating a configuration file with service definitions

sudo vi /usr/local/nagios/etc/servers/client.technixleo.com.cfg

Use the following template and modify it to your requirements including the client hostname and IP address.

define host{
            use                     linux-server
            host_name               client.technixleo.com
            alias                   client.technixleo.com
define hostgroup{
            hostgroup_name          linux-server
            alias                   Linux Servers
            members                 client.technixleo.com
define service{
            use                     local-service
            host_name               client.technixleo.com
            service_description     SWAP Uasge
            check_command           check_nrpe!check_swap                         
define service{
            use                     local-service
            host_name               client.technixleo.com
            service_description     Root / Partition
            check_command           check_nrpe!check_root                         
define service{
            use                     local-service
            host_name               client.technixleo.com
            service_description     Current Users
            check_command           check_nrpe!check_users                        
define service{
            use                     local-service
            host_name               client.technixleo.com
            service_description     Total Processes
            check_command           check_nrpe!check_total_procs                  
define service{
            use                     local-service
            host_name               client.technixleo.com
            service_description     Current Load
            check_command           check_nrpe!check_load

Save and Exit the file

Verify the Nagios configuration file for any errors.

sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Restart the Nagios service.

sudo systemctl restart nagios.service

Test Remote System Monitoring

On your Nagios Webb Interface, Under Hosts, check to view the added remote host.

Under Services, Check to see the services being monitored.


Nagios Monitoring Solution provides complete monitoring of systems including operating system metrics, service state, network state, process state, file system usage, and more. It has a web interface for viewing current network status, notification and problem history, log files, etc. It watches hosts and services that you specify to be monitored and alert you when things go wrong and also when the issue is fixed.

Other Posts;


Please enter your comment!
Please enter your name here