LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   mdadm - email alerts (https://www.linuxquestions.org/questions/linux-software-2/mdadm-email-alerts-936192/)

LBM 03-24-2012 09:35 AM

mdadm - email alerts
 
I'm running software RAID with mdadm, and have monitoring setup.
It is working, but is it possible to set it up, so I recieve repeating e-mails, lets say once an hour.

Currently it seems to be that it only recieves e-mails when a state changes?

Is the only solution, to create an command to execute with cron ?
example.

Code:

mdadm --monitor /var/run/mdadm/monitor.pid --scan --syslog

LBM 03-25-2012 04:53 AM

Oh well, already running as cron :)

Code:

cat /etc/cron.daily/mdadm
#!/bin/sh
#
# cron.daily/mdadm -- daily check that MD devices are functional
#
# Copyright © 2008 Paul Slootman <paul@debian.org>
# distributed under the terms of the Artistic Licence 2.0

# As recommended by the manpage, run
#      mdadm --monitor --scan --oneshot
# every day to ensure that any degraded MD devices don't go unnoticed.
# Email will go to the address specified in /etc/mdadm/mdadm.conf .
#
set -eu

MDADM=/sbin/mdadm
[ -x $MDADM ] || exit 0 # package may be removed but not purged

exec $MDADM --monitor --scan --oneshot


ianll 03-25-2012 06:26 AM

Good investigative work LBM.

That looks like it does what you want - yes?

You could move that script into /etc/cron.hourly/ and modify it to email you the output if that is not already happening by default.

Everything's possible,
ianll

LBM 03-25-2012 09:53 AM

It is mailing me now, since i have my email in /etc/mdadm/mdadm.conf, and yes it does exactly what I want.
I've added this email yesterday, so the emails where first recieved after this. (Which is really the solution to the original problem/question)


All times are GMT -5. The time now is 09:07 PM.