In this recipe, we'll follow a procedure to find a plugin appropriate to a specific monitoring task. We'll start by checking whether an existing plugin is already available to do just what we need. If we can't find one, we'll check whether we can use another more generic plugin to solve the problem. If we still find that nothing suits, we'll visit Nagios Exchange and search for an appropriate plugin.
You should have a Nagios Core 4.0 or newer server running with a few hosts and services that are configured already, and you'll need to have a particular service on one of these hosts, which you're not yet sure you need to monitor.
We'll use a simple problem as an example; we have a server named troy.example.net
that runs an rsync(1)
process that listens on port 873
. We're already monitoring the host's network connectivity via PING, but we'd like to have Nagios Core check whether the rsync(1)
server is available and listening at all times, in case it crashes while running or doesn't start up when the system is rebooted.
We can find a new plugin appropriate to any monitoring task as follows:
/usr/local/nagios/libexec
on our Nagios Core server and getting a directory listing:# cd /usr/local/nagios/libexec # ls check_apt check_ide_smart check_nntp check_simap check_breeze check_ifoperstatus check_nntps check_smtp check_by_ssh check_ifstatus check_nt check_spop check_cluster check_imap check_ntp_time check_tcp ...
There's a long list of plugins there, but none of them look like check_rsync
or even check_backup
, so it doesn't quite seem like there's a plugin in the core to do exactly what we need.
check_tcp
. A web search for its name pulls up its manual page on the Nagios Plugins website as the first result and a description of what it does:"This plugin tests TCP connections with the specified host (or Unix socket)."
We need to do more than just check the port, so this doesn't quite suit us either.
check_rsync
, which would be an appropriate name for the plugin, turns up a page on the Nagios Exchange website with a plugin named exactly that. We've found an appropriate plugin.If all we needed to do was verify that rsync(1)
was listening on port 873
, and we didn't really need to monitor any of its actual function, the check_tcp
plugin might actually suffice. However, in our case, perhaps we might need to find a way to not only verify that a port is open, but also check whether a specific rsync(1)
module is available.
After reading the description of check_rsync
, it looks like the plugin has the exact functionality we need, checking that a certain rsync(1)
module is available on the server. At this point, we could download the plugin and follow its installation instructions.
This recipe is intended to highlight that, in addition to having a capable set of plugins as part of the Nagios Core Plugins set, the documentation available online on the Nagios Core Plugins website at https://nagios-plugins.org/ and the other plugins available on Nagios Exchange at https://exchange.nagios.org/ make it relatively straightforward to find an appropriate plugin for the particular monitoring problem we need to solve.
Note that when we download third-party plugins, it's important to verify that we trust the plugin to do what we need it to. Nagios Exchange is a moderated community, but the plugins are provided at our own risk; if we don't understand what a plugin does, we should be wary of installing it or using it on our system without reading its documentation and possibly its reviews.
3.144.205.223