Hi,

I am new to NetSNMP and I tried to build an agentx SNMP agent. I can now walk 
my (simple) MIB and get values back. However for ASN_COUNTER64 I get weird 
values back.

I read the documentation and the list archives, but I can not find what I 
might have done wrong. If somebody can shed light on this issue any help 
would be greatly appreciated.

the value I expect to get is 4242.

snmpget -v 2c -c public localhost totalBalances.0
TRADESCAPE-MIB::totalBalances.0 = Counter64: 18219251269632

this is what my agent logs when compiled for 32bit (i686)
balancemanager: setting value=(0,4242) sizeof(counter)=8 as ASN_COUNTER64

this is what my agent logs when compiled for 64bit (x86_64)
balancemanager: setting value=(0,4242) sizeof(counter)=16 as ASN_COUNTER64


this is a snippet of the code I use in the agent (yes it's C++)

uint64_t value = 4242L;
struct counter64 counter;
counter.high = ((value >> 32) & 0xffff);
counter.low  = ((value)       & 0xffff);
DEBUGMSGTL((
  "balancemanager",
  "setting value=(%d,%d) sizeof(counter)=%d as ASN_COUNTER64\n",
  counter.high,
  counter.low,
  sizeof(counter)
));
snmp_set_var_typed_value(
  p_requests->requestvb,
  ASN_COUNTER64,
  (u_char *) &counter, // a pointer to the scalar's data
  sizeof(counter) // the length of the data in bytes
);

Lothar
-- 
Lothar Werzinger Dipl.-Ing. Univ.
framework & platform architect
Tradescape Inc.
111 West St. John Street, Suite 200
San Jose, Ca 95113
web: http://www.tradescape.biz

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to