Forum Discussion
smp_86112
Cirrostratus
May 15, 2012Convert negative statistic value to positive bits?
Using Perl/iControl 10.2.0, I am trying to reconstruct the same Statistics output that is shown in the LTM GUI. I have successfully obtained the statistics with the get_statistics method. But some of the statistics return a negative value for some reason I can't figure out. For example, the
STATISTIC_CLIENT_SIDE_BYTES_OUT statistic has a Low value of -60548310. Yet in the LTM GUI, the value if Bits (Out) is 102594828624.
In practice, I have found that multiplying the Low value by 8 is a reliable conversion method when the statistic is not negative. Can someone provide some insight into how I can reliably convert a negative STATISTIC_CLIENT_SIDE_BYTES_OUT statistic value into a positive Bits value?
1 Reply
- smp_86112
Cirrostratus
I have no idea how it works, but I found this post which gave me the answer:
https://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/51/aft/1144711/showtab/groupforums/Default.aspx
I have to get both the high and low value of the statistic, and feed it to this method. Multiply the return value by 8, and it gives me the value I want:Math::BigInt->new("0x" . unpack("H*", pack("N2", $high, $low)))
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
