Working with Heartbeat

If you have information, script, utility, or idea that can be useful for HostMonitor community, you welcome to share information in this forum.
Post Reply
mos-eisley
Posts: 76
Joined: Wed Mar 21, 2007 5:51 am
Location: Klarup (AAlborg), Demark

Working with Heartbeat

Post by mos-eisley »

We have a heartbeat solution, where 2 hosts "share" 1 IP address besides their own, and some tests should only be done on the host with the ip. At the same time, no "bad" test must appear on the other host to confuse people.

I have solved it like this by making a test that tests if the virtual NIC eth1:0 (a script parameter) is configured = the host has the IP. All nessesary test then depend on this test, and it is never reported bad, as not having the ip is not bad.

The script for the test called "pbstolx01.man.b.p Script HasVirtualInterfaceConfigured"

INTERFACE=$1

if [ `ifconfig "$INTERFACE" | grep inet | wc -c` -gt 0 ]
then

RESULT="Ok:Has $INTERFACE configured"

else

RESULT="Ok:Has no $INTERFACE configured"

fi

echo "ScriptRes:$RESULT"


So, the output is always "Ok" - so we have to make the other tests dependant of the actual reply, this is done with an expression:

'%::pbstolx01.man.b.p Script HasNetworkInterfaceConfigured::Reply%'=='Has eth1:0 configured'

Notice, that the parameter eth1:0 to the script is in the expression, wich is kind of bad programming, the reply (and expression) could be simplified to not use such a variable :D
Post Reply