Re: checking state of RAID (for automated notifications)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux