How to install Nagios on CentOS 8

Share on Social Media

In this article, you will learn how to install Nagios on CentOS 8 along with Network Monitoring Software and Plugins. #centlinux #linux #nagios

What is Nagios Core? :

Nagios Core (formerly Nagios) is a free and open source, network monitoring software. Nagios offers monitoring and alerting services for servers, switches, applications and services. Nagios alerts users when things go wrong and alerts them a second time when the problem has been resolved.

Nagios Core is agent-base, therefore, it is mandatory to install the required Nagios Plugins on each node that is required to be monitored.

Nagios Core is written in C programming language and distributed under GNU GPL v2 license. However, a commercial edition of Nagios is also available as Nagios XI and with a lots of Enterprise level features.

A comparison chart of Nagios Core and Nagios XI is available at Nagios Download Page.

Read Also: How to install Nagios on Rocky Linux 9

Nagios Core Features:

Some of the popular features of Nagios Core are:

  • 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

Environment Specification:

We are using a minimal CentOS 8 virtual machine with following specifications.

  • CPU – 3.4 Ghz (2 cores)
  • Memory – 2 GB
  • Storage – 40 GB
  • Operating System – CentOS 8.1
  • Hostname – nagios-01.centlinux.com
  • IP Address – 192.168.116.206 /24

Update Linux Software Packages:

Connect with nagios-01.centlinux.com as root user by using PuTTY.

It is a best practice to update existing software packages on CentOS before installing anything new. Therefore, we are updating the existing software packages in our CentOS 8 server by using dnf command.

# dnf update -y
Last metadata expiration check: 0:01:11 ago on Sun 14 Jun 2020 10:55:10 PM PKT.
Dependencies resolved.
Nothing to do.
Complete!

Our CentOS 8 server is already up-to-date.

Disable SELinux on CentOS 8:

SELinux may cause problems with Nagios Core software. Therefore, it is recommended in the Nagios Core documentation to disable SELinux or put SELinux in permissive mode before installing Nagios network monitoring software.

Disable SELinux on CentOS 8 by using following commands.

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

Install Nagios Prerequisites:

Nagios Core requires some prerequisite software packages. We are installing all of these software packages using a single dnf command as follows.

# dnf install -y gcc glibc glibc-common perl httpd php wget gd gd-devel

Enable Apache service as follows.

# systemctl enable httpd.service
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service â /usr/lib/systemd/system/httpd.service.

Download Nagios Software:

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 command.

# cd /tmp
# wget -O nagioscore.tar.gz https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.6.tar.gz
--2020-06-15 00:04:44--  https://codeload.github.com/NagiosEnterprises/nagioscore/tar.gz/nagios-4.4.6
Resolving codeload.github.com (codeload.github.com)... 140.82.113.9
Connecting to codeload.github.com (codeload.github.com)|140.82.113.9|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: ânagioscore.tar.gzâ

nagioscore.tar.gz     [   <=>        ]  10.81M  1.10MB/s    in 11s

2020-06-15 00:04:55 (1.00 MB/s) - ânagioscore.tar.gzâ saved [11333431]

Extract the downloaded tarball using tar command.

# tar xzf nagioscore.tar.gz

Compile Nagios Source:

Since, we are installing Nagios network monitoring software from source. Therefore, we need to compile the source on our CentOS 8 platform.

Configure the Nagios Core source according to our CentOS 8 environment.

# cd /tmp/nagioscore-nagios-4.4.6
# ./configure
...
config.status: creating include/config.h
config.status: creating lib/snprintf.h
config.status: creating lib/iobroker.h

Creating sample config files in sample-config/ ...


*** Configuration summary for nagios 4.4.6 2020-04-28 ***:

 General Options:
 -------------------------
        Nagios executable:  nagios
        Nagios user/group:  nagios,nagios
       Command user/group:  nagios,nagios
             Event Broker:  yes
        Install ${prefix}:  /usr/local/nagios
    Install ${includedir}:  /usr/local/nagios/include/nagios
                Lock file:  /run/nagios.lock
   Check result directory:  /usr/local/nagios/var/spool/checkresults
           Init directory:  /lib/systemd/system
  Apache conf.d directory:  /etc/httpd/conf.d
             Mail program:  /bin/mail
                  Host OS:  linux-gnu
          IOBroker Method:  epoll

 Web Interface Options:
 ------------------------
                 HTML URL:  http://localhost/nagios/
                  CGI URL:  http://localhost/nagios/cgi-bin/
 Traceroute (used by WAP):


