Setting up e-mail notifications for Linux Software RAID

From csml-wiki.northwestern.edu
Jump to navigation Jump to search

It is prudent to set up email notifications that alert you when a RAID is in a degraded state. For a Software RAID on Linux (/dev/md partitions) this is done as follows.

  • openSuSE 13.1
  1. Go to YaST -> System -> /etc/sysconfig editor
  2. Within the sysconfig editor, select: System -> File systems -> Mdadm
  3. Set MDADM_MAIL (this can be a comma-separated list, for truly old versions of openSuSE, such as 11.1, it must be a single email address)
  4. Set MDADM_SEND_MAIL_ON_START to 'yes'
  5. Click 'Ok' and quit YaST
  6. From the command line do
    insserv mdadmd
    /etc/rc.d/mdadmd start
    
  7. You should receive a test email for each RAID partition.
  • openSuSE Leap 42.1
  1. Go to YaST -> System -> /etc/sysconfig editor
  2. Within the sysconfig editor, select: System -> File systems -> Mdadm
  3. Set MDADM_MAIL (this can be a comma-separated list)
  4. Set MDADM_SEND_MAIL_ON_START to 'yes'
  5. Click 'Ok' (ignore the error message concerning 'Cannot determine service state') and quit YaST
  6. From the command line do
    systemctl restart mdmonitor.service
    systemctl status mdmonitor.service
    

    The second command should show 'mdmonitor' as 'active' and the command options should include the email address(es) that you entered, as well as the '-t' option (which reflects the 'send mail on start' option).

  7. The "restart" command should trigger an email to the designated recipients.
  • openSuSE Leap 15.0 and 15.1
  1. First make sure that postfix is configured properly: Check in /etc/postfix/main.cf that the line myhostname = XXX.ms.northwestern.edu contains the correct hostname (and not a name assigned by DHCP). After that, ensure that postfix is indeed running (it you had to correct the hostname, restart postfix):
    systemctl start postfix
    systemctl status postfix
    

    If there is an error referring to 'fatal: parameter inet_interfaces: no local interface found for ::1' then edit /etc/postfix/main.cf: find the line "inet_interfaces = localhost" and change it to

    inet_interfaces = all
    

    After this, try to start postfix again.

  2. Go to YaST -> System -> /etc/sysconfig editor
  3. Within the sysconfig editor, select: System -> File systems -> Mdadm
  4. Set MDADM_MAIL (this can be a comma-separated list)
  5. Set MDADM_SEND_MAIL_ON_START to 'yes'
  6. Clear MDADM_CHECK_DURATION
  7. Click 'Finish' (ignore the error message concerning 'Cannot determine service state') and quit YaST
  8. From the command line do
    systemctl restart mdmonitor.service
    systemctl status mdmonitor.service
    

    The second command should show 'mdmonitor' as 'active' and the command options should include the email address(es) that you entered, as well as the '-t' option (which reflects the 'send mail on start' option).

  9. The "restart" command should trigger an email to the designated recipients.