Forum Discussion
patrickmamaid_1
Nimbostratus
Dec 05, 2008number of tcp connections on a pool member
Does anyone know how to get the number of tcp connections on a pool member using iControl in java?
i'm lost in the API trying to find out
Dec 08, 2008
Oops, forgot that Axis1 has no direct conversion from the PortType class. You'll need to create local variables for the *PortType classes to make the method calls.
Here's some code that will take a bigip, it's credentials, as well as a pool name and then enumerate through all pool members for their statistics and print it all to the console.
public void GetPoolMemberStats(String bigip, String username, String password, String pool_name)
throws RemoteException, java.lang.Exception {
iControl.Interfaces interfaces = new iControl.Interfaces();
if (interfaces.initialize(bigip, (long)443, username, password) ) {
String [] pool_list = new String[] {pool_name};
iControl.LocalLBPoolMemberPortType t = interfaces.getLocalLBPoolMember();
iControl.LocalLBPoolMemberMemberStatistics [] memberStatsA =
t.get_all_statistics(pool_list);
for(int i=0; i {
System.out.println("Pool " + pool_list[ i ]);
iControl.LocalLBPoolMemberMemberStatisticEntry [] statEntryA = memberStatsA[ i ].getStatistics();
for(int j=0; j {
iControl.CommonIPPortDefinition memberDef = statEntryA[j].getMember();
System.out.println("+ " + memberDef.getAddress() +
memberDef.getPort());
iControl.CommonStatistic[] statisticsA =
statEntryA[j].getStatistics();
for(int k=0; k {
iControl.CommonStatisticType type = statisticsA[k].getType();
iControl.CommonULong64 ul64 = statisticsA[k].getValue();
long value = (long)(ul64.getHigh()<<32) + (long)ul64.getLow();
System.out.println(" " + type.toString() + " -> " + value);
}
}
}
}
}
If you need to request a specific pool member, you can go this route and just filter out the other ones, or you could call the get_statistics() method instead of the get_all_statistics() method and pass in a second parameter that is a 2-d array with the first dimension for each requested pool, and a second dimension for the list of pool members for each respective pool.
Hope this helps and please post if you get stuck again.
-Joe
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