Review the options above for accuracy.  If they look okay,
type 'make all' to compile the main program and CGIs.

Compile Nagios main program and CGIs using following command.

# make all
...
make[1]: Entering directory '/tmp/nagioscore-nagios-4.4.6/module'
gcc -I.. -fPIC -g -O2 -DHAVE_CONFIG_H -o helloworld.o helloworld.c -shared
make[1]: Leaving directory '/tmp/nagioscore-nagios-4.4.6/module'
cd ./worker && make all
make[1]: Entering directory '/tmp/nagioscore-nagios-4.4.6/worker'
cd ./ping && make all
make[2]: Entering directory '/tmp/nagioscore-nagios-4.4.6/worker/ping'
gcc -I.. -I ../../include -I ../.. -g -O2 -DHAVE_CONFIG_H -o worker-ping worker-ping.c -L ../../lib -l nagios
make[2]: Leaving directory '/tmp/nagioscore-nagios-4.4.6/worker/ping'
make[1]: Leaving directory '/tmp/nagioscore-nagios-4.4.6/worker'

*** Compile finished ***

If the main program and CGIs compiled without any errors, you
can continue with testing or installing Nagios as follows (type
'make' without any arguments for a list of all possible options):

  make test
     - This runs the test suite

  make install
     - This installs the main program, CGIs, and HTML files

  make install-init
     - This installs the init script in /lib/systemd/system

  make install-daemoninit
     - This will initialize the init script
       in /lib/systemd/system

  make install-groups-users
     - This adds the users and groups if they do not exist

  make install-commandmode
     - This installs and configures permissions on the
       directory for holding the external command file

  make install-config
     - This installs *SAMPLE* config files in /usr/local/nagios/etc
       You'll have to modify these sample files before you can
       use Nagios.  Read the HTML documentation for more info
       on doing this.  Pay particular attention to the docs on
       object configuration files, as they determine what/how
       things get monitored!

  make install-webconf
     - This installs the Apache config file for the Nagios
       web interface

  make install-exfoliation
     - This installs the Exfoliation theme for the Nagios
       web interface

  make install-classicui
     - This installs the classic theme for the Nagios
       web interface


*** Support Notes *******************************************

If you have questions about configuring or running Nagios,
please make sure that you:

     - Look at the sample config files
     - Read the documentation on the Nagios Library at:
           
Nagios Library
before you post a question to one of the mailing lists. Also make sure to include pertinent information that could help others help you. This might include: - What version of Nagios you are using - What version of the plugins you are using - Relevant snippets from your config files - Relevant error messages from the Nagios log file For more information on obtaining support for Nagios, visit:
Nagios Support Home
************************************************************* Enjoy.

Create Nagios Users/Groups:

Create the required OS users and groups by using the following command.

# make install-groups-users
groupadd -r nagios
useradd -g nagios nagios

Edit apache user and add nagios as secondary group.

# usermod -a -G nagios apache

Install Nagios Core Binaries:

Install the already compiled Nagios Core binaries on our CentOS 8 server.

# make install
cd ./base && make install
make[1]: Entering directory '/tmp/nagioscore-nagios-4.4.6/base'
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/bin
/usr/bin/install -c -s -m 774 -o nagios -g nagios nagios /usr/local/nagios/bin
/usr/bin/install -c -s -m 774 -o nagios -g nagios nagiostats /usr/local/nagios/bin
make[1]: Leaving directory '/tmp/nagioscore-nagios-4.4.6/base'
cd ./cgi && make install
make[1]: Entering directory '/tmp/nagioscore-nagios-4.4.6/cgi'
make install-basic
make[2]: Entering directory '/tmp/nagioscore-nagios-4.4.6/cgi'
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/sbin
for file in *.cgi; do 
        /usr/bin/install -c -s -m 775 -o nagios -g nagios $file /usr/local/nagios/sbin; 
