<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Try this : It is a python script<br>
============================================================<br>
#!/usr/bin/python<br>
<br>
# check_swraid - plugin for nagios to check the status of linux swraid
devices<br>
#<br>
# This program is free software; you can redistribute it and/or modify<br>
# it under the terms of the GNU General Public License as published by<br>
# the Free Software Foundation; either version 2 of the License, or<br>
# (at your option) any later version.<br>
#<br>
# This program is distributed in the hope that it will be useful,<br>
# but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br>
# GNU Library General Public License for more details.<br>
#<br>
# You should have received a copy of the GNU General Public License<br>
# along with this program; if not, write to the Free Software<br>
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.<br>
#<br>
# Copyright 2004 Duke University<br>
# Written by Sean Dilda <a class="moz-txt-link-rfc2396E" href="mailto:sean@duke.edu"><sean@duke.edu></a><br>
<br>
# Version: 0.3<br>
# patched with the rouilj's patch (03.02.2006) by Virer (28.07.2006)<br>
<br>
import os<br>
import sys<br>
import string<br>
<br>
mdstat = '/proc/mdstat'<br>
<br>
mdFile = open(mdstat).readlines()<br>
<br>
# two cases: two starting lines or just one starting line.<br>
# Remove the first and lasts lines as we don't need them<br>
mdFile = mdFile[1:-1]<br>
if (len(mdFile) % 3) != 0:<br>
        mdFile = mdFile[1:]<br>
<br>
<br>
if (len(mdFile) % 3) != 0:<br>
        # must have two starting lines<br>
        print 'Error with mdstat file'<br>
        sys.exit(3)<br>
<br>
if len(mdFile) == 0:<br>
        print 'Error no md devices configured'<br>
        sys.exit(3)<br>
<br>
mdData = []<br>
while len(mdFile) > 0:<br>
    mdData.append((mdFile[0],mdFile[1]))<br>
    mdFile = mdFile[3:]<br>
<br>
overallStatus = 0<br>
errorMsg = ''<br>
devices = ''<br>
for tup in mdData:<br>
    device, colon, status, type, drives = string.split(tup[0], None, 4)<br>
    drives = string.split(drives)<br>
    values = string.split(tup[1])[-2]<br>
    values = values[1:-1]<br>
    normal, current = string.split(values, '/')<br>
    normal = int(normal)<br>
    current = int(current)<br>
<br>
    devices = devices + " " + device<br>
<br>
    # Status of 0 == Ok, 1 == Warning, 2 == Critical<br>
    status = 0<br>
    failed = 0<br>
    degraded = 0<br>
    msg = ''<br>
<br>
    failed = []<br>
    for drive in drives:<br>
        if drive[-3:] == '(F)':<br>
            failed.append(drive[:string.index(drive, '[')])<br>
            status = 1<br>
    failed = ' (' + string.join(failed, ', ') + ').'<br>
<br>
<br>
    if status == 'inactive':<br>
        status = 2<br>
        msg = device + ' is inactive.'<br>
    if type == 'raid5':<br>
        if current < (normal -1):<br>
            msg = device + ' failed' + failed<br>
            status = 2<br>
        elif current < normal:<br>
            msg = device + ' degraded' + failed<br>
            status = 1<br>
    else:<br>
        if current < normal:<br>
            msg = device + ' failed' + failed<br>
            status = 2<br>
<br>
    if len(msg) > 0:<br>
        if len(errorMsg) > 0:<br>
            errorMsg = errorMsg + '; '<br>
        errorMsg = errorMsg + msg<br>
        overallStatus = max(overallStatus, status)<br>
<br>
if overallStatus == 0:<br>
    print 'All md devices (' + devices + ' ) Ok.'<br>
    sys.exit(0)<br>
else:<br>
    print errorMsg<br>
    sys.exit(overallStatus)<br>
#EOF<br>
============================================================<br>
<br>
<div class="moz-signature">
<meta http-equiv="CONTENT-TYPE" content="text/html; ">
<title></title>
<meta name="GENERATOR" content="BrOffice.org 2.3  (Win32)">
<meta name="CREATED" content="20071220;9081011">
<meta name="CHANGED" content="20071220;18363004">
<style type="text/css">
        <!--
                @page { margin: 2cm }
                P { margin-bottom: 0.21cm }
        --></style><br>
</div>
<br>
<br>
Rene Fertig escreveu:
<blockquote cite="mid:200806170932.58021.me@renux.de" type="cite">
  <pre wrap="">Hello Hari.

  </pre>
  <blockquote type="cite">
    <pre wrap="">Have you checked NagiosExchange.org? I didn't see anything but then I
didn't look too closely. Otherwise you could just write one. VBS is an
easy language and universal enough for this. I'd write this in fact, if
I had any servers poor enough to have windows software raid...
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Of cause I've checked NagiosExchange, but there are only plugins for hardware 
raids.

I've found a VB script which uses DISKPART 
(<a class="moz-txt-link-freetext" href="http://www.anchor.com.au/hosting/dedicated/monitoring_windows_software_raid">http://www.anchor.com.au/hosting/dedicated/monitoring_windows_software_raid</a>). 
Unfortunately DISKPART didn't work on Windows 2000 (only Win 2000 Pro, Win 
2000 server, Win 2003 ...)

But I've got a list of event IDs so I can monitor the event log and do passive 
checks - more than nothing...

Greetings,

        Rene

  </pre>
</blockquote>
</body>
</html>