Forum Discussion
Icontrol RestAPI enable/disable multiple pool members/multiple pools
We moved data centers and no longer have CL access to the F5. The only option is Rest API. We need the ability to remove enable or disable multiple servers from multiple pools. The syntax I have is below which is fine for a single server and a single pool. I need the ability to remove multiple servers from multiple pools. Can we reference a text file with members/pools? I am a network admin, not a developer so limited experience.
For example, to disable the pool member test_node:80 for test_pool, enter the following command:
<PATCH> /mgmt/tm/ltm/pool/test_pool_too/members/~Common~test_node:80/ -d '{"session":"user-disabled"}'
- Satoshi_Toyosa1Ret. Employee
You can disable all the pool members that belong to a certain node by disabling the node: e.g.,
curl -sku $PASS https://$HOST/mgmt/tm/ltm/node/<NODE> -X PATCH -H 'Content-type: application/json' -d '{"state":"user-down"}'
If you need to disable individual pool members (e.g., test_node:80 and test_node:443 but not test_node:8080), then you need to write a loop: e.g.,
for member in test_node:80 test_node:443: do curl -sku $PASS https://$HOST/mgmt/tm/ltm/pool/members/$member -X PATCH -H 'Content-type: application/json' -d '{"state":"user-down"}' done
- Chris_OlsonNimbostratus
Thanks, the node idea makes sense. Now, what if I have 20 nodes that need disabling? Do I have to run the script 20 times, one for each node?
- Satoshi_Toyosa1Ret. Employee
Yes, you need to run 20 times (loop).
Another idea is to write a tmsh (or bash) script that disables designated nodes and call that script via iControl REST.
- Chris_OlsonNimbostratus
Ah, thank you. We already have tmsh script which we used to use when we had direct access. I didn't realize we could us iControl REST to call that script. That is probably the way we will go. Thank you so much for your response!
- Satoshi_Toyosa1Ret. Employee
Informational: Calling a tmsh script (equivalent to 'tmsh run cli script callMe' where "callMe" is the name of the script):
curl -sku $PASS https://$HOST/mgmt/tm/cli/script \ -H "Content-type: application/json" -X POST \ -d '{"command":"run", "utilCmdArgs":"callMe"}'
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com