Forum Discussion

Chris_Olson's avatar
Chris_Olson
Icon for Nimbostratus rankNimbostratus
Jan 08, 2021

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

5 Replies

  • 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
  • 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?

  • 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.

  • 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!

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