Powershell - Get Current Connection for Nodes

Hello,

I’ve been unable to find any posts with solutions to this problem. It’s been asked a few times, but either the question is never answered, or at the very least nobody can provide a way to do this with the PS Snapin’s F5 developed.

Question: How do you query for the Current Connections for a given Node?

The cmdlets Get- and Get- don’t seem to provide this information.

Is there an object associated with ‘Get-’ cmdlet that will allow for this query? I can’t seem to find any documentation for all the objects tied with this cmdlet. I think this might be the route to go, but am having a difficult time finding something for ‘Current Connections’.

I need a Powershell solution for this, not Bash or Python.

Thank you for your help!

If you are running 11.5 or greater (i.e. you can use iControlRest), then you could do something like this to get the info:

Invoke-RestMethod -Method GET -Uri 'https://username:password@bigip/mgmt/tm/ltm/node/stats?$select=addr,curSessions'

That will get you a list of the nodes with stats. You could also do this if you wanted all the stats for all the nodes:

Invoke-RestMethod -Method GET -Uri 'https://username:password@bigip/mgmt/tm/ltm/node/stats'

(where

username:password

is an admin user on the bigip and

bigip

is the hostname or ip of the device)

@michael is there any way to do “current connections” check via chef-cookbook. we are using stick sessions so we have to wait to drain connections and then we can start deployments. my chef-cookbook/ansible playbook capable to disable/enable pool members during deployment. but i wanted to make sure all connections drain away or become ‘0’ before i stop my webapp. Thank you.