MDADM - Monitor Mode with Email

MDADM - Monitor Mode with Email

You can run mdadm as a daemon by using the follow-monitor mode. If needed, that will make mdadm send email alerts to the system administrator when arrays encounter errors or fail. Also, follow mode can be used to trigger contingency commands if a disk fails, like giving a second chance to a failed disk by removing and reinserting it, so a non-fatal failure could be automatically solved.

Let's see a basic example. Running

    mdadm --monitor --daemonise --mail=root@localhost --delay=1800 /dev/md2

should release a mdadm daemon to monitor /dev/md2. The --daemonise switch tells mdadm to run as a deamon. The delay parameter means that polling will be done in intervals of 1800 seconds. Finally, critical events and fatal errors should be e-mailed to the system manager. That's RAID monitoring made easy.

Finally, the --program or --alert parameters specify the program to be run whenever an event is detected.

Note that, when supplying the -f switch, the mdadm daemon will never exit once it decides that there are arrays to monitor, so it should normally be run in the background. Remember that your are running a daemon, not a shell command. If mdadm is ran to monitor without the -f switch, it will behave as a normal shell command and wait for you to stop it.

    • Related Articles

    • MDADM - Common Commands

      1. Create a new RAID array Create (mdadm —create) is used to create a new array: 1 mdadm --create --verbose /dev/md0 --level=1 /dev/sda1 /dev/sdb2 or using the compact notation: 1 mdadm -Cv /dev/md0 -l1 -n2 /dev/sd[ab]1 2. /etc/mdadm.conf ...
    • Setup Ubuntu 14.04.5 LTS Server with Software Raid1 for OS. (Video)

      The attached video will demonstrate a complete Ubuntu 14.04.5 LTS Server setup with the following.   Legacy Bios Mode.  240 GB Raid 1 - 2 X 240 GB SSD - OS drive 800 GB Raid 0 - 2 X 400 GB SSD - SCRATCH   The video is approximately 6 Minutes and ...
    • Clearing RAID metadata

      Usage: Disks that were previously in use by a RAID controller will often contain metadata that identifies them as being part of a RAID. The default behavior for the CentOS/RHEL Anaconda installer is to flag and ignore these types of disks in case ...
    • Monitoring sensor readings from command line

      Prerequisites: Linux IPMI capable motherboard ipmitool or IPMICFG watch Instructions: 1. Run the following command to check that the IPMI sensors are detected: ipmitool sdr elist or ipmicfg -sdr 2. If the sensors are properly detected, parse them ...
    • Booting into Rescue Mode (Load OS without LV'S)

      It may sometimes be helpful to boot into Rescue Mode (Load OS without LV's) when troubleshooting or applying patches by following the steps below.   Boot with rescue mode You need to press "Tab" button at the screen where you choose 32/64 bit mode or ...