title: using int64 type for snmp v2c oid?
body: <p>I am debugging some snmp code for an integer overflow problem. Basically we use an integer to store disk/raid capacity in KB. However when a disk/raid of more than 2TB is used, it'll overflow.</p>
  
  <p>I read from some internet forums that snmp v2c support integer64 or unsigned64. In my test it'll still just send the lower 32 bits even though I have set the type to integer64 or unsigned64. </p>
  
  <p>Here is how I did it:</p>
  
  <ol>
  <li><p>a standalone program will obtain the capacity and write the data to a file. example lines for raid capacity</p>
  
  <pre><code>my-sub-oid
  Counter64
  7813857280
  </code></pre></li>
  <li><p>/etc/snmp/snmpd.conf has a clause to pass thru the oids:</p>
  
  <pre><code>pass_persist mymiboid /path/to/snmpagent
  </code></pre></li>
  <li><p>in the mysnmpagent source, read the oidmap into oid/type/value structure from the file, and print to stdout.</p>
  
  <pre><code>printf("%s\n", it-&gt;first.c_str());
  printf("%s\n", it-&gt;second.type.c_str());
  printf("%s\n", it-&gt;second.value.c_str());
  fflush(stdout);
  </code></pre></li>
  <li><p>use snmpget to get the sub-oid, and it returns:</p>
  
  <pre><code>mysuboid = Counter32: 3518889984
  </code></pre></li>
  <li><p>I use tcpdump and the last segment of the value portion is:</p>
  
  <pre><code>41 0500 d1be 0000
  </code></pre></li>
  </ol>
  
  <p>41 should be the tag, 05 should be the length, and the value is only carrying the lower 32-bit of the capacity. (note 7813857280 is 0x1.d1.be.00.00)</p>
  
  <p>I do find that using string type would send correct value (in octetstring format). But I want to know if there is a way to use 64-bit integer in snmp v2c.</p>
  
  <p>I am running NET-SNMP 5.4.2.1 though.
  thanks a lot.</p>
  
  <p>Update:</p>
  
  <p>Found the following from snmpd.conf regarding pass (and probably also pass_persist) in net-snmp <a href="http://net-snmp.sourceforge.net/docs/man/snmpd.conf.html" rel="nofollow">doc page</a>. I guess it's forcing the Counter64 to Counter32.</p>
  
  <pre><code>Note:
  The SMIv2 type counter64 and SNMPv2 noSuchObject exception are not supported.
  </code></pre>