linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joachim Otahal <Jou@gmx.net>
To: Keld Simonsen <keld@keldix.com>
Cc: Bill Davidsen <davidsen@tmr.com>, linux-raid@vger.kernel.org
Subject: Re: md devices: Suggestion for in place time and checksum within the RAID
Date: Mon, 15 Mar 2010 22:28:43 +0100	[thread overview]
Message-ID: <4B9EA68B.70705@gmx.net> (raw)
In-Reply-To: <20100314130348.GA14141@light.rap.dk>

Keld Simonsen schrieb:
> Interesting! I would like to see your scripts....
>    
I did not realize how OLD that script was until I saw it today, I could 
not leave it that way, here is a revised and less embarrassing version, 
easy to extent to bang you with emails on a raid error too, but 
southpark is on TV now:

#!/bin/sh
HEALTHFILE="/tmp/healthcheck.mdstat"
HARDDRIVES="/dev/sda /dev/sdb /dev/sdc /dev/sdd"
SENDEMAILCOMMAND="/usr/local/sbin/sendEmail.pl <commandline-here>"
[ -f ${HEALTHFILE}.1 ] && /bin/rm -f ${HEALTHFILE}.1
[ -f ${HEALTHFILE}.0 ] && /bin/mv ${HEALTHFILE}.0 ${HEALTHFILE}.1
/usr/bin/touch ${HEALTHFILE}.1
/bin/cat /proc/mdstat > ${HEALTHFILE}.0
/usr/bin/diff ${HEALTHFILE}.0 ${HEALTHFILE}.1 > /dev/null
if [ $? == 1 ] ; then
   ${SENDEMAILCOMMAND} -u "RAID Status" < ${HEALTHFILE}.0
fi

HEALTHFILE="/var/log/healthcheck.smartctl"
[ -f ${HEALTHFILE}.1 ] && /bin/rm -f ${HEALTHFILE}.1
[ -f ${HEALTHFILE}.0 ] && /bin/mv ${HEALTHFILE}.0 ${HEALTHFILE}.1
/usr/bin/touch ${HEALTHFILE}.1
echo "SMART info:"> ${HEALTHFILE}.0
EMAILSUBJECT="SMART Status, Reallocated Sector Count"
for X in ${HARDDRIVES} ; do
   Y="`/usr/local/sbin/smartctl --all ${X} | /bin/grep -i 
Reallocated_Sector_Ct`"
   if [ "${Y}" != "" ] ; then
     /bin/echo "${X}     ${Y}">> ${HEALTHFILE}.0
     if [ "`/usr/local/sbin/smartctl --all ${X} | /bin/grep -o 'No 
Errors Logged'`" == "No Errors Logged" ] ; then
       /bin/echo "${X}    No Errors Logged">> ${HEALTHFILE}.0
     else
       EMAILSUBJECT="SMART ERRORS LOGGED, Reallocated Sector Count"
       [ -f ${HEALTHFILE}.1 ] && /bin/rm -f ${HEALTHFILE}.1
       /usr/bin/touch ${HEALTHFILE}.1
       /bin/echo 
"------------------------------------------------------------------------">> 
${HEALTHFILE}.0
       /bin/echo "${X}">> ${HEALTHFILE}.0
       /usr/local/sbin/smartctl --all ${X} | /bin/grep -i -A 999 "SMART 
Error Log" >> ${HEALTHFILE}.0
       /bin/echo 
"------------------------------------------------------------------------">> 
${HEALTHFILE}.0
     fi
   fi
done
/usr/bin/diff ${HEALTHFILE}.0 ${HEALTHFILE}.1 > /dev/null
if [ $? == 1 ] ; then
   ${SENDEMAILCOMMAND} -u "${EMAILSUBJECT}" < ${HEALTHFILE}.0
fi

regards,

Joachim Otahal

      parent reply	other threads:[~2010-03-15 21:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-13 23:00 md devices: Suggestion for in place time and checksum within the RAID Joachim Otahal
2010-03-14  0:04 ` Bill Davidsen
2010-03-14  1:25   ` Joachim Otahal
2010-03-14 10:20     ` Keld Simonsen
2010-03-14 11:58       ` Joachim Otahal
2010-03-14 13:03         ` Keld Simonsen
2010-03-14 14:00           ` Joachim Otahal
2010-03-15 21:28           ` Joachim Otahal [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=4B9EA68B.70705@gmx.net \
    --to=jou@gmx.net \
    --cc=davidsen@tmr.com \
    --cc=keld@keldix.com \
    --cc=linux-raid@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).