RAID Controllers

Linux Software Raid Plugin for 32-bit and 64-bit systems

Description:

Checks Linux Software Raid (also known as MD Raid). Works on both 32-bit and 64-bit systems

Current Version

Last Release Date

June 12, 2009

Compatible With


Project Files
Project Notes
Usage Run the plugin is as follows: ./check_md_raid RAID OK: All arrays OK [1 array checked] It requires the mdadm utility which is what you also used to create the raid array. If it is not in the standard location of /sbin/mdadm then just do the following ln -s /path/to/mdadm /sbin/mdadm and then run the plugin again. This runs straight on both 32-bit and 64-bit systems and all modern linux distros that have Python. This has been tested and all works nicely for me on servers of both architectures and across distros. The plugin must be run as root in order to test the state of all the arrays. Use sudo to grant the nagios or nrpe user the rights to run it using sudo without a password like so: visudo add the following line: nagios (ALL)=ALL NOPASSWD:/path/to/check_md_raid Rewritten to work with python 2.3 as well (no longer uses subprocess for those of you on debian...) Support If you have any issues, contact me at hpsekhon(AT)googlemail.com
Reviews (11) Add a Review
Does not work for me
by jurim, June 30, 2014

RAID CRITICAL: 1 array not ok - Array 0 is in state "clean " (raid1) [1 array checked] To chomp spaces, if state = "clean " or "active " if "State :" in line: state = line.split(":")[-1][1:-1] state = state[:-1]



Installation
by afernandez, October 31, 2013

Can anyone explain to me how exactly step by step i installed this in nagiosxi



Problem with LVM2?
by Pracz, August 31, 2013

Hello, it seem's like there is some wrong output with your plugin: root@h7 ~ # /usr/lib/nagios/plugins/check_md_raid RAID CRITICAL: 5 arrays not ok - Array 0 is in state "clean " (raid1), Array 1 is in state "clean " (raid1), Array 2 is in state "clean " (raid1), Array 3 is in state "clean " (raid1), Array 4 is in state "active " (raid1) [5 arrays checked] All arrays are ok but the plugin is saying they are not. Is this maybe some problem with LVM2?



Works with patch
by nickatnite, October 31, 2012

This is the patch I used to get it to properly read active and clean states. --- check_md_raid.orig +++ check_md_raid @@ -110,7 +110,7 @@ def test_raid(verbosity): if "State :" in line: state = line.split(":")[-1][1:-1] re_clean = re.compile('^clean(, no-errors)?$') - if not re_clean.match(state) and state != "active": + if not re_clean.match(state) and state != "active" and state != "active " and state != "clean" and state != "clean ": arrays_not_ok += 1 raidlevel = detailed_output[3].split()[-1] shortname = array.split("/")[-1].upper()



Excellent plugin
by bmalynovytch, August 31, 2012

This plugin works as expected. Great job. You'll find above a small patch of a modification I did to ignore "active, checking" states being identified as critical. Every weeks all my servers using MD are being checked at night, which triggers tons of unwanted notifications about "raid recovery". The patch also include a workaround to a wrong information (recovering) provided by mdadm with raid10 while in check state. Regards, Benjamin --- check_md_raid 2012-08-02 12:31:25.900899840 +0200 +++ check_md_raid.new 2012-08-02 14:08:01.873932844 +0200 @@ -35,6 +35,9 @@ # Full path to the mdadm utility check on the Raid state BIN = "/sbin/mdadm" +SYNCACTION = "/sys/block/%s/md/sync_action" +READLINK = "/bin/readlink" +CAT = "/bin/cat" def end(status, message): """exits the plugin with first arg as the return code and the second @@ -119,7 +122,13 @@ # This happens when the array is under heavy usage but it's # normal and the array recovers within seconds continue - elif "recovering" in state: + elif "recovering" in state or "check" in state: + real_array_path = os.popen("%s -f %s " % (READLINK, array) ).readlines()[0].split()[0] + real_array_id = real_array_path.split("/")[-1] + real_state = os.popen( ( "%s " + SYNCACTION ) % (CAT,real_array_id) ).readlines()[0].split()[0] + if "check" in real_state: + message += 'Array "%s" is in state "checking", ' % shortname + continue extra_info = None for line in detailed_output: if "Rebuild Status" in line: @@ -141,8 +150,8 @@ message += 'Array %s is in state "%s" (%s), ' % (shortname, state, raidlevel) status = CRITICAL - - message = message.rstrip(", ") + if not status == OK and message: + message = message.rstrip(", ") if status == OK: message += "All arrays OK"



a patch for centos 6
by minitux, February 29, 2012

line 111 : state = line.split(":")[-1][1:-1] just add after this line : state = state.strip() and it works very fine now :-)



Simple and Effective
by TrevThorpe, November 30, 2011

Very easy to get running. Using on Ubuntu server 10.10 client side, and Ubuntu server 10.4 Nagios3 server. Simple and effective, as the subject states. 10 minutes from download to active monitoring, provided you already have nrpe running of course. Thanks! -- Trev Thorpe



Works great...
by Blinkyn, February 28, 2011

...but, wanted to point out a couple of things I found while adding this plugin to my Nagios installation: - Should use /usr/bin/sudo and not just sudo in your commands.cfg file. - If while installing and testing this plugin, Nagios returns a warning for this service and "(null)" for a Status, then comment out "Defaults requiretty" in your /etc/sudoers. I spent a lot of time trying to get the plugin working, searching the web, debugging, etc. and finally found out it was just a setting in my sudoers file (I'm on FC12). - FYI, I emailed the plugin support address and got no response. So, don't know if this plugin is supported anymore. Hope this information is useful for others.



Great plugin
by Bhawks_2, September 30, 2010

Great plugin, does exactly what is needed. Would have given it maximum stars if you had added that you need to run the command with sudo /path/to/check_md_raid (took me 10 minutes to find out ;-) ) Great plugin though



Effective
by momocello, September 30, 2010

A few array rebuilding later, this plugin works perfectly. Thanks!



A nice simple plugin that works fine
by evlist, February 28, 2010

It is also well documented and can easily be used as a basis to write other plugins. Thanks for this work! Eric



Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
4.5 (19)
Favorites
4
Views
120,938