2 # ctdb event script for monitoring the multipath daemon
4 # Configure monitporing of multipath devices by listing the device serials
5 # in /etc/ctdb/multipathd :
6 # CTDB_MONITOR_MPDEVICES="device1 device2 ..."
9 PATH=/bin:/usr/bin:$PATH
11 . $CTDB_BASE/functions
18 [ -z "$CTDB_MONITOR_MPDEVICES" ] && {
22 MPFAILURE=$CTDB_BASE/state/multipathd/failure
24 multipathd_check_background()
26 for DEVICE in $CTDB_MONITOR_MPDEVICES; do
27 # check that we can see all devices
28 if [ -z "`multipath -ll $DEVICE`" ]; then
29 echo Device $DEVICE not known to multipathd
33 # check that all devices are active
34 if [ -z "`multipath -ll $DEVICE|grep prio|grep active`" ]; then
35 echo Device $DEVICE has no active paths
44 # run the actual check in the background since the call to
45 # multipath may block.
47 multipathd_check_background &
51 while [ $timeleft -gt 0 ]; do
52 timeleft=$(($timeleft - 1))
54 # see if the process still exists
55 /bin/kill -0 $pid > /dev/null 2>&1 || {
56 # it doesn't exist, grab its exit status
59 echo "20.multipathd: multipath background update exited with status $?"
63 rm $MPFAILURE 2>/dev/null
68 echo "20.multipathd: Callout to multipath checks hung."
73 if [ -f $MPFAILURE ]; then
82 # create a state directory to keep/track the multipath device
84 /bin/mkdir -p $CTDB_BASE/state/multipathd
91 echo 20.multipathd: monitoring of multipathing failed
98 # ignore unknown commands