IntroductionIn our previews article we walked you through installing nagios core on a Centos 7 system. In this article we will explain how to install Nagios plugins and the Nagios Remote Plugin Executor (NRPE) package.How does Nagios work?Nagios core runs from a central server which holds the configuration files. It runs active checks to monitor the state of services like HTTP and SSH, check if the server is up via ICMP and also monitor resource consumption like in the form of CPU load, memory utilization etc. The core server has a huge library of plugins and much of the functionality and flexibility of Nagios is derived from the use of these plugins.What are Nagios plugins?Plugins are compiled executable or scripts (Perl scripts, shell scripts, etc.) that can be run from a command line to check the status or a host or service. Nagios uses the results from plugins to determine the current status of hosts and services on your network. Nagios will execute a plugin whenever there is a need to check the status of a service or host. The plugin does something to perform the check and then simply returns the results to Nagios. It will process the results that it receives from the plugin and take any necessary actions.Installing Nagios pluginsThe plugins which provide the most commonly needed and used monitoring checks are available as a tarball which we will download and install. At the time of this writing, the latest version is Nagios Plugins 2.1.1.[ssuri@linuxnix:~] $ curl -L -O http://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 –:–:– –:–:– –:–:– 0
0 2664k 0 1213 0 0 1330 0 0:34:11 –:–:– 0:34:11 1331
36 2664k 36 975k 0 0 537k 0 0:00:04 0:00:01 0:00:03 537k
100 2664k 100 2664k 0 0 1071k 0 0:00:02 0:00:02 –:–:– 1072k
[ssuri@linuxnix:~] $ tar xvf nagios-plugins-2.2.1.tar.gz
nagios-plugins-2.2.1/
nagios-plugins-2.2.1/perlmods/
nagios-plugins-2.2.1/perlmods/Config-Tiny-2.14.tar.gz
nagios-plugins-2.2.1/perlmods/parent-0.226.tar.gz
nagios-plugins-2.2.1/perlmods/Test-Simple-0.98.tar.gz
nagios-plugins-2.2.1/perlmods/Makefile.in
nagios-plugins-2.2.1/perlmods/version-0.9903.tar.gz
nagios-plugins-2.2.1/perlmods/Makefile.am
—————————————–output truncated for brevity
[ssuri@linuxnix:~] $ cd nagios-plugins-2.2.1
[ssuri@linuxnix:~/nagios-plugins-2.2.1] $ ls
ABOUT-NLS AUTHORS config.h.in configure.ac INSTALL Makefile.am nagios-plugins.spec.in perlmods plugins-scripts REQUIREMENTS THANKS
acinclude.m4 build-aux config.rpath COPYING LEGAL Makefile.in NEWS pkg po SUPPORT tools
ACKNOWLEDGEMENTS ChangeLog config_test FAQ lib mkinstalldirs NPTest.pm plugins README tap
aclocal.m4 CODING configure gl m4 nagios-plugins.spec NP-VERSION-GEN plugins-root release test.pl.inNow we will configure the plugins using the configure script provided with the tarball.[ssuri@linuxnix:~/nagios-plugins-2.2.1] $ ./configure –with-nagios-user=nagios –with-nagios-group=nagios –with-openssl
[ssuri@linuxnix:~/nagios-plugins-2.2.1] $ sudo
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for a thread-safe mkdir -p… /usr/bin/mkdir -p
checking for gawk… gawk
checking whether make sets $(MAKE)… yes
checking whether to disable maintainer-specific portions of Makefiles… yes
checking build system type… x86_64-unknown-linux-gnu
checking host system type… x86_64-unknown-linux-gnu
checking for gcc… gcc
checking for C compiler default output file name… a.out
checking whether the C compiler works… yes
checking whether we are cross compiling… no
checking for suffix of executables…
—————————————–output truncated for brevityNow compile Nagios Plugins with this command:[ssuri@linuxnix:~/nagios-plugins-2.2.1] $ makeThen install it with the ‘make install’ command.[ssuri@linuxnix:~/nagios-plugins-2.2.1] $ sudo make installInstalling NRPENRPE allows you to remotely execute Nagios plugins on other Linux/Unix machines. This allows you to monitor remote machine metrics (disk usage, CPU load, etc.). We talk about NRPE in depth in another article. For now we will explain how to install it on our Centos 7 system. We will download the NRPE source code using curl and then configure, compile and install it from source as we’ve done with Nagios core and Nagios plugins earlier.[ssuri@linuxnix:~] $ curl -L -O http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 –:–:– –:–:– –:–:– 0
100 349 100 349 0 0 1376 0 –:–:– –:–:– –:–:– 1384
[2018-10-09 12:34:08]
0 0 0 0 0 0 0 0 –:–:– –:–:– –:–:– 0
100 409k 100 409k 0 0 395k 0 0:00:01 0:00:01 –:–:– 714k
[ssuri@linuxnix:~] $ tar xvf nrpe-*.tar.gz
nrpe-2.15/
nrpe-2.15/Changelog
nrpe-2.15/LEGAL
nrpe-2.15/Makefile.in
nrpe-2.15/README
nrpe-2.15/README.SSL
nrpe-2.15/README.Solaris
nrpe-2.15/SECURITY
—————————————–output truncated for brevity[ssuri@linuxnix:~/nrpe-2.15] $./configure –enable-command-args –with-nagios-user=nagios –with-nagios-group=nagios –with-ssl=/usr/bin/openssl –with-ssl-lib=/usr/lib/x86_64-linux-gnu
checking for a BSD-compatible install… /usr/bin/install -c
checking build system type… x86_64-unknown-linux-gnu
checking host system type… x86_64-unknown-linux-gnu
checking for gcc… gcc
checking for C compiler default output file name… a.out
checking whether the C compiler works… yes
checking whether we are cross compiling… no
checking for suffix of executables…
checking for suffix of object files… o
checking whether we are using the GNU C compiler… yes
checking whether gcc accepts -g… yes
checking for gcc option to accept ANSI C… none needed
checking whether make sets $(MAKE)… yes
checking how to run the C preprocessor… gcc -E
checking for egrep… grep -E
checking for ANSI C header files… yes
checking whether time.h and sys/time.h may both be included… yes
checking for sys/wait.h that is POSIX.1 compatible… yes
checking for sys/types.h… yes
—————————————–output truncated for brevityNow build and install NRPE and its xinetd startup script with these commands:[ssuri@linuxnix:~/nrpe-2.15] $ make all
[ssuri@linuxnix:~/nrpe-2.15] $ sudo make install
[ssuri@linuxnix:~/nrpe-2.15] $ sudo make install-xinetd
[ssuri@linuxnix:~/nrpe-2.15] $ sudo make install-daemon-configEdit the /etc/xinetd.d/nrpe file using vi or any other editor of your choice and add the IP address of the Nagios core server in the only_from directive.[ssuri@linuxnix:~] $ cat /etc/xinetd.d/nrpe
# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
flags = REUSE
socket_type = stream
port = 5666
wait = no
user = nagios
group = nagios
server = /usr/local/nagios/bin/nrpe
server_args = -c /usr/local/nagios/etc/nrpe.cfg –inetd
log_on_failure += USERID
disable = no
only_from = 127.0.0.1 192.168.87.134
}
[ssuri@linuxnix:~] $This will allow Nagios core to communicate with NRPE.Restart the xinetd service to start NRPE:[ssuri@linuxnix:~] $ sudo service xinetd restart ConclusionWith this we’ve complete the second and third steps involved in getting our Nagios core installation up and running. In the next article we will go through the final phase towards completing our setup and that is the Nagios core configuration. Post Views: 2,380The following two tabs change content below.He started his career in IT in 2011 as a system administrator. He has since worked with HP-UX, Solaris and Linux operating systems along with exposure to high availability and virtualization solutions. He has a keen interest in shell, Python and Perl scripting and is learning the ropes on AWS cloud, DevOps tools, and methodologies. He enjoys sharing the knowledge he’s gained over the years with the rest of the community.