Checking hard- and software raid with icinga2

By | 2016-04-18

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/ -S

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

# Lines matching CHECK_RAID added by /usr/lib/nagios/plugins/ -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

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.


10 thoughts on “Checking hard- and software raid with icinga2

  1. Tony

    Hey, I’m wondering if this could work with Nagios3.

    I’m using this setup with an Ubuntu VM as my Nagios3 Server with the NRPE plugin and a Fedora machine as the remote host with the NRPE server and Nagios plugins installed. On my Fedora machine, running works fine giving:
    OK: megacli:[Volumes(1): DISK0.0:Optimal,WriteCache:DISABLED; Devices(2): 05,04=Online]

    but on the nagios webpage on my Ubuntu VM the check_raid service’s status shows up as:
    NRPE: Unable to read output
    check_raid UNKNOWN – No active plugins (No RAID found)

    1. Tom Post author

      Hi Tony,

      I’ve no real expirience with Nagios3 but it is just a plugin call.
      There are two possible reasons. First using the wrong user during your tests (root instead of nagios-user) and second the Ubuntu VM calls the plugin on localhost.


      1. Tony

        Hey there Tom,

        Thanks for your suggestions, but it turns out the solution was to disable SELinux on my Fedora machine in order to allow the plugin to be executed remotely.

  2. Steven

    Hy Tom!

    First of all, thanks for this usefull tool.
    For me after I configure icinga2 sad:
    warning/ApplyRule: Apply rule ‘raid’ (in /etc/icinga2/conf.d/services.conf: 116:1-116:20) for type ‘Service’ does not match anywhere!

    Do you have an idea what can I do?


    1. Tom Post author

      Hi Steven,

      many thanks for your comment. You need to define a variable on your host.

      vars.raid_present = true

      I’ve fixed my post.


  3. bryan

    Thanks for this. It all works well except the output is marked as UNKNOWN in icinga rather than OK.

    Plugin Output
    UNKNOWN: hpacucli:​​[Smart Array 5i: Array A(OK)[LUN1:​OK]​, Smart Array 642: ]

    1. Tom Post author

      Hello Bryan

      have you run the plugin as nagios/icinga-user ?



  4. Manfred Schmidt-Voigt

    Hi Tom, it seems to work. But I only get a result from my Masterserver, and not from my client. It seems so that it will not run the service on the remote side. I have configerd it for my client (beneath /etc/icinga2/repository.d/hosts/). What have I missed? All other checks are running on the remoteside except this raid thing.

  5. Manfred Schmidt-Voigt

    Ok, forget it. I have set it up now via “by_ssh” an its running now on both nodes


Leave a Reply

Your email address will not be published. Required fields are marked *

5 + 5 =