Print Download PDF Send Feedback

Previous

Next

Appendix A - The clusterXL_admin Script

The clusterXL_admin script can be used to initiate a manual fail-over from a cluster member.

This shell script registers a pnote (called admin_down) and gracefully changes the state of the given cluster member to Down (by reporting the state of that pnote as problem), or gracefully reverts the state of the given cluster member to Up (by reporting the state of that pnote as ok).

The clusterXL_admin script is located in $FWDIR/bin/ directory on your cluster members.

For more information, see sk55081.

Example:

#! /bin/csh -f

#

# The script will cause the machine to get into down state, thus the member will not filter packets.

# It will supply a simple way to initiate a failover by registering a new device in problem state when

# a failover is required and will unregister the device when wanting to return to normal operation.

# USAGE:

# clusterXL_admin <up|down>

 

set PERSISTENT = ""

 

# checking number of arguments

if ( $#argv > 2 || $#argv < 1 ) then

echo "clusterXL_admin : Invalid Argument Count"

echo "Usage: clusterXL_admin <up|down> [-p]"

exit 1

else if ( $#argv == 2 ) then

if ( "$2" != "-p" ) then

echo "clusterXL_admin : Invalid Argument ($2)"

echo "Usage: clusterXL_admin <up|down> [-p]"

exit 1

endif

set PERSISTENT = "-p"

endif

 

#checking if cpha is started

$FWDIR/bin/cphaprob stat | grep "Cluster" > /dev/null

if ($status) then

echo "HA is not started"

exit 1

endif

 

if ( $1 == "up" ) then

echo "Setting member to normal operation ..."

$FWDIR/bin/cphaconf set_pnote -d admin_down $PERSISTENT unregister > & /dev/null

if ( `uname` == 'IPSO' ) then

sleep 5

else

sleep 1

endif

 

set stateArr = `$FWDIR/bin/cphaprob stat | grep "local"`

 

$FWDIR/bin/cphaprob stat | egrep "Sync only|Bridge Mode" > /dev/null

#If it's third party or bridge mode, use column 4 , otherwise 5

if ($status) then

set state = $stateArr[5]

else

set state = $stateArr[4]

endif

 

echo "Member current state is $state"

if ( $state != "Active" && $state != "Standby" ) then

echo "Operation failed: member is still down, run 'cphaprob list' for further details"

endif

exit 0

endif

 

if ( $1 == "down" ) then

echo "Setting member to administratively down state ..."

$FWDIR/bin/cphaconf set_pnote -d admin_down -t 0 -s problem $PERSISTENT register > & /dev/null

sleep 1

 

set stateArr = `$FWDIR/bin/cphaprob stat | grep "local"`

 

$FWDIR/bin/cphaprob stat | egrep "Sync only|Bridge Mode" > /dev/null

#If it's third party or bridge mode, use column 4 , otherwise 5

if ($status) then

set state = $stateArr[5]

else

set state = $stateArr[4]

endif

 

echo "Member current state is $state"

if ( $state == "Active attention" ) then

echo "All the members within the cluster have problem/s and the local member was chosen to become active"

else

if ( $state != "Down" ) then

echo "Operation failed: member is not down, run 'cphaprob list' for further details"

endif

endif

exit 0

else

echo "clusterXL_admin : Invalid Option ($1)"

echo "Usage: clusterXL_admin <up|down> [-p]"

exit 1

endif