[SNMP4J] To plot bits/sec data rate using SNMP4J Agent

Asha Ambika Vijayakumaran asha_a_v at yahoo.com
Mon Jul 24 19:13:27 CEST 2006


Hi team,

 

I want to sample the packets rate from a remote machine.My snmp4jagent is
running on this remote machine.

But I am using testagent to get this information from agent.

but i need help how to convert the response into bits/sec?

Is snmpInPkts have both send/received packets information?
How can i plot bits/sec rate using the API. Please help.




 

I have made the test agent in SNMP4JAgent like below to receive the packets
using SnmpConstants.snmpInPkts



 

private ResponseListener listener = new ResponseListener() {
VariableBinding varbind = null;
Variable var = null;
Object value = null;
public void onResponse(ResponseEvent event) {
// Always cancel async request when response has been received
// otherwise a memory leak is created! Not canceling a request
// immediately can be useful when sending a request to a broadcast
// address.
((Snmp) event.getSource()).cancel(event.getRequest(), this);
System.out.println("Received response PDU is: " + event.getResponse());
PDU rpdu = event.getResponse();

- Ignored:

if (rpdu != null) {
varbind = rpdu.get(0);
OID oid = varbind.getOid();
if (oid.equals(SnmpConstants.snmpInPkts)) {
var = varbind.getVariable();

System.out.println("packets.....asha.... = " + var);
}

}
else {
System.out.println("PDU timed out");
}
synchronized (snmp) {
snmp.notifyAll();
}

}


Thanks,
Asha

 

 

 

 

 

 

 Asha.A.V

Software Engineer

SatPath Systems Inc.

46661,Fremont blvd.

Fremont.CA.

 

 




More information about the SNMP4J mailing list