Install Nagios Plugins on CentOS 8

|
Last Updated:
|
|

This guide will walk you through how to install Nagios Plugins on CentOS 8. Nagios plugins are standalone extensions to Nagios Core that enables Nagios to monitor databases, operating systems, services, applications, network equipment, protocols etc.

To use Nagios Plugins, you need to have installed and Setup Nagios Core server. Follow the link below to install Nagios server on CentOS 8.

Install Nagios Server on CentOS 8

Installing Nagios Plugins on CentOS 8

Once you have setup the Nagios Core server, proceed to install the Nagios plugins.

Well, there are two ways in which you can install Nagios Plugins.

  1. Building Nagios Plugins from the source
  2. Installing Nagios Plugins from EPEL Repos (Probably the easiest)

We will cover the two installation methods.

Building Nagios Plugins from the Source on CentOS 8

Install Required Build Tools and Dependencies

Nagios plugins are build from the source code. Hence, you need to install required build tools and dependencies.

Some of the packages below might have been installed if you followed the Nagios guide above.

dnf install gcc glibc glibc-common make gettext automake autoconf wget openssl-devel

Download Nagios Plugins Source Code

Next, download Nagios plugins source code.

wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz

You can check for any latest Nagios plugins on Nagios Plugins page.

Extract Nagios Plugins

Once downloaded, extract it by running the command below

tar xzf nagios-plugins-2.2.1.tar.gz

Configure Nagios Plugins

Navigate to Nagios plugins source directory and run the configure script to adapt the plugins to the system and check for any missing dependency.

cd nagios-plugins-2.2.1
./configure --with-nagios-user=nagios --with-nagios-group=nagios

Compile Nagios Plugins on CentOS 8

If there is no configuration error, proceed to compile Nagios.

Ensure that user nagios is already created before you can proceed. You might need to install NRPE agent first.

getent passwd nagios
nagios:x:974:974::/var/spool/nagios:/sbin/nologin

The compile Nagios plugins.

make

Install Nagios Plugins

You can now run the command below to install Nagios Plugins.

make install

This will install default Nagios plugins under the /usr/local/nagios/libexec/ directory.

ls /usr/local/nagios/libexec/
check_apt      check_disk      check_hpjd          check_ircd      check_nagios    check_nwstat  check_rpc      check_ssmtp   check_users
check_breeze   check_disk_smb  check_http          check_jabber    check_nntp      check_oracle  check_sensors  check_swap    check_wave
check_by_ssh   check_dns       check_icmp          check_load      check_nntps     check_overcr  check_simap    check_tcp     negate
check_clamd    check_dummy     check_ide_smart     check_log       check_nt        check_ping    check_smtp     check_time    urlize
check_cluster  check_file_age  check_ifoperstatus  check_mailq     check_ntp       check_pop     check_snmp     check_udp     utils.pm
check_dhcp     check_flexlm    check_ifstatus      check_mrtg      check_ntp_peer  check_procs   check_spop     check_ups     utils.sh
check_dig      check_ftp       check_imap          check_mrtgtraf  check_ntp_time  check_real    check_ssh      check_uptime

Restart Nagios Core service

Now restart Nagios core service.

systemctl restart nagios

After that, login Nagios Server Web interface on the browser to confirm that the localhost services and state are now being monitored.

Check the local host status by clicking on the Hosts under Current Status on the left panel.

Install Nagios Plugins on CentOS 8

Check the status of the localhost services by clicking Services under Current Status on the left panel.

Nagios Plugins Services CentOS 8

There you go. You have successfully installed Nagios Plugins on CentOS 8 for localhost state and and service status monitoring.

Install Nagios Plugins from EPEL Repository

It is also possible to install Nagios plugins from EPEL repository.

Install EPEL repository on CentOS 8

dnf install epel-release

Once the installation is done, you can search for the available Nagios plugins by running the command below;

dnf search nagios-plugins-*
nagios-plugins-nt.x86_64 : Nagios Plugin - check_nt
nagios-plugins-dns.x86_64 : Nagios Plugin - check_dns
nagios-plugins-all.x86_64 : Nagios Plugins - All plugins
nagios-plugins-apt.x86_64 : Nagios Plugin - check_apt
nagios-plugins-dbi.x86_64 : Nagios Plugin - check_dbi
nagios-plugins-dig.x86_64 : Nagios Plugin - check_dig
nagios-plugins-dns.x86_64 : Nagios Plugin - check_dns
nagios-plugins-fts.noarch : Nagios probes to be run remotely against FTS3 machines
nagios-plugins-log.x86_64 : Nagios Plugin - check_log
nagios-plugins-ntp.x86_64 : Nagios Plugin - check_ntp
nagios-plugins-rpc.x86_64 : Nagios Plugin - check_rpc
nagios-plugins-ssh.x86_64 : Nagios Plugin - check_ssh
nagios-plugins-tcp.x86_64 : Nagios Plugin - check_tcp
...

You can also run the command below to list all plugins.

dnf list nagios-plugins-*

You can now install the specific plugins that you require. For example, to install Nagios plugins that checks the load, http, users, processes, disk space, swap space, uptime,dns, run the command below;

dnf install nagios-plugins-{load,http,users,procs,disk,swap,nrpe,uptime,dns}

Plugins that are installed using the package manager as stored under /usr/lib64/nagios/plugins/.

ls -1 /usr/lib64/nagios/plugins/
check_disk
check_dns
check_http
check_load
check_nrpe
check_procs
check_swap
check_uptime
check_users
eventhandlers
negate
urlize
utils.sh

There you go.

In our next guide, we will discuss how to install Nagios Remote Execution Plugins for remote host monitoring.

See Other similar guides by following the link below;

Nagios SNMP Monitoring of Linux Hosts on AlienVault USM/OSSIM

How to Install Nagios Plugins and NRPE agents on CentOS 7/RHEL 7/Fedora 29

Configure Nagios Availability Monitoring on AlienVault USM/OSSIM

How to Install Nagios Plugins From Source RHEL/CentOS/Oracle Linux

SUPPORT US VIA A VIRTUAL CUP OF COFFEE

We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
koromicha
I am the Co-founder of Kifarunix.com, Linux and the whole FOSS enthusiast, Linux System Admin and a Blue Teamer who loves to share technological tips and hacks with others as a way of sharing knowledge as: "In vain have you acquired knowledge if you have not imparted it to others".

Leave a Comment