Forum Discussion
smp_86112
May 15, 2012Cirrostratus
Convert 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?
- smp_86112CirrostratusI have no idea how it works, but I found this post which gave me the answer:
Math::BigInt->new("0x" . unpack("H*", pack("N2", $high, $low)))
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