linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Why "mdadm --monitor --program" sometimes only gives 2 command-line arguments to the program?
@ 2008-01-06  2:11 Hxsrmeng
  2008-01-06 11:06 ` Nagilum
  2008-01-08  3:52 ` Neil Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Hxsrmeng @ 2008-01-06  2:11 UTC (permalink / raw)
  To: linux-raid


Hi all,

I need to monitor my RAID and if it fails, I'd like to call my-script to
deal with the failure.

I did: 
mdadm --monitor --program my-script --delay 60 /dev/md1

And then, I simulate a failure with
mdadm --manage --set-faulty /dev/md1 /dev/sda2
mdadm /dev/md1 --remove /dev/sda2

I hope the mdadm monitor function can pass all three command-line
arguments to my-script, including the name of the event, the name of the
md device and the name of a related device if relevant.

But my-script doesn't get the third one, which should be /dev/sda2. Is
this not "relevant"?

If I really need to know it's /dev/sda2 that fails, what can I do?

Thanks.


-- 
View this message in context: http://www.nabble.com/Why-%22mdadm---monitor---program%22-sometimes-only-gives-2-command-line-arguments-to-the-program--tp14642331p14642331.html
Sent from the linux-raid mailing list archive at Nabble.com.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Why "mdadm --monitor --program" sometimes only gives 2 command-line arguments to the program?
  2008-01-06  2:11 Why "mdadm --monitor --program" sometimes only gives 2 command-line arguments to the program? Hxsrmeng
@ 2008-01-06 11:06 ` Nagilum
  2008-01-08  3:52 ` Neil Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Nagilum @ 2008-01-06 11:06 UTC (permalink / raw)
  To: Hxsrmeng; +Cc: linux-raid

[-- Attachment #1: Type: text/plain, Size: 1360 bytes --]

----- Message from hxsrmeng@gmail.com ---------
     Date: Sat, 5 Jan 2008 18:11:38 -0800 (PST)
     From: Hxsrmeng <hxsrmeng@gmail.com>

> I hope the mdadm monitor function can pass all three command-line
> arguments to my-script, including the name of the event, the name of the
> md device and the name of a related device if relevant.
>
> But my-script doesn't get the third one, which should be /dev/sda2. Is
> this not "relevant"?
>
> If I really need to know it's /dev/sda2 that fails, what can I do?

Since you have the array name (e.g. /dev/md1) you could run "mdadm -Q  
--detail /dev/md1" and parse the output or have a look at /proc/mdstat  
or /sys/block/md1/* .
Kind regards,
Alex.


========================================================================
#    _  __          _ __     http://www.nagilum.org/ \n icq://69646724 #
#   / |/ /__ ____ _(_) /_ ____ _  nagilum@nagilum.org \n +491776461165 #
#  /    / _ `/ _ `/ / / // /  ' \  Amiga (68k/PPC): AOS/NetBSD/Linux   #
# /_/|_/\_,_/\_, /_/_/\_,_/_/_/_/   Mac (PPC): MacOS-X / NetBSD /Linux #
#           /___/     x86: FreeBSD/Linux/Solaris/Win2k  ARM9: EPOC EV6 #
========================================================================


----------------------------------------------------------------
cakebox.homeunix.net - all the machine one needs..


[-- Attachment #2: PGP Digital Signature --]
[-- Type: application/pgp-signature, Size: 187 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Why "mdadm --monitor --program" sometimes only gives 2 command-line arguments to the program?
  2008-01-06  2:11 Why "mdadm --monitor --program" sometimes only gives 2 command-line arguments to the program? Hxsrmeng
  2008-01-06 11:06 ` Nagilum
@ 2008-01-08  3:52 ` Neil Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Neil Brown @ 2008-01-08  3:52 UTC (permalink / raw)
  To: Hxsrmeng; +Cc: linux-raid

On Saturday January 5, hxsrmeng@gmail.com wrote:
> 
> Hi all,
> 
> I need to monitor my RAID and if it fails, I'd like to call my-script to
> deal with the failure.
> 
> I did: 
> mdadm --monitor --program my-script --delay 60 /dev/md1
> 
> And then, I simulate a failure with
> mdadm --manage --set-faulty /dev/md1 /dev/sda2
> mdadm /dev/md1 --remove /dev/sda2
> 
> I hope the mdadm monitor function can pass all three command-line
> arguments to my-script, including the name of the event, the name of the
> md device and the name of a related device if relevant.
> 
> But my-script doesn't get the third one, which should be /dev/sda2. Is
> this not "relevant"?
> 
> If I really need to know it's /dev/sda2 that fails, what can I do?

What version of mdadm are you using?
I'm guessing 2.6, 2.6.1, or 2.6.2.
There was a bug introduced in 2.6 that was fixed in 2.6.3 that would
have this effect.

NeilBrown

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-01-08  3:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-06  2:11 Why "mdadm --monitor --program" sometimes only gives 2 command-line arguments to the program? Hxsrmeng
2008-01-06 11:06 ` Nagilum
2008-01-08  3:52 ` Neil Brown

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).