Nagios Core Administrators Cookbook
上QQ阅读APP看书,第一时间看更新

Finding a plugin

In this recipe, we'll follow a good procedure for finding a plugin appropriate to a specific monitoring task. We'll start by checking to see if an existing plugin is already available to do just what we need. If we can't find one, we'll check to see if 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 there.

Getting ready

You should have a Nagios Core 3.0 or newer server running with a few hosts and services configured already, and you'll need to have a particular service on one of those hosts, which you're not sure how to monitor.

We'll use a simple problem as an example; we have a server named troy.naginet that runs an rsync 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 server is available and listening at all times, in case it crashes while running or doesn't start up when the system is rebooted.

How to do it...

We can find a new plugin appropriate to any monitoring task as follows:

  1. Firstly, since we have the Nagios Core Plugins set installed, we'll check to see if any of the plugins available in it apply directly to our problem. We'll start by visiting /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
    ...
    

    There's a long list of plugins there, but none of them look like check_rsync or check_backup, so it doesn't quite seem like there's a plugin in the core to do exactly what we need.

  2. However, there is a plugin called 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.

  3. A web search for 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 now:
    How to do it...

How it works...

If all we needed to do was check that rsync was listening on port 873, and we didn't really need to monitor any of its actual function, then the check_tcp plugin might actually suffice. However, in our case, we might need to find a way to not only check that a port is open, but also check that a specific directory or rsync module is accessible.

Reading the description for check_rsync, it looks like it has the exact functionality we need, checking that a certain rsync module is available on the server. At this point, we could download the plugin and follow its installation instructions.

There's more...

This recipe is intended to highlight that in addition to having a capable set of plugins as a part of the Nagios Core Plugins set, the documentation available online on the Nagios Core Plugins website at http://nagiosplugins.org/ and the other plugins available on Nagios Exchange at http://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 check that we trust the plugin to do what we need it to. Nagios Exchange is a moderated community with a coding standard, 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 without reading its code, its documentation, and its reviews.

See also

  • The Installing a plugin, Removing a plugin, and Writing a new plugin from scratch recipes in this chapter