Forum Discussion
Fuchan_Tan_3092
Feb 17, 2012Nimbostratus
How to properly construct statsNames?
Hi,
Given the follwing tcl script that create a stats profile:
profile stats my_stats_profile {
defaults from stats
field1 total
field2 winners ...
Mar 02, 2012
Sorry for the delay on the reply, this one slipped by me.
For the statsNames parameter, you will have to declare it as a 2-d array and then allocate the second dimension with the two field values. Something like this should work
// Create a new 2-d array with the first dimension of size 1 (for the single profile)
iControl.LocalLBProfileUserStatisticUserStatisticName[][] statsNames = new iControl.LocalLBProfileUserStatisticUserStatisticName[1][];
// Allocate the 2nd dimension for index 0 to a size of 2 (2 keys for the single profile)
statsNames[0] = new iControl.LocalLBProfileUserStatisticUserStatisticName[2];
statsNames[0][0] = new iControl.LocalLBProfileUserStatisticUserStatisticName();
statsNames[0][0].setStatistic_key(iControl.LocalLBProfileUserStatisticUserStatisticKey.USER_STATISTIC_1);
statsNames[0][0].setStatistic_name(new iControl.LocalLBProfileString());
statsNames[0][0].getStatistic_name().setValue("total");
statsNames[0][0].getStatistic_name().setDefault_flag(false);
statsNames[0][1] = new iControl.LocalLBProfileUserStatisticUserStatisticName();
statsNames[0][1].setStatistic_key(iControl.LocalLBProfileUserStatisticUserStatisticKey.USER_STATISTIC_2);
statsNames[0][1].setStatistic_name(new iControl.LocalLBProfileString());
statsNames[0][0].getStatistic_name().setValue("winners");
statsNames[0][0].getStatistic_name().setDefault_flag(false);
i_interfaces.getLocalLBProfileUserStatistic().set_statistic_name(profile_names, statsNames);
Hope this helps...
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