daily system administration

Linux, Debian and the rest
any questions or comments: Tom@d7031.de

Checking hard- and software raid with icinga2

Upgrading from Nagios or Icinga 1 to  the new and outstanding Icinga 2 is a good moment to review your checks.

Steps to configure raid monitoring with Icinga 2

Download and install

The standard nagios/monitoring plugin package includes one for a long time, but there is a new check for raid’s under linux. You can find it on GitHub. This is a modular plugin. If you want to have one big file including all modules, you can download this from my site.

Configure your servers

After installing the plugin, run it once as root with the -S switch to configure the sudo rights:

/usr/lib/nagios/plugins/check_raid.pl -S

Depending on raid controller, you should get a config like this:

# Lines matching CHECK_RAID added by /usr/lib/nagios/plugins/check_raid.pl -S on Mon Feb 22 15:45:28 2016
User_Alias CHECK_RAID=nagios
Defaults:CHECK_RAID !requiretty
CHECK_RAID ALL=(root) NOPASSWD: /usr/sbin/tw-cli info
CHECK_RAID ALL=(root) NOPASSWD: /usr/sbin/tw-cli info *
CHECK_RAID ALL=(root) NOPASSWD: /usr/sbin/tw-cli show
CHECK_RAID ALL=(root) NOPASSWD: /usr/sbin/tw-cli * show all

A plugin call should now show some useful output. If not, you need some more packages installed depending on your hardware or software raid. The error message is:

check_raid UNKNOWN - No active plugins (No RAID found)

Here some package examples:

apt-get install cciss-vol-status
apt-get install mpt-status
apt-get install tw-cli

Configure Icinga 2 {.p1}

First you have to make a check definition. You can find one on my GitHub repro. The second step is to configure the service check and your host definition as shown below:

apply Service "raid" {
  import "generic-service"
  import "10-min-interval"

  check_command = "raid"
  command_endpoint = host.vars.remote_client

  enable_perfdata = false
  vars.raid_timeout = 60
  assign where host.vars.raid_present

object Host "localhost" {
  import "generic-host"
  vars.raid_present = true

That’s all, congratulations.