FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 02-13-2011, 05:09 PM
Michael Orlitzky
 
Default mdadm --monitor & email

On 02/13/2011 11:04 AM, Mark Knecht wrote:
> Hi,
> 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
> following:
>
> http://en.gentoo-wiki.com/wiki/RAID/Software
>
> 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 root@mydomain.tld
> #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
just fine.


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


> 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:

http://tldp.org/HOWTO/Software-RAID-HOWTO-6.html#ss6.3
 
Old 02-13-2011, 05:37 PM
Mark Knecht
 
Default mdadm --monitor & email

On Sun, Feb 13, 2011 at 10:09 AM, Michael Orlitzky <michael@orlitzky.com> wrote:
> On 02/13/2011 11:04 AM, Mark Knecht wrote:
<SNIP>
>>
>> 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:
>
> *http://tldp.org/HOWTO/Software-RAID-HOWTO-6.html#ss6.3

Thanks for the info Micheal.

I got mailx to send successfully to my GMail account using this page:

http://en.gentoo-wiki.com/wiki/Gmail_and_sSMTP

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
line:

mdadm --monitor --mail=markknecht@gmail.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?

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.

MDADM_OPTS="--syslog"
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...)

Thanks!

Cheers,
Mark
 
Old 02-13-2011, 05:45 PM
Mark Knecht
 
Default mdadm --monitor & email

This is an automatically generated mail message from mdadm
running on c2stable

A TestMessage event had been detected on md device /dev/md/7.

Faithfully yours, etc.

P.S. The /proc/mdstat file currently contains the following:

Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
md6 : active raid1 sdc6[2] sdb6[1] sda6[0]
247416933 blocks super 1.1 [3/3] [UUU]

md3 : active raid6 sdc3[2] sdb3[1] sda3[0] sdd3[3] sde3[4]
157305168 blocks super 1.2 level 6, 16k chunk, algorithm 2 [5/5] [UUUUU]

md7 : active raid6 sdc7[2] sdb7[1] sda7[0] sdd2[3] sde2[4]
395387904 blocks super 1.2 level 6, 16k chunk, algorithm 2 [5/5] [UUUUU]

md126 : active raid1 sdc5[2] sdb5[1] sda5[0]
52436032 blocks [3/3] [UUU]

unused devices: <none>

On Sun, Feb 13, 2011 at 10:37 AM, Mark Knecht <markknecht@gmail.com> wrote:
<SNIP>

I added '--test' to the config file and restarted mdadm. The following
message was received in my GMail account.

I think I'm there except maybe for kicking off some sort of regular
tests of the arrays vs waiting for things to fail.

Cheers,
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.

MDADM_OPTS="--syslog --mail=markknecht@gmail.com --delay=1800 --test"
c2stable ~ #

This is an automatically generated mail message from mdadm
running on c2stable

A TestMessage event had been detected on md device /dev/md/7.

Faithfully yours, etc.

P.S. The /proc/mdstat file currently contains the following:

Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
md6 : active raid1 sdc6[2] sdb6[1] sda6[0]
247416933 blocks super 1.1 [3/3] [UUU]

md3 : active raid6 sdc3[2] sdb3[1] sda3[0] sdd3[3] sde3[4]
157305168 blocks super 1.2 level 6, 16k chunk, algorithm 2 [5/5] [UUUUU]

md7 : active raid6 sdc7[2] sdb7[1] sda7[0] sdd2[3] sde2[4]
395387904 blocks super 1.2 level 6, 16k chunk, algorithm 2 [5/5] [UUUUU]

md126 : active raid1 sdc5[2] sdb5[1] sda5[0]
52436032 blocks [3/3] [UUU]

unused devices: <none>
 
Old 02-13-2011, 06:01 PM
Michael Orlitzky
 
Default mdadm --monitor & email

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
> line:
>
> mdadm --monitor --mail=markknecht@gmail.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):

--delay
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.
>
> MDADM_OPTS="--syslog"
> 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
by itself.
 
Old 02-13-2011, 06:04 PM
Michael Orlitzky
 
Default 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.
 

Thread Tools




All times are GMT. The time now is 03:45 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org