Monitoring a RAID or other hardware device

In this recipe, we'll learn a general strategy for monitoring the properties of hardware devices. Because of the different ways that vendors implement their hardware, this tends to be less straightforward than monitoring standard network services.

There are at least four general approaches to this problem.

Getting ready

You will need to know some specifics about the hardware that you want to monitor, including the model number. You should preferably also have a Nagios Core 4.0 server that was compiled with Net-SNMP libraries available to build the check_snmp plugin.

How to do it...

We can find a way to monitor an arbitrary hardware device on a local or remote machine as follows:

  1. Check if the official or unofficial Nagios Core plugins already exist for polling the particular device. The best place to start is with Nagios Exchange at https://exchange.nagios.org/; just search for the make of the hardware and see if a plugin already exists, as per the Finding a plugin recipe in Chapter 2, Working with Commands and Plugins. You can then install it with Installing a plugin recipe in the same chapter.
  2. Check if any of the values you need from the hardware are or can be exported as SNMP OIDs, to be checked with the recipe Monitoring the output of an SNMP query in this chapter.
  3. If they aren't, but there's a command line diagnostic tool, the output or return value of which can be used as the check, you could consider exporting it as a custom OID in an SNMP server with the Creating a new SNMP OID to monitor recipe in this chapter.
  4. Finally, we may have to resort to writing our own plugin. This is not actually as difficult as it may seem; it is discussed in the recipe Writing a new plugin from scratch in Chapter 2, Working with Commands and Plugins. This may be the only option for custom or very uncommon hardware.

How it works...

If we find an appropriate plugin for the hardware online, the main snag here is that we will need to be sure not only that the plugin works by testing it against the hardware in both an OK and a CRITICAL state (which might be hard to do), but we also need to make sure the plugin is safe to run. The plugins on Nagios Exchange are reviewed before they are added, but the code for plugins that you find on any other website might not be safe to run.

Using SNMP for these kinds of checks where possible has two advantages in that the values can be checked using a standard Nagios plugin, check_snmp, and the values can also be read over the network, meaning that we may not need to rely on remote execution daemons like NRPE or NSclient++ to get this information.

See also

  • The Monitoring the output of an SNMP query recipe in this chapter
  • The Creating a new SNMP OID to monitor recipe in this chapter
  • Finding a plugin, Chapter 2, Working with Commands and Plugins
  • Installing a plugin, Chapter 2, Working with Commands and Plugins
  • Writing a new plugin from scratch, Chapter 2, Working with Commands and Plugins
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.203.96