Install Nagios Core on CentOS 8 - CentLinux


Wednesday, 17 June 2020

Install Nagios Core on CentOS 8

Install Nagios Core on CentOS 8

In this article, you will learn how to install Nagios Network Monitoring Software and Nagios Plugins on CentOS 8.


This Article Provides:


    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.


    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 –
    • IP Address - /24


    Update CentOS 8 Software Packages:

    Connect with 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.

    [root@nagios-01 ~]# 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 the SELinux on CentOS 8 by using following commands.

    [root@nagios-01 ~]# sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config [root@nagios-01 ~]# setenforce 0


    Install Nagios Prerequisites on CentOS 8:

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

    [root@nagios-01 ~]# dnf install -y gcc glibc glibc-common perl httpd php wget gd gd-devel ... Installed: gcc-8.3.1-4.5.el8.x86_64 gd-2.2.5-6.el8.x86_64 gd-devel-2.2.5-6.el8.x86_64 httpd-2.4.37-16.module_el8.1.0+256+ae790463.x86_64 perl-4:5.26.3-416.el8.x86_64 php-7.2.11-2.module_el8.1.0+209+03b9a8ff.x86_64 apr-util-bdb-1.6.1-6.el8.x86_64 apr-util-openssl-1.6.1-6.el8.x86_64 perl-Encode-Locale-1.05-9.el8.noarch perl-IO-Socket-SSL-2.066-3.el8.noarch perl-Mozilla-CA-20160104-7.el8.noarch perl-TermReadKey-2.37-7.el8.x86_64 php-fpm-7.2.11-2.module_el8.1.0+209+03b9a8ff.x86_64 annobin-8.78-1.el8.x86_64 apr-1.6.3-9.el8.x86_64 apr-util-1.6.1-6.el8.x86_64 centos-logos-httpd-80.5-2.el8.noarch cpp-8.3.1-4.5.el8.x86_64 dwz-0.12-9.el8.x86_64 efi-srpm-macros-3-2.el8.noarch ghc-srpm-macros-1.4.2-7.el8.noarch go-srpm-macros-2-16.el8.noarch httpd-filesystem-2.4.37-16.module_el8.1.0+256+ae790463.noarch httpd-tools-2.4.37-16.module_el8.1.0+256+ae790463.x86_64 isl-0.16.1-6.el8.x86_64 jbigkit-libs-2.1-14.el8.x86_64 libICE-1.0.9-15.el8.x86_64 libSM-1.2.3-1.el8.x86_64 libX11-1.6.7-1.el8.x86_64 libX11-common-1.6.7-1.el8.noarch libX11-devel-1.6.7-1.el8.x86_64 libX11-xcb-1.6.7-1.el8.x86_64 libXau-1.0.8-13.el8.x86_64 libXau-devel-1.0.8-13.el8.x86_64 libXext-1.3.3-9.el8.x86_64 libXpm-3.5.12-7.el8.x86_64 libXpm-devel-3.5.12-7.el8.x86_64 libXt-1.1.5-12.el8.x86_64 libjpeg-turbo-1.5.3-10.el8.x86_64 libjpeg-turbo-devel-1.5.3-10.el8.x86_64 libmpc-1.0.2-9.el8.x86_64 libtiff-4.0.9-15.el8.x86_64 libtiff-devel-4.0.9-15.el8.x86_64 libwebp-1.0.0-1.el8.x86_64 libwebp-devel-1.0.0-1.el8.x86_64 libxcb-1.13-5.el8.x86_64 libxcb-devel-1.13-5.el8.x86_64 mod_http2-1.11.3-3.module_el8.1.0+213+acce2796.x86_64 nginx-filesystem-1:1.14.1-9.module_el8.0.0+184+e34fea82.noarch ocaml-srpm-macros-5-4.el8.noarch openblas-srpm-macros-2-2.el8.noarch perl-Algorithm-Diff-1.1903-9.el8.noarch perl-Archive-Tar-2.30-1.el8.noarch perl-Archive-Zip-1.60-3.el8.noarch perl-Attribute-Handlers-0.99-416.el8.noarch perl-B-Debug-1.26-2.el8.noarch perl-CPAN-2.18-397.el8.noarch perl-CPAN-Meta-2.150010-396.el8.noarch perl-CPAN-Meta-Requirements-2.140-396.el8.noarch perl-CPAN-Meta-YAML-0.018-397.el8.noarch perl-Compress-Bzip2-2.26-6.el8.x86_64 perl-Compress-Raw-Bzip2-2.081-1.el8.x86_64 perl-Compress-Raw-Zlib-2.081-1.el8.x86_64 perl-Config-Perl-V-0.30-1.el8.noarch perl-DB_File-1.842-1.el8.x86_64 perl-Data-OptList-0.110-6.el8.noarch perl-Data-Section-0.200007-3.el8.noarch perl-Devel-PPPort-3.36-5.el8.x86_64 perl-Devel-Peek-1.26-416.el8.x86_64 perl-Devel-SelfStubber-1.06-416.el8.noarch perl-Devel-Size-0.81-2.el8.x86_64 perl-Digest-1.17-395.el8.noarch perl-Digest-MD5-2.55-396.el8.x86_64 perl-Digest-SHA-1:6.02-1.el8.x86_64 perl-Encode-devel-4:2.97-3.el8.x86_64 perl-Env-1.04-395.el8.noarch perl-ExtUtils-CBuilder-1:0.280230-2.el8.noarch perl-ExtUtils-Command-1:7.34-1.el8.noarch perl-ExtUtils-Embed-1.34-416.el8.noarch perl-ExtUtils-Install-2.14-4.el8.noarch perl-ExtUtils-MM-Utils-1:7.34-1.el8.noarch perl-ExtUtils-MakeMaker-1:7.34-1.el8.noarch perl-ExtUtils-Manifest-1.70-395.el8.noarch perl-ExtUtils-Miniperl-1.06-416.el8.noarch perl-ExtUtils-ParseXS-1:3.35-2.el8.noarch perl-File-Fetch-0.56-2.el8.noarch perl-File-HomeDir-1.002-4.el8.noarch perl-File-Which-1.22-2.el8.noarch perl-Filter-2:1.58-2.el8.x86_64 perl-Filter-Simple-0.94-2.el8.noarch perl-IO-Compress-2.081-1.el8.noarch perl-IO-Socket-IP-0.39-5.el8.noarch perl-IO-Zlib-1:1.10-416.el8.noarch perl-IPC-Cmd-2:1.02-1.el8.noarch perl-IPC-SysV-2.07-397.el8.x86_64 perl-IPC-System-Simple-1.25-17.el8.noarch perl-JSON-PP-1:2.97.001-3.el8.noarch perl-Locale-Codes-3.57-1.el8.noarch perl-Locale-Maketext-1.28-396.el8.noarch perl-Locale-Maketext-Simple-1:0.21-416.el8.noarch perl-MRO-Compat-0.13-4.el8.noarch perl-Math-BigInt-FastCalc-0.500.600-6.el8.x86_64 perl-Math-BigRat-0.2614-1.el8.noarch perl-Memoize-1.03-416.el8.noarch perl-Module-Build-2:0.42.24-5.el8.noarch perl-Module-CoreList-1:5.20181130-1.el8.noarch perl-Module-CoreList-tools-1:5.20181130-1.el8.noarch perl-Module-Load-1:0.32-395.el8.noarch perl-Module-Load-Conditional-0.68-395.el8.noarch perl-Module-Loaded-1:0.08-416.el8.noarch perl-Module-Metadata-1.000033-395.el8.noarch perl-Net-Ping-2.55-416.el8.noarch perl-Net-SSLeay-1.88-1.el8.x86_64 perl-Package-Generator-1.106-11.el8.noarch perl-Params-Check-1:0.38-395.el8.noarch perl-Params-Util-1.07-22.el8.x86_64 perl-Perl-OSType-1.010-396.el8.noarch perl-PerlIO-via-QuotedPrint-0.08-395.el8.noarch perl-Pod-Checker-4:1.73-395.el8.noarch perl-Pod-Html-1.22.02-416.el8.noarch perl-Pod-Parser-1.63-396.el8.noarch perl-SelfLoader-1.23-416.el8.noarch perl-Software-License-0.103013-2.el8.noarch perl-Sub-Exporter-0.987-15.el8.noarch perl-Sub-Install-0.928-14.el8.noarch perl-Sys-Syslog-0.35-397.el8.x86_64 perl-Test-1.30-416.el8.noarch perl-Test-Harness-1:3.42-1.el8.noarch perl-Test-Simple-1:1.302135-1.el8.noarch perl-Text-Balanced-2.03-395.el8.noarch perl-Text-Diff-1.45-2.el8.noarch perl-Text-Glob-0.11-4.el8.noarch perl-Text-Template-1.51-1.el8.noarch perl-Thread-Queue-3.13-1.el8.noarch perl-Time-HiRes-1.9758-1.el8.x86_64 perl-Time-Piece-1.31-416.el8.x86_64 perl-URI-1.73-3.el8.noarch perl-Unicode-Collate-1.25-2.el8.x86_64 perl-autodie-2.29-396.el8.noarch perl-bignum-0.49-2.el8.noarch perl-devel-4:5.26.3-416.el8.x86_64 perl-encoding-4:2.22-3.el8.x86_64 perl-experimental-0.019-2.el8.noarch perl-inc-latest-2:0.500-9.el8.noarch perl-libnet-3.11-3.el8.noarch perl-libnetcfg-4:5.26.3-416.el8.noarch perl-local-lib-2.000024-2.el8.noarch perl-open-1.11-416.el8.noarch perl-perlfaq-5.20180605-1.el8.noarch perl-srpm-macros-1-25.el8.noarch perl-utils-5.26.3-416.el8.noarch perl-version-6:0.99.24-1.el8.x86_64 php-cli-7.2.11-2.module_el8.1.0+209+03b9a8ff.x86_64 php-common-7.2.11-2.module_el8.1.0+209+03b9a8ff.x86_64 python-srpm-macros-3-37.el8.noarch python3-rpm-macros-3-37.el8.noarch qt5-srpm-macros-5.11.1-2.el8.noarch redhat-rpm-config-120-1.el8.noarch rust-srpm-macros-5-2.el8.noarch systemtap-sdt-devel-4.1-6.el8.x86_64 xorg-x11-proto-devel-2018.4-1.el8.noarch binutils-2.30-58.el8_1.2.x86_64 bzip2-devel-1.0.6-26.el8.x86_64 dejavu-fonts-common-2.35-6.el8.noarch dejavu-sans-fonts-2.35-6.el8.noarch expat-devel-2.2.5-3.el8.x86_64 fontconfig-2.13.1-3.el8.x86_64 fontconfig-devel-2.13.1-3.el8.x86_64 fontpackages-filesystem-1.44-22.el8.noarch freetype-devel-2.9.1-4.el8.x86_64 glibc-devel-2.28-72.el8_1.1.x86_64 glibc-headers-2.28-72.el8_1.1.x86_64 kernel-headers-4.18.0-147.8.1.el8_1.x86_64 libpng-devel-2:1.6.34-5.el8.x86_64 libuuid-devel-2.32.1-17.el8.x86_64 libxcrypt-devel-4.1.1-4.el8.x86_64 mailcap-2.1.48-3.el8.noarch make-1:4.2.1-9.el8.x86_64 perl-Carp-1.42-396.el8.noarch perl-Data-Dumper-2.167-399.el8.x86_64 perl-Encode-4:2.97-3.el8.x86_64 perl-Errno-1.28-416.el8.x86_64 perl-Exporter-5.72-396.el8.noarch perl-File-Path-2.15-2.el8.noarch perl-File-Temp-0.230.600-1.el8.noarch perl-Getopt-Long-1:2.50-4.el8.noarch perl-HTTP-Tiny-0.074-1.el8.noarch perl-IO-1.38-416.el8.x86_64 perl-MIME-Base64-3.15-396.el8.x86_64 perl-Math-BigInt-1:1.9998.11-7.el8.noarch perl-Math-Complex-1.59-416.el8.noarch perl-PathTools-3.74-1.el8.x86_64 perl-Pod-Escapes-1:1.07-395.el8.noarch perl-Pod-Perldoc-3.28-396.el8.noarch perl-Pod-Simple-1:3.35-395.el8.noarch perl-Pod-Usage-4:1.69-395.el8.noarch perl-Scalar-List-Utils-3:1.49-2.el8.x86_64 perl-Socket-4:2.027-3.el8.x86_64 perl-Storable-1:3.11-3.el8.x86_64 perl-Term-ANSIColor-4.06-396.el8.noarch perl-Term-Cap-1.17-395.el8.noarch perl-Text-ParseWords-3.30-395.el8.noarch perl-Text-Tabs+Wrap-2013.0523-395.el8.noarch perl-Time-Local-1:1.280-1.el8.noarch perl-Unicode-Normalize-1.25-396.el8.x86_64 perl-constant-1.33-396.el8.noarch perl-interpreter-4:5.26.3-416.el8.x86_64 perl-libs-4:5.26.3-416.el8.x86_64 perl-macros-4:5.26.3-416.el8.x86_64 perl-parent-1:0.237-1.el8.noarch perl-podlators-4.11-1.el8.noarch perl-threads-1:2.21-2.el8.x86_64 perl-threads-shared-1.58-2.el8.x86_64 python3-pyparsing-2.1.10-7.el8.noarch unzip-6.0-41.el8.x86_64 zip-3.0-23.el8.x86_64 zlib-devel-1.2.11-10.el8.x86_64 Complete!

    Enable Apache service as follows.

    [root@nagios-01 ~]# systemctl enable httpd.service Created symlink /etc/systemd/system/ â /usr/lib/systemd/system/httpd.service.


    Downloading Nagios Core 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.

    [root@nagios-01 ~]# cd /tmp [root@nagios-01 tmp]# wget -O nagioscore.tar.gz --2020-06-15 00:04:42-- Resolving ( Connecting to (||:443... connected. HTTP request sent, awaiting response... 302 Found Location: [following] --2020-06-15 00:04:44-- Resolving ( Connecting to (||: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.

    [root@nagios-01 tmp]# tar xzf nagioscore.tar.gz


    Compile Nagios Source on CentOS 8:

    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.

    [root@nagios-01 tmp]# cd /tmp/nagioscore-nagios-4.4.6 [root@nagios-01 nagioscore-nagios-4.4.6]# ./configure ... config.status: creating subst config.status: creating pkginfo config.status: creating startup/openrc-init config.status: creating startup/default-init config.status: creating startup/default-service config.status: creating startup/upstart-init config.status: creating t/Makefile config.status: creating t-tap/Makefile 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.

    [root@nagios-01 nagioscore-nagios-4.4.6]# 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: 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: ************************************************************* Enjoy.


    Create Nagios Users/Groups on CentOS 8:

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

    [root@nagios-01 nagioscore-nagios-4.4.6]# make install-groups-users groupadd -r nagios useradd -g nagios nagios

    Edit apache user and add nagios as secondary group.

    [root@nagios-01 nagioscore-nagios-4.4.6]# usermod -a -G nagios apache


    Install Nagios Core Binaries on CentOS 8:

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

    [root@nagios-01 nagioscore-nagios-4.4.6]# 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/ /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.

    [root@nagios-01 nagioscore-nagios-4.4.6]# 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/ â /usr/lib/systemd/system/nagios.service. *** Init script installed ***


    Install Nagios Command Mode on CentOS 8:

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

    [root@nagios-01 nagioscore-nagios-4.4.6]# 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 on CentOS 8:

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

    [root@nagios-01 nagioscore-nagios-4.4.6]# 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 fro Nagios:

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

    [root@nagios-01 nagioscore-nagios-4.4.6]# 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 CentOS 8 Firewall for Nagios:

    Allow the Apache web service in CentOS 8 firewall.

    [root@nagios-01 nagioscore-nagios-4.4.6]# cd [root@nagios-01 ~]# firewall-cmd --permanent --add-service=http success [root@nagios-01 ~]# 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.

    [root@nagios-01 ~]# 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.

    [root@nagios-01 ~]# systemctl start httpd.service [root@nagios-01 ~]# 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.

    [root@nagios-01 ~]# yum install -y gcc glibc glibc-common make gettext automake autoconf wget openssl-devel net-snmp net-snmp-utils epel-release ... Installed: autoconf-2.69-27.el8.noarch automake-1.16.1-6.el8.noarch net-snmp-1:5.8-12.el8_1.1.x86_64 net-snmp-utils-1:5.8-12.el8_1.1.x86_64 openssl-devel-1:1.1.1c-2.el8_1.1.x86_64 epel-release-8-8.el8.noarch mariadb-connector-c-3.0.7-1.el8.x86_64 mariadb-connector-c-config-3.0.7-1.el8.noarch net-snmp-agent-libs-1:5.8-12.el8_1.1.x86_64 emacs-filesystem-1:26.1-5.el8.noarch keyutils-libs-devel-1.5.10-6.el8.x86_64 krb5-devel-1.17-9.el8.x86_64 libcom_err-devel-1.44.6-3.el8.x86_64 libkadm5-1.17-9.el8.x86_64 libselinux-devel-2.9-2.1.el8.x86_64 libsepol-devel-2.9-1.el8.x86_64 libverto-devel-0.3.0-5.el8.x86_64 lm_sensors-libs-3.4.0-20.20180522git70f7e08.el8.x86_64 m4-1.4.18-7.el8.x86_64 net-snmp-libs-1:5.8-12.el8_1.1.x86_64 pcre2-devel-10.32-1.el8.x86_64 pcre2-utf16-10.32-1.el8.x86_64 pcre2-utf32-10.32-1.el8.x86_64 Complete!

    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.

    [root@nagios-01 ~]# yum --enablerepo=PowerTools,epel install perl-Net-SNMP -y ... Installed: perl-Net-SNMP-6.0.1-25.el8.1.noarch perl-Digest-HMAC-1.03-17.el8.noarch perl-Socket6-0.28-6.el8.x86_64 perl-Digest-SHA1-2.13-23.el8.x86_64 perl-Crypt-DES-2.07-19.1.el8.x86_64 Complete!

    Download Nagios Plugins from GitHub.

    [root@nagios-01 ~]# cd /tmp [root@nagios-01 tmp]# wget --no-check-certificate -O nagios-plugins.tar.gz --2020-06-15 00:31:12-- Resolving ( Connecting to (||:443... connected. HTTP request sent, awaiting response... 302 Found Location: [following] --2020-06-15 00:31:14-- Resolving ( Connecting to (||: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.

    [root@nagios-01 tmp]# tar zxf nagios-plugins.tar.gz

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

    [root@nagios-01 tmp]# cd /tmp/nagios-plugins-release-2.2.1/ [root@nagios-01 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. installing 'build-aux/compile' installing 'build-aux/config.guess' installing 'build-aux/config.sub' installing 'build-aux/install-sh' installing 'build-aux/missing' installing './INSTALL' gl/ installing 'build-aux/depcomp' parallel-tests: installing 'build-aux/test-driver'

    Configure the Nagios Plugins setup according to CentOS 8 environment.

    [root@nagios-01 nagios-plugins-release-2.2.1]# ./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/ config.status: creating plugins-scripts/ config.status: creating perlmods/Makefile config.status: creating config.status: creating pkg/solaris/pkginfo config.status: creating po/ 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.

    [root@nagios-01 nagios-plugins-release-2.2.1]# make ... make[3]: Entering directory '/tmp/nagios-plugins-release-2.2.1/po' rm -f && /usr/bin/msgfmt -c --statistics -o fr.po fr.po:10: warning: header field 'Language' missing in header 845 translated messages, 3 fuzzy translations, 398 untranslated messages. rm -f && /usr/bin/msgfmt -c --statistics -o 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.

    [root@nagios-01 nagios-plugins-release-2.2.1]# 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 as /usr/local/nagios/share/locale/fr/LC_MESSAGES/ installing as /usr/local/nagios/share/locale/de/LC_MESSAGES/ if test "nagios-plugins" = "gettext-tools"; then \ /usr/bin/mkdir -p /usr/local/nagios/share/gettext/po; \ for file 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.

    [root@nagios-01 ~]# systemctl restart nagios.service

    Browse URL in a Google Chrome browser.


    Login by using the NagiosAdmin user.


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


    Click on Services.


    We have successfully installed our Nagios Core - network monitoring server on CentOS 8.

    Nagios Exchange provides thousands of plugins, frontend, theme and agents for Nagios Core. But before you start to explore Nagios tools, we strongly recommend that you should read Learning Nagios - Third Edition by Packt Publishing

    No comments:

    Post a comment