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

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
主站蜘蛛池模板: 星座| 衡阳县| 新竹市| 龙山县| 家居| 方山县| 中牟县| 岗巴县| 炎陵县| 龙南县| 江孜县| 吴桥县| 象州县| 北宁市| 临泽县| 忻城县| 长阳| 连江县| 东方市| 故城县| 边坝县| 铜山县| 郴州市| 临夏县| 扬中市| 云浮市| 东乌珠穆沁旗| 灌阳县| 达日县| 峨山| 丹东市| 玉门市| 泸州市| 光泽县| 桂林市| 绥中县| 海口市| 台安县| 兴安县| 灵寿县| 阳朔县|