[SNMP4J] time ticks from long
Frank Fock
fock at agentpp.com
Mon Sep 25 22:03:15 CEST 2006
Hi Jose,
I would assume that the value you are trying to assign
is not an unsigned 32bit value (as the exception
notes).
Note: TimeTicks cannot be used to hold the current
time, neither in milli-seconds nor in 1/100 seconds!
Best regards,
Frank
Jose Ignacio wrote:
> Hello, I'm trying to use time ticks for sysUpTime:
>
> long sysUpTime = System.currentTimeMillis() - SNMPAgent.getStartTime();
> TimeTicks tt = new TimeTicks();
> tt.fromMilliseconds(sysUpTime)
> pdu.add(new VariableBinding(SnmpConstants.sysUpTime, tt));
>
> But it return:
>
> java.lang.IllegalArgumentException: Argument must be an unsigned 32bit
> value
> at org.snmp4j.smi.UnsignedInteger32.setValue(UnsignedInteger32.java:148)
> at org.snmp4j.smi.TimeTicks.fromMilliseconds(TimeTicks.java:151)
> at com.telventi.framework.snmp.trap.TrapSender.sendV2(TrapSender.java
> :196)
> at com.telventi.framework.snmp.tiagent.mib.TiSnmpTrap.send(
> TiSnmpTrap.java:109)
> at com.telventi.framework.test.TiSnmpTrapTest.main(TiSnmpTrapTest.java
> :53)
>
> also:
>
> long sysUpTime = System.currentTimeMillis() - SNMPAgent.getStartTime();
> pdu.add(new VariableBinding(SnmpConstants.sysUpTime, new
> TimeTicks(sysUpTime/100)));
>
> But it return a similar exception (IllegalArgumentException)
>
> What's wrong?
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
--
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com
More information about the SNMP4J
mailing list