Forum Discussion
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