If you are going to stop/start pool members (nodes) directly on the BIG-IP, you can use the TMSH commands within the script. In this case:
Force Node Offline: >tmsh modify /ltm node <nodename> state user-down session user-disabled - This will prevent new connections from occuring but will not drop existing connections (will not drain)
Delete Existing Connections: >tmsh delete /sys connection ss-server-addr <nodeIP> - This will force-drain any existing connections from the node (something to do after you force offline and there are persistent connections preventing maintenance)
Enable Node:>tmsh modify /ltm node <nodename> state user-up session user-enabled - This will return the node to accepting traffic from any disabled state.
After changing a configuration you'll want to tmsh save /sys config.
If you want to manage these attributes remotely, you can use the iControlREST API via curl or if you want, there's a python SDK available to make use of REST commands within your py scripts.
Here are the available BIG-IP TMSH commands you can use within your script (DevCentral login required) and here is how to use the BIG-IP iControlREST API. I use this one myself so I can run simple scripts remotely to manage common objects. Here are the BIG-IP iControlREST commands specific to node management (again, DevCentral login required).
If you are going to stop/start pool members (nodes) directly on the BIG-IP, you can use the TMSH commands within the script. In this case:
Force Node Offline:
>tmsh modify /ltm node <nodename> state user-down session user-disabled
- This will prevent new connections from occuring but will not drop existing connections (will not drain)Delete Existing Connections:
>tmsh delete /sys connection ss-server-addr <nodeIP>
- This will force-drain any existing connections from the node (something to do after you force offline and there are persistent connections preventing maintenance)Enable Node:
>tmsh modify /ltm node <nodename> state user-up session user-enabled
- This will return the node to accepting traffic from any disabled state.After changing a configuration you'll want to
tmsh save /sys config
.If you want to manage these attributes remotely, you can use the iControlREST API via curl or if you want, there's a python SDK available to make use of REST commands within your py scripts.
Curl example:
>curl -sk -u XXXXX:XXXX https://bigp_ip_addr/mgmt/tm/ltm/node/~Common~NODE/ -H "Content-Type: application/json" -X PUT -d '{"state": "user-down", "session": "user-disabled"}'
Here are the available BIG-IP TMSH commands you can use within your script (DevCentral login required) and here is how to use the BIG-IP iControlREST API. I use this one myself so I can run simple scripts remotely to manage common objects. Here are the BIG-IP iControlREST commands specific to node management (again, DevCentral login required).
Hope this gets you where you need to be.