Forum Discussion

James_Waldrop_8's avatar
James_Waldrop_8
Icon for Nimbostratus rankNimbostratus
Sep 18, 2009

Width/size of values?

What width data type are LocalLBPool statistics stored in? I'm getting this from test code:

 

 

| STATISTIC_SERVER_SIDE_BYTES_IN : 1922215810

 

| STATISTIC_SERVER_SIDE_BYTES_OUT : -1151353991

 

| STATISTIC_SERVER_SIDE_PACKETS_IN : 1374173472

 

| STATISTIC_SERVER_SIDE_PACKETS_OUT : -1836436750

 

 

This seems likely to be an overflow error, but I wanted to confirm.

 

 

TIA,

 

James

 

  • icontrol returns 32-bit high and low numbers, which you'll need to convert to a 64-bit number.

    Powershell courtesy of Joe:

     
     function Convert-To64Bit(){ 
       param($high, $low); 
      
       $low = [Convert]::ToString($low,2).PadLeft(32,'0') 
      
       if($low.length -eq "64")    { 
           $low = $low.substring(32,32) 
       } 
       return [Convert]::ToUint64([Convert]::ToString($high,2).PadLeft(32,'0')+$low,2); 
     } 
     

    In python, you can see in this function to get wide IP statistics the same math:

     
     def get_wideip_stats(obj): 
          
             try: 
                     stats = obj.get_all_statistics()['return'] 
          
             except: 
                     "Unable to fetch wideip list or get statistics - check trace log" 
          
             for x in stats['statistics']: 
                     print "WideIP: ", x['wide_ip'] 
                     print "\n"*2 
                     for y in x['statistics']: 
                         value = y.get('value') 
                         high = value.get('high') 
                         low = value.get('low') 
                         value64 = (high<<32)|low 
                         print "\t", y.get('type') , value64 
     

    HTH...Jason

  • Does anyone have sample code for the Java version of this? Java's lack of unsigned long is making me grumpy.

     

     

    James

     

  • Search the forums for java 64-bit if this doesn't help you, as there at least a few examples

     

     

    long myresult_low = (long)(commonstat[5].getValue().getLow());

     

    long myresult_high= (long)(commonstat[5].getValue().getHigh());

     

    long myresult = (long)(commonstat[5].getValue().getHigh()<<32)+(long)(myresult_low);
  • It is a 64 bit unsigned number: http://devcentral.f5.com/wiki/default.aspx/iControl/Common__ULong64.html

     

     

    Here's an article Don wrote on using the method in Java:

     

     

    http://devcentral.f5.com/Default.aspx?tabid=63&articleType=ArticleView&articleId=78 Click here