All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomasz Chmielewski <mangoo@wpkg.org>
To: Mike Hardy <mhardy@h3c.com>
Cc: linux-raid@vger.kernel.org
Subject: Re: checking state of RAID (for automated notifications)
Date: Thu, 07 Sep 2006 10:30:44 +0200	[thread overview]
Message-ID: <44FFD8B4.7080901@wpkg.org> (raw)
In-Reply-To: <44FEFC45.1080500@h3c.com>

Mike Hardy wrote:
> <berlin> % rpm -qf /usr/lib/nagios/plugins/contrib/check_linux_raid.pl
> nagios-plugins-1.4.1-1.2.fc4.rf
> 
> It is built in to my nagios plugins package at least, and works great.

All right, I didn't see it.

I was thinking of monitoring remote servers; I wrote something very simple.
It checks how many "U" letters there are in /proc/mdstat, and compares 
it to $DEVICES number we have.

First, run this one on a remote machine, via cron:


#!/bin/bash

# This script prints the status of RAID device on this machine

# how many RAID devices/partitions do we have here?
DEVICES=8


# no need to change anything below...

RUNNING=$(cat /proc/mdstat | tr -cd  "U" | wc -c)

if [ "$DEVICES" == "$RUNNING" ] ; then

echo "RAID status OK" > /tmp/raid-status.txt

else

echo "RAID broken" > /tmp/raid-status.txt

fi


And then poll the results from the nagios server (let's call it 
"check_raid" nagios plugin):

#!/bin/bash

# checks state of software RAID

STATUS=$(ssh -l checkuser -i ~nagios/.ssh/checkuser.rsa $1 "cat 
/tmp/raid-status.txt")

if [ "$STATUS" == "RAID status OK" ] ; then
echo $STATUS
exit 0
else
echo $STATUS
exit 2
fi


-- 
Tomasz Chmielewski
http://wpkg.org

      reply	other threads:[~2006-09-07  8:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-06  8:44 checking state of RAID (for automated notifications) Tomasz Chmielewski
2006-09-06 16:50 ` Mike Hardy
2006-09-07  8:30   ` Tomasz Chmielewski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44FFD8B4.7080901@wpkg.org \
    --to=mangoo@wpkg.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=mhardy@h3c.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.