Home > Mobile >  Add members to F5(BigIP) pool via CURL
Add members to F5(BigIP) pool via CURL

Time:05-12

I am trying to add a member to F5 using the below CURLs. Both of them fail with the error copied below

curl -u<username>:<password> -sk -XPOST -H "Content-type: application/json" -d '{"state": "present", "name": "myapp01", "host": "192.168.98.73", "port": "80", "pool": "deploypool", "partition": "Common", "monitor_state": "yes", "description": "First microservice", "connection_limit": 0, "rate_limit": 0, "ratio": 1}' 'https://192.168.60.50/mgmt/tm/ltm/pool/deploypool/members'
{"code":400,"message":"Found invalid JSON body in the request.","errorStack":[],"apiError":1}


curl -u<username>:<password> -sk -XPOST -H "Content-type: application/json" -d '{"members":[{"state: "present", "name": "myapp01", "host": "192.168.98.73", "port": "80", "pool": "deploypool", "partition": "Common", "monitor_state": "yes", "description": "First microservice", "connection_limit": 0, "rate_limit": 0, "ratio": 1}]}' 'https://192.168.60.50/mgmt/tm/ltm/pool/deploypool'
{"code":400,"message":"Found invalid JSON body in the request.","errorStack":[],"apiError":1}

CodePudding user response:

you're missing closing quotes on state. Any time you get this error, throw your json into a linter to find your issue, like enter image description here

CodePudding user response:

To list node & pool member info

curl -snkw"\n" -H "Content-Type: application/json" -X GET https://<IP_ADDR>/mgmt/tm/ltm/pool/~Common~<pool_name>/members
curl -snkw"\n" -H "Content-Type: application/json" -X GET https://<IP_ADDR>/mgmt/tm/ltm/node

To add a pool member

curl -snkw\n -H Content-Type: application/json -X POST https://<IP_ADDR>/mgmt/tm/ltm/pool/~Common~<pool_name>/members -d {"partition":"Common","name":"<pool_member_name>:8080","address":"<IP_ADDR>"}

To delete a pool member, delete the pool member & node

curl -snkw"\n" -H "Content-Type: application/json" -X DELETE https://<IP_ADDR>/mgmt/tm/ltm/pool/~Common~<pool_name>/members/<pool_member_name>:8080
curl -snkw"\n" -H "Content-Type: application/json" -X DELETE https://<IP_ADDR>/mgmt/tm/ltm/node/<pool_member_name>

Hope this helps those in need

  • Related