Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

This is a very simple script, since the cluster I made this for only has a floating IP resource. I might build a more complicated one at a later date.

Note: This is for CentOS

nano /usr/share/xymon-client/ext/ha.sh
#!/bin/bash

COLUMN=PaceMaker			
COLOR=green				
MSG="Testing Quorom and Floating IP of Galera Cluster" 

# Get PCS Status
pcslog="/tmp/pcs.status"
rm $pcslog
pcs status >> $pcslog

quorum="$(cat $pcslog | grep "with quorum")"
vip="$(cat $pcslog | grep IPaddr2 | grep Started)"
cmd="$(cat $pcslog)"

if [ -z "$quorum" ] || [ -z "$vip1" ] 

then

COLOR=red
MSG="${MSG}
FAILED
""
"${cmd}"
"
else

MSG="${MSG}
SUCCESS
""
"${cmd}"
"
fi

# Leave the rest of script alone
# Tell Xymon about it
$XYMON $XYMSRV "status $MACHINE.$COLUMN $COLOR `date`

${MSG}
"

exit 0

rm $pcslog
chown xymon:xymon /usr/share/xymon-client/ext/ha.sh
chmod 777 /usr/share/xymon-client/ext/ha.sh

cat << 'EOL' >/etc/xymon-client/client.d/ha.cfg
[ha]
 ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg
 CMD $XYMONCLIENTHOME/ext/ha.sh
 LOGFILE $XYMONCLIENTHOME/logs/ha.log
 INTERVAL 15m
EOL
/usr/share/xymon-client/bin/xymoncmd /usr/share/xymon-client/ext/ha.sh
  • No labels