In this post, I will show you how to install the Nagios Plugins on Debian 10.
Nagios is perhaps the most complete solution for network and equipment monitoring on Linux. It has everything you need to do the job properly. However, once it is installed it lacks the plugins that give the application real utility.
With these plugins, you will be able to monitor many events in the server as well as in the rest of the computers in the network.
So let’s go for it.
1) Install Nagios on Debian 10
Obviously, the first step is to install Nagios on Debian 10. In addition, some packages have to be installed for the compilation of other packages.
So you can read our post about Nagios on Debian 10.
How to install Nagios on Debian 10?
Then, after the installation, we can continue.
2) Installing the Nagios plugins on Debian 10
Now we have to download the source code. To do this we will use the wget command.
Navigate to the /tmp/ folder and from there download the file.
:~$ cd /tmp/ :~$ wget -c https://nagios-plugins.org/download/nagios-plugins-2.3.1.tar.gz --2020-01-31 07:25:23-- https://nagios-plugins.org/download/nagios-plugins-2.3.1.tar.gz Resolving nagios-plugins.org (nagios-plugins.org)... 72.14.186.43 Connecting to nagios-plugins.org (nagios-plugins.org)|72.14.186.43|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 2833267 (2.7M) [application/x-gzip] Saving to: 'nagios-plugins-2.3.1.tar.gz' nagios-plugins-2.3.1.tar.gz 100%[=====================================================================================>] 2.70M 714KB/s in 4.9s 2020-01-31 07:25:30 (569 KB/s) - 'nagios-plugins-2.3.1.tar.gz' saved [2833267/2833267]
At the time of writing this post, the latest version of the Nagios plugins is 2.3.1. So to get the latest version, first check what it is and replace the version number.
When the download is complete, decompress the downloaded file.
:~$ tar xzf nagios-plugins-2.3.1.tar.gz
Now navigate to the generated folder and prepare to compile the package.
:~$ ./configure --with-nagios-user=nagios --with-nagios-group=nagios 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
Now use the make command to create the package.
:~$ make
Then, perform the installation with the following command:
:~$ sudo make install ck_ifoperstatus check_mailq check_file_age check_ssl_validity utils.sh utils.pm '/usr/local/nagios/libexec' make[2]: Nothing to be done for 'install-data-am'. make[2]: Leaving directory '/tmp/nagios-plugins-2.3.1/plugins-scripts' make[1]: Leaving directory '/tmp/nagios-plugins-2.3.1/plugins-scripts' Making install in plugins-root make[1]: Entering directory '/tmp/nagios-plugins-2.3.1/plugins-root' make[2]: Entering directory '/tmp/nagios-plugins-2.3.1/plugins-root' /usr/bin/install -c -o nagios -g nagios check_dhcp /usr/local/nagios/libexec/check_dhcp chown root /usr/local/nagios/libexec/check_dhcp chmod ug=rx,u+s /usr/local/nagios/libexec/check_dhcp /usr/bin/install -c -o nagios -g nagios check_icmp /usr/local/nagios/libexec/check_icmp chown root /usr/local/nagios/libexec/check_icmp chmod ug=rx,u+s /usr/local/nagios/libexec/check_icmp make[2]: Nothing to be done for 'install-data-am'. make[2]: Leaving directory '/tmp/nagios-plugins-2.3.1/plugins-root' make[1]: Leaving directory '/tmp/nagios-plugins-2.3.1/plugins-root' Making install in po make[1]: Entering directory '/tmp/nagios-plugins-2.3.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 -o nagios -g nagios -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-2.3.1/po' make[1]: Entering directory '/tmp/nagios-plugins-2.3.1' make[2]: Entering directory '/tmp/nagios-plugins-2.3.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-2.3.1' make[1]: Leaving directory '/tmp/nagios-plugins-2.3.1'
At this point, everything should have gone smoothly. The plugins are installed in the /usr/local/nagios/libexec/ folder so use the ls command to check if they were installed.
:~$ ls /usr/local/nagios/libexec/
As you can see in the image, they were installed correctly.
Now restart the Nagios service to load the plugins.
:~$ sudo systemctl restart nagios
Now let’s see the results.
3) Nagios plugins working
After restarting the Nagios service, open your web browser and log in to Nagios with your username and password.
Now in the Hosts section, you will see the localhost information.
Also the information about the services, then, the plugins were loaded correctly.
And that is it.
Conclusion
This tutorial is an add-on for you to have fully functional Nagios on your Linux server. Now you have learned how to install the plugins of this tool.
Please share this post and join our Telegram channel.
You can maybe found useful my Nagios (enterprise ready) plugins for Linux.
https://github.com/madrisan/nagios-plugins-linux
A package for Debian 10 is also available.