For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

vimal1771_20809's avatar
vimal1771_20809
Icon for Nimbostratus rankNimbostratus
Aug 21, 2015

How to get node (server) list from VIP name

What is the curl command to get node list from virtual server name?

 

2 Replies

  • You can get node list:

     tmsh -c 'list ltm virtual  virtual_server_name'  
    `
    
    
    from previuos command you get pool_name, then:
    
    
    ` tmsh -c list 'ltm pool pool_name'
    

    the output will be node list

  • You do indeed need to query the VIP first to get the name of the assigned pool:

    curl -vsk -u 'admin:admin' -H "Content-Type: application/json" -X GET https://x.x.x.x/mgmt/tm/ltm/virtual/my-vs
    

    and then you can query for the pool members:

    curl -vsk -u 'admin:admin' -H "Content-Type: application/json" -X GET https://x.x.x.x/mgmt/tm/ltm/pool/my-pool?expandSubcollections=true
    

    or if you want to get fancy:

    curl -vsk -u 'admin:admin' -H "Content-Type: application/json" -X GET https://x.x.x.x/mgmt/tm/ltm/pool/my-pool?expandSubcollections=true | sed 's/,/\'$'\n/g' | grep name | grep -v my-pool | awk -F"\"" '{ print $4 }'