Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.
On Mon, 2 Mar 2009 10:42:32 Martin Gombac wrote:
>
>
> Hi,
>
> before i write my own, has anyone already written the script that
> checks status of drbd devices (connected/consistent status) which
> does an action (sends mail?) upplon inconsistent/disconnected
> filesystem/node?
> If so would he share it with the rest of us?
Below is a very simple bash function I use to check drbd status.
Ehud.
drbd_check () # 2 args: Host, resource-number
{
set +e
CSTT=`rsh -l <c-user> $1 "cat /proc/drbd" 2>/dev/null` # check drbd status
set -e # get all processes with this name + 1
if [ "$CSTT" != "" ] ; then # check only if rsh was successful
CSTT=`echo "$CSTT" | grep " ${2}: cs:"` # get r$3 connection status
case "$CSTT" in
*"Connected"* ) ;; # connected, do nothing
*"SyncSource"* | *"SyncTarget"* ) ;; # Syncing, do nothing
* ) <error-processing> ;; # message about broken drbd connection
esac
fi
}
#------------------------------------------------------------------------------
--
Ehud Karni Tel: +972-3-7966-561 /"\
Mivtach - Simon Fax: +972-3-7966-667 \ / ASCII Ribbon Campaign
Insurance agencies (USA) voice mail and X Against HTML Mail
http://www.mvs.co.il FAX: 1-815-5509341 / \
GnuPG: 98EA398D <http://www.keyserver.net/> Better Safe Than Sorry