启动后的mdadm监控脚本

启动后的mdadm监控脚本

启动后,mdadm 监控程序不起作用。当我随后终止该进程并mdadm --monitor --scan再次运行时,一切正常,脚本运行失败。

这是我的 mdadm.conf 文件

# mdadm.conf

# Please refer to mdadm.conf(5) for information about this file.


# by default (built-in), scan all partitions (/proc/partitions) and all
# containers for MD superblocks. alternatively, specify devices to scan, using
# wildcards if desired.
#DEVICE partitions containers

# auto-create devices with Debian standard permissions
CREATE owner=root group=disk mode=0660 auto=yes

# automatically tag new arrays as belonging to the local system
HOMEHOST <system>

# instruct the monitoring daemon where to send mail alerts
MAILADDR root
PROGRAM /usr/local/bin/raid-event

# definitions of existing MD arrays
ARRAY /dev/md/0 metadata=1.2 UUID=bdb46a13:5602ce29:d84bf5cd:28e91923 name=ubuntu:0
ARRAY /dev/md/1 metadata=1.2 UUID=e94eb878:bf152bd0:bdb66444:fce7ac6f name=ubuntu:1

和 /usr/local/bin/raid-evnt 脚本

#!/bin/bash
event=$1
device=$2
if [ $event == "Fail" ]
then
  notify-send --urgency=critical -i "/usr/share/icons/Humanity/devices/64/drive-harddisk.svg" "Disk "$3" in the Array "$device" has a failure"
  zenity --info --window-icon=/usr/share/icons/Humanity/devices/64/drive-harddisk.svg --text="A failure has been detected on disk "$3" in the Array "$device
else
 if [ $event == "FailSpare" ]
 then
  notify-send --urgency=critical -i "/usr/share/icons/Humanity/devices/64/drive-harddisk.svg" "Spare Disk "$3" in the Array "$device" has a failure"
  zenity --info --window-icon=/usr/share/icons/Humanity/devices/64/drive-harddisk.svg --text="A failure has been detected on spare disk "$3" in the Array "$device
 else
  if [ $event == "DegradedArray" ]
  then
   notify-send --urgency=critical -i "/usr/share/icons/Humanity/devices/64/drive-harddisk.svg" "Disk "$3" in the Array "$device" is degraded"
   zenity --info --window-icon=/usr/share/icons/Humanity/devices/64/drive-harddisk.svg --text="The Array "$device" is degraded because of disk "$3
  else
   if [ $event == "TestMessage" ]
    then
    notify-send --urgency=critical -i "/usr/share/icons/Humanity/devices/64/drive-harddisk.svg" "Raid test message"
    zenity --info --window-icon=/usr/share/icons/Humanity/devices/64/drive-harddisk.svg --text="A Test Message hast benn generated on device" $device
   fi
  fi
 fi
fi

有人可以帮帮我吗,我没有发现任何有用的东西。

相关内容