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 ..."
11 service_name="multipathd"
15 [ -z "$CTDB_MONITOR_MPDEVICES" ] && {
19 MPFAILURE=$CTDB_BASE/state/multipathd/failure
21 multipathd_check_background()
23 for DEVICE in $CTDB_MONITOR_MPDEVICES; do
24 # check that we can see all devices
25 if [ -z "`multipath -ll $DEVICE`" ]; then
26 echo Device $DEVICE not known to multipathd
30 # check that all devices are active
31 if [ -z "`multipath -ll $DEVICE|grep prio|grep active`" ]; then
32 echo Device $DEVICE has no active paths
41 # run the actual check in the background since the call to
42 # multipath may block.
44 multipathd_check_background &
48 while [ $timeleft -gt 0 ]; do
49 timeleft=$(($timeleft - 1))
51 # see if the process still exists
52 /bin/kill -0 $pid > /dev/null 2>&1 || {
53 # it doesn't exist, grab its exit status
56 echo "20.multipathd: multipath background update exited with status $?"
60 rm $MPFAILURE 2>/dev/null
65 echo "20.multipathd: Callout to multipath checks hung."
70 if [ -f $MPFAILURE ]; then
79 # create a state directory to keep/track the multipath device
81 /bin/mkdir -p $CTDB_BASE/state/multipathd
88 echo 20.multipathd: monitoring of multipathing failed
95 # ignore unknown commands