On 02/13/2011 11:04 AM, Mark Knecht wrote:
> I'm curious about setting up my compute server to monitor RAID
> array status and have it email me information at my GMail account.
> Does anyone have info on setting this up on Gentoo? In general I'm
> but it seems there are a few holes in my understanding.
> 1) In the /etc/mdadm.conf file I see the following:
> # When used in --follow (aka --monitor) mode, mdadm needs a
> # mail address and/or a program. This can be given with "mailaddr"
> # and "program" lines to that monitoring can be started using
> # mdadm --follow --scan & echo $! > /var/run/mdadm
> # If the lines are not found, mdadm will exit quietly
> #MAILADDR email@example.com
> #PROGRAM /usr/sbin/handle-mdadm-events
> - Easy enough to change my email address, but how does it get mailed?
> Is this what ssmtp is for? ssmtp is installed as a dependency of sudo,
> but I don't use it explicitly. Do I have to have a real domain in my
> name to get GMail to accept this?
mdadm will use the sendmail command on your system. If you have ssmtp
installed, that's probably where your sendmail came from (I think all
providers of /usr/(s)bin/sendmail are mutually exclusive).
ssmtp usually needs some place to send the message; you can configure it
with the credentials of either your gmail or ISP account. It will
probably still send from root@localhost or whatever, but if you
authenticate with a username/password your ISP or gmail should accept it
> - Currently have have no program called
> /usr/sbin/handle-mdadm-events. Is this just a placeholder for whatever
> program I choose as a mailer, or is this intended as some program that
> takes real action in case of a problem?
Placeholder, just an example of what you would put after the PROGRAM
> 2) I'm making the assumption that running rc-update add mdadm boot, as
> shown in the link above, is the way to get this started once
> configured properly?
The RAID will start automatically, mdadm just monitors it. So either
boot or default is fine.
> 3) I note that the test command listed in the link above doesn't work:
> c2stable ~ # mdadm -Fslt
> mdadm: option -l not valid in monitor mode
> c2stable ~ #
> 4) Assuming I do get this working, while testing can i have the
> program email me every 60 minutes whether things are good or bad, just
> to test that it's actually working and getting results?
I don't think you can get it to mail you when it's happy, but you can
simulate a failure:
On Sun, Feb 13, 2011 at 10:09 AM, Michael Orlitzky <firstname.lastname@example.org> wrote:
> On 02/13/2011 11:04 AM, Mark Knecht wrote:
>> 4) Assuming I do get this working, while testing can i have the
>> program email me every 60 minutes whether things are good or bad, just
>> to test that it's actually working and getting results?
> I don't think you can get it to mail you when it's happy, but you can
> simulate a failure:
Thanks for the info Micheal.
I got mailx to send successfully to my GMail account using this page:
I'll read through the links you posted to look at creating a test
case. From the page you posted above I'm trying this at the command
On 02/13/2011 01:37 PM, Mark Knecht wrote:
> I'll read through the links you posted to look at creating a test
> case. From the page you posted above I'm trying this at the command
> mdadm --monitor --email@example.com --delay=1800 /dev/md126
> but I assume you think it won't do anything unless there's a problem
> found. Do those options properly belong in /etc/conf.d/mdadm.conf as
> the file itself seems to indicate?
I usually only define the MAILADDR in mdadm.conf. Everything else is
automagic. If you really need to mess with the delay, though, it would
go in /etc/conf.d/mdadm (you probably don't):
Give a delay in seconds. mdadm polls the md arrays and then waits
this many seconds before polling again. The default is 60
seconds. Since 2.6.16, there is no need to reduce this as the
kernel alerts mdadm immediately when there is any change.
> mark@c2stable ~ $ cat /etc/conf.d/mdadm
> # /etc/conf.d/mdadm: config file for /etc/init.d/mdadm
> # Misc options to pass to mdadm in monitor mode.
> # For more info, run `mdadm --monitor --help` or see
> # the mdadm(8) manpage.
> mark@c2stable ~ $
> Also, I have many RAIDs. Do they all get appended to the same monitor
> command, or when started as a daemon does mdadm --monitor actually
> monitor all RAIDs? (If you know...)
If you run mdadm yourself, I think you need to either specify --scan or
enumerate the md devices yourself. The gentoo init script passes --scan
for you, though, so mdadm will figure out what md devices you have all
02-13-2011, 06:04 PM
mdadm --monitor & email
On 02/13/2011 01:45 PM, Mark Knecht wrote:
> I think I'm there except maybe for kicking off some sort of regular
> tests of the arrays vs waiting for things to fail.
Any mdadm test is going to pass up until the point that it doesn't,
which is when you'd get the alert email anyway =)
If you want advance notice of disk problems, smartmontools is probably
your best bet.