Cowboy Denny Posted January 18 Share Posted January 18 This script is created to make it easy to force-offline a node or pool member and then reenable it. Create a file called node-maint.sh and paste the following #!/bin/bash # format to follow: # $1 node-enable|node-forceoffline|poolnode-enable|poolnode-forceoffline # $2 node-ipaddress|node-fqdn|member ip/fqdn and port # example node: node-maint.sh node-forceoffline 10.6.0.141 # example node: node-maint.sh node-enable 10.6.0.141 # example member: node-maint.sh poolnode-forceoffline # example member: node-maint.sh poolnode-enable /Production/10.40.152.116:8101 /Production/pool.alfa-fnt.hosangit.com.8101 echo "******* HELP *********" echo "ACTION options are:" echo "node-enable or node-forceoffline" echo "poolnode-enable or poolnode-forceoffline" echo "" echo "NODE options are:" echo "ip address or fqnd (you have to use however its configured)" echo "POOL MEMBER options are:" echo "/partition/ip|fqdn:port" echo "" echo "when enabling/disabling a pool member you must also include pool (example: node-maint.sh poolnode-enable /Production/10.40.152.116:8101 /Production/pool.alfa-fnt.hosangit.com.8101)" echo "****** END OF HELP ********" action=$1 node=$2 pool=$3 if [[ $action == node-enable ]] then echo "action selected = $action" echo "##START $node##";echo "##Current Status of $node##";tmsh show /ltm node $node | egrep ' Availability| State| Reason| Monitor Status| Session Status'; echo "##How many connections on $node?##";tmsh show /sys connection ss-server-addr $node; echo "##Enabling $node##";tmsh modify /ltm node $node state user-up session user-enabled; sleep 2;echo "##Show current status of node##";tmsh show /ltm node $node | egrep ' Availability| State| Reason| Monitor Status| Session Status';echo "##FINISHED $node##" elif [[ $action == node-forceoffline ]] then echo "action selected = $action" echo "##START $node##";echo "##Current Status of $node##";tmsh show /ltm node $node | egrep ' Availability| State| Reason| Monitor Status| Session Status'; echo "##How many connections on $node?##";tmsh show /sys connection ss-server-addr $node; echo "##Forcing $node Offline##";tmsh modify /ltm node $node state user-down session user-disabled; sleep 2;echo "##Show current status of node##";tmsh show /ltm node $node | egrep ' Availability| State| Reason| Monitor Status| Session Status';echo "##-->Checking number of connections just run:tmsh show /sys connection ss-server-addr $node";tmsh show /sys connection ss-server-addr $node;echo "##FINISHED $node##" elif [[ $action == poolnode-enable ]] then echo "action selected = $action" elif [[ $action == poolnode-forceoffline ]] then echo "action selected = $action" else echo "no action set" fi Link to comment Share on other sites More sharing options...
Recommended Posts