[SNMP4J] snmpset issue
Lorena Galindo
lorena.galindo at peopletelecom.com.au
Thu Jan 3 07:17:08 CET 2008
Hi!
I'm using SNMP4j for an application that is executing the below command
line:
system("/usr/bin/snmpset -v 2c -c sd8954ngLBW $nas
.iso.org.dod.internet.private.enterprises.9.9.150.1.1.3.1.5.$sessiondec
i 1", $retval); Originally, this command line is called from a PHP page.
I've got the following code for executing that command line in java by
using SNMP4j:
public void kickSession(NASSessionTO to, boolean isRedback) throws
Exception
{
OID oid = null;
Snmp snmp = getSnmpInstance();
Target target = getTargetInstance();
target.setAddress(getAddress(to.nasIdentifier));
PDU pdu = createSetPDU(target);
long session_id = Long.parseLong(to.sessionId, 16); // where
to.sessionId is something like 0034C469
oid = new OID(_snmp_base_oid + "." + session_id); // where
_snmp_base_oid is 1.3.6.1.4.1.9.9.150.1.1.3.1.5
pdu.add(new VariableBinding(oid, new Integer32(1)));
//_logger.info("Kicking session ID " + to.sessionId + " for " +
to.username);
System.out.println("Kicking session ID " + to.sessionId + " for " +
to.username);
ResponseEvent re = snmp.send(pdu, target);
PDU response_pdu = re.getResponse();
oid = null;
pdu = null;
if ( response_pdu == null )
{
throw new Exception("Timed-out to " + to.nasIdentifier);
}
Exception e = re.getError();
if ( e != null )
{
throw e;
}
}
Now, I'm trying to do the same but for the below command line:
system("/usr/bin/snmpset -v 2c -c sd8954ngLBW $nas
.1.3.6.1.4.1.2352.2.27.1.1.3.2.0 s $session", $retval);
But I'm getting an exception when I try to create the OID. In this case,
session value is something like FF10FFFF58537D72-477C764F, so I'm not
really sure how to create the OID for this case.
I would appreciate it if anyone can help me to solve my doubt.
Thanks in advance,
Lorena Galindo
More information about the SNMP4J
mailing list