官术网_书友最值得收藏!

Finding a plugin

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.

Getting ready

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.

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 whether any of the plugins available in it can be applied directly to our problem. We'll start by navigating to /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.

  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.

How it works...

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.

There's more...

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.

See also

  • The Installing a plugin section in this chapter
  • The Removing a plugin section in this chapter
  • The Writing a new plugin from scratch section in this chapter
主站蜘蛛池模板: 太湖县| 遂宁市| 云霄县| 鸡泽县| 米林县| 临邑县| 通江县| 宁明县| 滦平县| 蛟河市| 尼勒克县| 昌图县| 云和县| 威远县| 汝南县| 土默特左旗| 化德县| 廉江市| 逊克县| 平罗县| 大连市| 玉树县| 霞浦县| 库尔勒市| 宜昌市| 抚顺县| 丽江市| 鸡泽县| 武清区| 上饶市| 芦山县| 酒泉市| 永登县| 环江| 武川县| 池州市| 开封市| 揭阳市| 株洲市| 宾阳县| 通州市|