done
make[2]: Leaving directory '/tmp/nagioscore-nagios-4.4.6/cgi'
make[1]: Leaving directory '/tmp/nagioscore-nagios-4.4.6/cgi'
cd ./html && make install
make[1]: Entering directory '/tmp/nagioscore-nagios-4.4.6/html'
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/media
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/stylesheets
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/contexthelp
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/docs
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/docs/images
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/js
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/images
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/images/logos
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/includes
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/ssi
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/angularjs
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/angularjs/angular-1.3.9
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/angularjs/ui-utils-0.2.3
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/bootstrap-3.3.7
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/bootstrap-3.3.7/css
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/d3
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/share/spin
/usr/bin/install -c -m 664 -o nagios -g nagios robots.txt /usr/local/nagios/share
rm -f /usr/local/nagios/share/index.html
rm -f /usr/local/nagios/share/main.html
rm -f /usr/local/nagios/share/side.html
rm -f /usr/local/nagios/share/map.html
rm -f /usr/local/nagios/share/rss-*
rm -rf /usr/local/nagios/share/include/rss
/usr/bin/install -c -m 664 -o nagios -g nagios jsonquery.html /usr/local/nagios/share
/usr/bin/install -c -m 664 -o nagios -g nagios graph-header.html /usr/local/nagios/share
/usr/bin/install -c -m 664 -o nagios -g nagios histogram.html /usr/local/nagios/share
/usr/bin/install -c -m 664 -o nagios -g nagios histogram-form.html /usr/local/nagios/share
/usr/bin/install -c -m 664 -o nagios -g nagios histogram-graph.html /usr/local/nagios/share
/usr/bin/install -c -m 664 -o nagios -g nagios histogram-links.html /usr/local/nagios/share
/usr/bin/install -c -m 664 -o nagios -g nagios infobox.html /usr/local/nagios/share
/usr/bin/install -c -m 664 -o nagios -g nagios map.php /usr/local/nagios/share
/usr/bin/install -c -m 664 -o nagios -g nagios map-directive.html /usr/local/nagios/share
/usr/bin/install -c -m 664 -o nagios -g nagios map-form.html /usr/local/nagios/share
/usr/bin/install -c -m 664 -o nagios -g nagios map-links.html /usr/local/nagios/share
/usr/bin/install -c -m 664 -o nagios -g nagios map-popup.html /usr/local/nagios/share
/usr/bin/install -c -m 664 -o nagios -g nagios trends.html /usr/local/nagios/share
/usr/bin/install -c -m 664 -o nagios -g nagios trends-form.html /usr/local/nagios/share
/usr/bin/install -c -m 664 -o nagios -g nagios trends-graph.html /usr/local/nagios/share
/usr/bin/install -c -m 664 -o nagios -g nagios trends-host-yaxis.html /usr/local/nagios/share
/usr/bin/install -c -m 664 -o nagios -g nagios trends-links.html /usr/local/nagios/share
/usr/bin/install -c -m 664 -o nagios -g nagios trends-service-yaxis.html /usr/local/nagios/share
for file in *.php; 
do /usr/bin/install -c -m 664 -o nagios -g nagios $file /usr/local/nagios/share; done
for file in stylesheets/*.css; 
do /usr/bin/install -c -m 664 -o nagios -g nagios $file /usr/local/nagios/share/stylesheets; done
for file in contexthelp/*.html; 
do /usr/bin/install -c -m 664 -o nagios -g nagios $file /usr/local/nagios/share/contexthelp; done
for file in js/*.js; 
do /usr/bin/install -c -m 664 -o nagios -g nagios $file /usr/local/nagios/share/js; done
for file in images/*.gif; 
do /usr/bin/install -c -m 664 -o nagios -g nagios $file /usr/local/nagios/share/images; done
for file in images/*.jpg; 
do /usr/bin/install -c -m 664 -o nagios -g nagios $file /usr/local/nagios/share/images; done
for file in images/*.png; 
do /usr/bin/install -c -m 664 -o nagios -g nagios $file /usr/local/nagios/share/images; done
for file in images/*.ico; 
do /usr/bin/install -c -m 664 -o nagios -g nagios $file /usr/local/nagios/share/images; done
for file in images/logos/*.*; 
do /usr/bin/install -c -m 664 -o nagios -g nagios $file /usr/local/nagios/share/images/logos; done
for file in includes/*.*; 
do /usr/bin/install -c -m 664 -o nagios -g nagios $file /usr/local/nagios/share/includes; done
/usr/bin/install -c -m 664 -o nagios -g nagios angularjs/angular-1.3.9/angular.min.js  /usr/local/nagios/share/angularjs/angular-1.3.9
/usr/bin/install -c -m 664 -o nagios -g nagios angularjs/angular-1.3.9/angular.min.js.map  /usr/local/nagios/share/angularjs/angular-1.3.9
/usr/bin/install -c -m 664 -o nagios -g nagios angularjs/ui-bootstrap-tpls-0.14.3.min.js  /usr/local/nagios/share/angularjs
/usr/bin/install -c -m 664 -o nagios -g nagios angularjs/ui-utils-0.2.3/ui-utils.js   /usr/local/nagios/share/angularjs/ui-utils-0.2.3
/usr/bin/install -c -m 664 -o nagios -g nagios bootstrap-3.3.7/css/bootstrap.min.css /usr/local/nagios/share/bootstrap-3.3.7/css
/usr/bin/install -c -m 664 -o nagios -g nagios bootstrap-3.3.7/css/bootstrap-theme.min.css /usr/local/nagios/share/bootstrap-3.3.7/css
/usr/bin/install -c -m 664 -o nagios -g nagios d3/d3.min.js /usr/local/nagios/share/d3
/usr/bin/install -c -m 664 -o nagios -g nagios spin/spin.min.js /usr/local/nagios/share/spin
make[1]: Leaving directory '/tmp/nagioscore-nagios-4.4.6/html'
make install-exfoliation
make[1]: Entering directory '/tmp/nagioscore-nagios-4.4.6'

*** Exfoliation theme installed ***
NOTE: Use 'make install-classicui' to revert to classic Nagios theme

make[1]: Leaving directory '/tmp/nagioscore-nagios-4.4.6'
make install-basic
make[1]: Entering directory '/tmp/nagioscore-nagios-4.4.6'
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/libexec
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/var
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/var/archives
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/var/spool/checkresults
chmod g+s /usr/local/nagios/var/spool/checkresults

*** Main program, CGIs and HTML files installed ***

You can continue with installing Nagios as follows (type 'make'
without any arguments for a list of all possible options):

  make install-init
     - This installs the init script in /lib/systemd/system

  make install-commandmode
     - This installs and configures permissions on the
       directory for holding the external command file

  make install-config
     - This installs sample config files in /usr/local/nagios/etc

make[1]: Leaving directory '/tmp/nagioscore-nagios-4.4.6'

Install Nagios Service on CentOS 8:

To configure autostart of Nagios network monitoring software, we need to create a systemd service. The Nagios setup also provides a method to create the required service.

Create the Nagios service by using the following command.

# make install-daemoninit
/usr/bin/install -c -m 755 -d -o root -g root /lib/systemd/system
/usr/bin/install -c -m 755 -o root -g root startup/default-service /lib/systemd/system/nagios.service
Created symlink /etc/systemd/system/multi-user.target.wants/nagios.service â /usr/lib/systemd/system/nagios.service.

*** Init script installed ***

Install Nagios Command Mode:

Use the following command to configure Nagios Core command mode on CentOS 8.

# make install-commandmode
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/var/rw
chmod g+s /usr/local/nagios/var/rw

*** External command directory configured ***

Install Nagios Sample Configuration Files:

Install the Nagios sample configuration file on the CentOS 8 server by using the following command format.

# make install-config
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc
/usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc/objects
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/nagios.cfg /usr/local/nagios/etc/nagios.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/cgi.cfg /usr/local/nagios/etc/cgi.cfg
/usr/bin/install -c -b -m 660 -o nagios -g nagios sample-config/resource.cfg /usr/local/nagios/etc/resource.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/templates.cfg /usr/local/nagios/etc/objects/templates.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/commands.cfg /usr/local/nagios/etc/objects/commands.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/contacts.cfg /usr/local/nagios/etc/objects/contacts.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/timeperiods.cfg /usr/local/nagios/etc/objects/timeperiods.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/localhost.cfg /usr/local/nagios/etc/objects/localhost.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/windows.cfg /usr/local/nagios/etc/objects/windows.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/printer.cfg /usr/local/nagios/etc/objects/printer.cfg
/usr/bin/install -c -b -m 664 -o nagios -g nagios sample-config/template-object/switch.cfg /usr/local/nagios/etc/objects/switch.cfg

*** Config files installed ***

Remember, these are *SAMPLE* config files.  You'll need to read
the documentation for more information on how to actually define
services, hosts, etc. to fit your particular needs.

Install Apache Config files for Nagios:

Install the Apache configuration file to configure the Nagios web interface.

# make install-webconf
/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/httpd/conf.d/nagios.conf
if [ 0 -eq 1 ]; then 
        ln -s /etc/httpd/conf.d/nagios.conf /etc/apache2/sites-enabled/nagios.conf; 
fi

*** Nagios/Apache conf file installed ***

Configure Linux Firewall:

Allow the Apache web service in CentOS 8 firewall.

# cd
# firewall-cmd --permanent --add-service=http
success
# firewall-cmd --reload
success

Create User to Access Nagios Web UI:

Nagios Core does not provide a native authentication method, therefore, we have to use Basic HTTP authentication to create authentication control for the Nagios web interface.

Create an Admin user and add it to htaccess password file.

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

Start Nagios and Apache Services:

Everything has been configured successfully. Now it is time to start and test the Nagios and Apache services.

# systemctl start httpd.service
# systemctl start nagios.service

Install Nagios Plugins on CentOS 8:

To monitor a machine with Nagios network monitoring software, we need to install the relevant plugins/agents on that machine.

Nagios Plugins is a pack of more than 50 plugins that provides the plugins to monitor most common metrics and services on a machine.

We are installing the Nagios Plugins prerequisite software packages as follows.

# yum install -y gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils epel-release

Some of the prerequisites are not available in standard yum repositories, therefore, we have to enable PowerTools and EPEL (Extra Packages for Enterprise Linux) yum repositories, and then we are able to install these prerequisite packages.

# yum --enablerepo=PowerTools,epel install perl-Net-SNMP -y

Download Nagios Plugins from GitHub.

# 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
--2020-06-15 00:31:14--  https://codeload.github.com/nagios-plugins/nagios-plugins/tar.gz/release-2.2.1
Resolving codeload.github.com (codeload.github.com)... 140.82.112.9
Connecting to codeload.github.com (codeload.github.com)|140.82.112.9|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: ânagios-plugins.tar.gzâ

nagios-plugins.ta     [         <=>  ]   1.95M   205KB/s    in 10s

2020-06-15 00:31:26 (192 KB/s) - ânagios-plugins.tar.gzâ saved [2049050]

Extract the downloaded tarball using tar command.

# tar zxf nagios-plugins.tar.gz

Go to extracted setup directory and build Nagios Plugins from source.

# cd /tmp/nagios-plugins-release-2.2.1/
# ./tools/setup
which: no gnumake in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
Found GNU Make at /usr/bin/gmake ... good.
configure.ac:46: installing 'build-aux/compile'
configure.ac:12: installing 'build-aux/config.guess'
configure.ac:12: installing 'build-aux/config.sub'
configure.ac:9: installing 'build-aux/install-sh'
configure.ac:9: installing 'build-aux/missing'
Makefile.am: installing './INSTALL'
gl/Makefile.am: installing 'build-aux/depcomp'
parallel-tests: installing 'build-aux/test-driver'

Configure the Nagios Plugins setup according to CentOS 8 environment.

# ./configure
...
config.status: executing po-directories commands
config.status: creating po/POTFILES
config.status: creating po/Makefile
            --with-apt-get-command:
              --with-ping6-command: /usr/sbin/ping6 -n -U -W %d -c %d %s
               --with-ping-command: /usr/sbin/ping -n -U -W %d -c %d %s
                       --with-ipv6: yes
                      --with-mysql: no
                    --with-openssl: yes
                     --with-gnutls: no
               --enable-extra-opts: yes
                       --with-perl: /usr/bin/perl
             --enable-perl-modules: no
                     --with-cgiurl: /nagios/cgi-bin
               --with-trusted-path: /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
                   --enable-libtap: no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating gl/Makefile
config.status: creating nagios-plugins.spec
config.status: creating tools/build_perl_modules
config.status: creating Makefile
config.status: creating tap/Makefile
config.status: creating lib/Makefile
config.status: creating plugins/Makefile
config.status: creating lib/tests/Makefile
config.status: creating plugins-root/Makefile
config.status: creating plugins-scripts/Makefile
config.status: creating plugins-scripts/utils.pm
config.status: creating plugins-scripts/utils.sh
config.status: creating perlmods/Makefile
config.status: creating test.pl
config.status: creating pkg/solaris/pkginfo
config.status: creating po/Makefile.in
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing po-directories commands
config.status: creating po/POTFILES
config.status: creating po/Makefile

Compile Nagios Plugins source by using the following command.

# make
...
make[3]: Entering directory '/tmp/nagios-plugins-release-2.2.1/po'
rm -f fr.gmo && /usr/bin/msgfmt -c --statistics -o fr.gmo fr.po
fr.po:10: warning: header field 'Language' missing in header
845 translated messages, 3 fuzzy translations, 398 untranslated messages.
rm -f de.gmo && /usr/bin/msgfmt -c --statistics -o de.gmo de.po
de.po:9: warning: header field 'Language' missing in header
87 translated messages, 163 fuzzy translations, 995 untranslated messages.
make[3]: Leaving directory '/tmp/nagios-plugins-release-2.2.1/po'
touch stamp-po
make[2]: Leaving directory '/tmp/nagios-plugins-release-2.2.1/po'
make[2]: Entering directory '/tmp/nagios-plugins-release-2.2.1'
make[2]: Leaving directory '/tmp/nagios-plugins-release-2.2.1'
make[1]: Leaving directory '/tmp/nagios-plugins-release-2.2.1'

Install Nagios Plugins on our CentOS 8 server.

# make install
...
Making install in po
make[1]: Entering directory '/tmp/nagios-plugins-release-2.2.1/po'
/usr/bin/mkdir -p /usr/local/nagios/share
installing fr.gmo as /usr/local/nagios/share/locale/fr/LC_MESSAGES/nagios-plugins.mo
installing de.gmo as /usr/local/nagios/share/locale/de/LC_MESSAGES/nagios-plugins.mo
if test "nagios-plugins" = "gettext-tools"; then 
  /usr/bin/mkdir -p /usr/local/nagios/share/gettext/po; 
  for file in Makefile.in.in remove-potcdate.sin    Makevars.template; do 
    /usr/bin/install -c  -m 644 ./$file 
                    /usr/local/nagios/share/gettext/po/$file; 
  done; 
  for file in Makevars; do 
    rm -f /usr/local/nagios/share/gettext/po/$file; 
  done; 
else 
  : ; 
fi
make[1]: Leaving directory '/tmp/nagios-plugins-release-2.2.1/po'
make[1]: Entering directory '/tmp/nagios-plugins-release-2.2.1'
make[2]: Entering directory '/tmp/nagios-plugins-release-2.2.1'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/tmp/nagios-plugins-release-2.2.1'
make[1]: Leaving directory '/tmp/nagios-plugins-release-2.2.1'

Restart the Nagios Service to take changes into effect.

# systemctl restart nagios.service

Browse URL http://nagios-01.centlinux.com/nagios in a Google Chrome browser.

Nagios Login

Login by using the NagiosAdmin user.

Nagios Core General Page

We are now at the Dashboard of Nagios Core web interface. Click on Tactical View.

Nagios Tactical Network Overview

Click on Services.

Nagios Current Network Status

Conclusion – Install Nagios on CentOS 8:

In this article, you have learned how to install Nagios on CentOS 8. Before you start to explore Nagios tools, we strongly recommend that you should read Learning Nagios – Third Edition (PAID LINK) by Packt Publishing

Scroll to Top