Gentoo Archives: gentoo-user

From: Michael Orlitzky <michael@××××××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] mdadm --monitor & email
Date: Sun, 13 Feb 2011 18:11:38
Message-Id: 4D581E58.50605@orlitzky.com
In Reply to: [gentoo-user] mdadm --monitor & email by Mark Knecht
1 On 02/13/2011 11:04 AM, Mark Knecht wrote:
2 > Hi,
3 > I'm curious about setting up my compute server to monitor RAID
4 > array status and have it email me information at my GMail account.
5 > Does anyone have info on setting this up on Gentoo? In general I'm
6 > following:
7 >
8 > http://en.gentoo-wiki.com/wiki/RAID/Software
9 >
10 > but it seems there are a few holes in my understanding.
11 >
12 > 1) In the /etc/mdadm.conf file I see the following:
13 >
14 > #
15 > # When used in --follow (aka --monitor) mode, mdadm needs a
16 > # mail address and/or a program. This can be given with "mailaddr"
17 > # and "program" lines to that monitoring can be started using
18 > # mdadm --follow --scan & echo $! > /var/run/mdadm
19 > # If the lines are not found, mdadm will exit quietly
20 > #MAILADDR root@××××××××.tld
21 > #PROGRAM /usr/sbin/handle-mdadm-events
22 >
23 > - Easy enough to change my email address, but how does it get mailed?
24 > Is this what ssmtp is for? ssmtp is installed as a dependency of sudo,
25 > but I don't use it explicitly. Do I have to have a real domain in my
26 > name to get GMail to accept this?
27
28 mdadm will use the sendmail command on your system. If you have ssmtp
29 installed, that's probably where your sendmail came from (I think all
30 providers of /usr/(s)bin/sendmail are mutually exclusive).
31
32 ssmtp usually needs some place to send the message; you can configure it
33 with the credentials of either your gmail or ISP account. It will
34 probably still send from root@localhost or whatever, but if you
35 authenticate with a username/password your ISP or gmail should accept it
36 just fine.
37
38
39 > - Currently have have no program called
40 > /usr/sbin/handle-mdadm-events. Is this just a placeholder for whatever
41 > program I choose as a mailer, or is this intended as some program that
42 > takes real action in case of a problem?
43
44 Placeholder, just an example of what you would put after the PROGRAM
45 directive.
46
47
48 > 2) I'm making the assumption that running rc-update add mdadm boot, as
49 > shown in the link above, is the way to get this started once
50 > configured properly?
51
52 The RAID will start automatically, mdadm just monitors it. So either
53 boot or default is fine.
54
55
56 > 3) I note that the test command listed in the link above doesn't work:
57 >
58 > c2stable ~ # mdadm -Fslt
59 > mdadm: option -l not valid in monitor mode
60 > c2stable ~ #
61 >
62 > 4) Assuming I do get this working, while testing can i have the
63 > program email me every 60 minutes whether things are good or bad, just
64 > to test that it's actually working and getting results?
65
66 I don't think you can get it to mail you when it's happy, but you can
67 simulate a failure:
68
69 http://tldp.org/HOWTO/Software-RAID-HOWTO-6.html#ss6.3

Replies

Subject Author
Re: [gentoo-user] mdadm --monitor & email Mark Knecht <markknecht@×××××.com>