Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Icontrol RestAPI enable/disable multiple pool members/multiple pools

Chris_Olson
Nimbostratus
Nimbostratus

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"}'

5 REPLIES 5

Satoshi_Toyosa1
F5 Employee
F5 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_Olson
Nimbostratus
Nimbostratus

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_Toyosa1
F5 Employee
F5 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_Olson
Nimbostratus
Nimbostratus

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_Toyosa1
F5 Employee
F5 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"}'