For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

momo_84865's avatar
momo_84865
Icon for Nimbostratus rankNimbostratus
May 12, 2014

convert custom script from v9 to v11

here is the custom node management script running at v9, can someone kindly help to convert it using tmsh command? Many thanks.

 

!/bin/sh

prog="nodemgmt"

 

enable() { change_status "enable" "up" }

 

disable() { change_status "disable" "down" }

 

status() { show_status }

 

show_status() { for pool in $(seq 0 $((${POOL_ARRAY[@]} - 1))) do p=${POOL_ARRAY[$pool]} m=${MEMBER_ARRAY[$pool]} b pool $p member $m done }

 

change_status() { for pool in $(seq 0 $((${POOL_ARRAY[@]} - 1))) do p=${POOL_ARRAY[$pool]} m=${MEMBER_ARRAY[$pool]} b pool $p member $m session $1 $2 echo "$1 pool $p, member $m $2, status: $?" done }

 

case "$1" in enable) . $2 enable ;; disable) . $2 disable ;; status) . $2 status ;; *) echo $"Usage: $prog {enable|disable|status} " RETVAL=1 esac

 

exit $RETVAL

 

3 Replies

  • I think there's a piece of the puzzle missing here, so I can only really convert the b commands.

    b pool $p member $m
    

    should become

    tmsh show ltm pool $p members { $m }
    

    For change_status:

    b pool $p member $m session $1 $2
    

    should become

    tmsh modify ltm pool $p members modify { $m { session $2 } }
    

    The values allowed here for session are "user-enabled" and "user-disabled", so you may need to modify your input.

  • Try this chart. It should help a bit

     

    https://devcentral.f5.com/wiki/tmsh.BigpipeMappings.ashx

     

  • One question, how do it fills those arrays? I asked because the display results in tmsh were changed too.