Forum Discussion
Wes_98098
Nimbostratus
Jul 24, 2009iControl.CommonIPPortDefinition
Hello, I have a BIG-IP 9.1.2 Build 40.6 that I'm trying to query with the PowerShell iControls and I'm not sure about the results I'm getting back.
Here are the steps that I have been through:
add-pssnapin icontrolsnapin
Initialize-F5.iControl -hostname ... (I'm getting logged in fine)
$ic = Get-F5.iControl
$objVirtualServers = $ic.LocalLBVirtualServer.get_list()
$objPools = $ic.LocalLBVirtualServer.get_default_pool_name($objVirtualServers[0])
$objPoolMembers = $ic.LocalLBPool.get_member($objPools)
$objPoolMembers
address port
------- ----
192.168.1.101 80
192.168.1.102 80
192.168.1.103 80
192.168.1.104 80
$ic.LocalLBPoolMember.get_object_status($objPools)
member object_status
------ -------------
iControl.CommonIPPortDefinition iControl.LocalLBObjectStatus
iControl.CommonIPPortDefinition iControl.LocalLBObjectStatus
iControl.CommonIPPortDefinition iControl.LocalLBObjectStatus
iControl.CommonIPPortDefinition iControl.LocalLBObjectStatus
$ic.LocalLBPoolMember.get_session_status($objPools)
member session_status
------ --------------
iControl.CommonIPPortDefinition SESSION_STATUS_ADDRESS_DISABLED
iControl.CommonIPPortDefinition SESSION_STATUS_ENABLED
iControl.CommonIPPortDefinition SESSION_STATUS_ENABLED
iControl.CommonIPPortDefinition SESSION_STATUS_ADDRESS_DISABLED
So my question is: Why am I getting results that say "iControl.CommonIPPortDefinition" and "iControl.LocalLBObjectStatus"?
3 Replies
- Let's look at the get_object_status method first. The signature for that method is:
MemberObjectStatus [] [] LocalLB.PoolMember.get_object_status( in String [] pool_names );
The returned value is a 2-D array of MemberObjectStatus structures, one array for each pool_name passed in with the pool_names array.
The MemberObjectStatus structure is defined as follows:struct MemberObjectStatus { IPPortDefinition member; ObjectStatus object_status; }; struct IPPortDefinition { string address; long port; }; struct ObjectStatus { AvailabilityStatus availability_status; EnabledStatus enabled_status; string status_description; };
In your code, you are relying on PowerShell to extract all the sub arrays/structures in it's default table formatting and PS doesn't have the TypeData information abailable to do so. You'll need to store the values in a variable and access the child elements and print them out accordingly.
Look at the CodeShare entry I wrote on PsPoolMemberControl for an example of using that method and interrogating the results:http://devcentral.f5.com/wiki/default.aspx/iControl/PsPoolMemberControl.html
Click here
You would look into the get_session_status output in a similar fashion to get the results for that method.
In the future, if you go into the API reference for the method you have a question about, at the bottom of the page, there are links to relevant sample code that use that method. On the LocalLB.PoolMember.get_object_status pagehttp://devcentral.f5.com/wiki/default.aspx/iControl/LocalLB__PoolMember__get_object_status.html
Click here
there are several PowerShell samples that you can refer to.
Hope this helps and please don't hesitate to post more questions if they come up.
-Joe - Another thing to point out in your example, you are only passing in the first virtual server (array element 0) returned from the get_list method in the get_default_pool_name method. You can pass the entire array in and you will be returned the default_pool names for all of the virtual servers. Just thought I'd point that out...
-Joe - Wes_98098
Nimbostratus
Thanks for the reply, Joe. I'll take a look at the example you posted... Yeah, I only included the first element in the virtual server array here so I could post the exact results I'm getting (instead of the hundreds of lines of results that my entire script is pulling). I'll let you know if I can get my script working.
~wes
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects