DRBD resource watchdog script to bounce resource on secondary node if its too far out of sync (oos) and stalled.
Note: Only supported for DRBD version 9.
Usage: ./drbdwatch.sh <resource name>
Suggest running this in cron every minute to ensure drbd does not remain out of sync very long
Add more lines for each resource you want to monitor
Example: */1 * * * * bash -l -c '/usr/local/bin/drbdwatch.sh r0' > /dev/null 2>&1
Variables near the top of script can be tuned. Here are the defaults:
OOS_MAX=256000 #256KB
SYNC_TIMEOUT=1800 #30 Minutes
Configuration:
Edit LOGFILE and LOCKFILE variables if desired
Note, LOCKFILE must include the resource variable to ensure uniqueness if running multiple drbdwatch.sh instances
Defaults:
LOGFILE="/var/log/drbdwatch.log"
LOCKFILE="/tmp/.DRDBSYNC_$RESOURCE"