Forum Discussion
VIP and POOL status using RestAPi
Hello,
Can someone provide me script/url to get virtual server and pool status based on VIP:PORT
3 Replies
- AJ_01_135899
Cirrostratus
I don't know what technology or language you're using to make the calls, but getting all VIP status would use the following URL, using GETs: (use your own values for the $ variables obviously)
https://$ltmname/mgmt/tm/ltm/virtual?ver=12.1.1&expandSubcollections=true
For an individual VIP it it would look something like this:
https://$ltmname/mgmt/tm/ltm/virtual/~$ltmpartitionname~$ltmvipname?ver=12.1.1&expandSubcollections=true
Pool status would be similar but with "pool" instead of "virtual" in the URI.
but how do we get vip name and pool name from the ip
- AJ_01_135899
Cirrostratus
I'm not aware of a way to get this directly from the REST API via a filter, so you'd probably have to get the entire collection then parse it however you see fit.
If you provided the scripting language or technology you're using to make the calls I'm sure someone will throw up a script sample for you. In PowerShell, this would be the basic script example:
$LTM = yourltmname.yourdomain.com Powershell Credential Object $LTMCredentials = Get-Credential Builds the URI string for the Invoke-RestMethod cmdlet $VIPListURI = ("https://$LTM/mgmt/tm/ltm/virtual?ver=12.1.1&expandSubcollections=true") returns the result of Invoke-RestMethod to $vipresult. $vipResult.items contains the array of VIPs $vipResult = Invoke-RestMethod -Method Get -Uri $VIPListURI -Credential $LTMCredentials simple Where-Object filter on destination IP:PORT $vipResult.items | Where-Object -Property "destination" -eq "/partition_name/100.100.100.100:80"This is the sample result data from a single VIP, just for reference.
kind : tm:ltm:virtual:virtualstate name : vip_name partition : partition_name fullPath : /partition_name/vip_name generation : 1 selfLink : https://localhost/mgmt/tm/ltm/virtual/~partition_name~vip_name?ver=12.1.1 addressStatus : yes autoLasthop : default cmpEnabled : yes connectionLimit : 0 destination : /partition_name/100.100.100.100:80 enabled : True gtmScore : 0 ipProtocol : tcp mask : 255.255.255.255 mirror : disabled mobileAppTunnel : disabled nat64 : disabled pool : /partition_name/pool_name poolReference : @{link=https://localhost/mgmt/tm/ltm/pool/~partition_name~pool_name?ver=12.1.1} rateLimit : disabled rateLimitDstMask : 0 rateLimitMode : object rateLimitSrcMask : 0 serviceDownImmediateAction : none source : 0.0.0.0/0 sourceAddressTranslation : @{type=none} sourcePort : preserve synCookieStatus : not-activated translateAddress : enabled translatePort : enabled vlansDisabled : True vsIndex : 37 rules : {/Common/snat_samesubnet_common} rulesReference : {@{link=https://localhost/mgmt/tm/ltm/rule/~Common~snat_samesubnet_common?ver=12.1.1}} policiesReference : @{link=https://localhost/mgmt/tm/ltm/virtual/~partition_name~vip_name_80_uat/policies?ver=12.1.1; isSubcollection=True} profilesReference : @{link=https://localhost/mgmt/tm/ltm/virtual/~partition_name~vip_name_80_uat/profiles?ver=12.1.1; isSubcollection=True; items=System.Object[]}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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