[SNMP4J] Receiving SNMP response from the server
Frank Fock
fock at agentpp.com
Wed May 26 01:09:12 CEST 2010
Hi,
You need to use the correct USM credentials.
The response you receive is a USM report PDU
which indicates an error. See the RFC 3414
for details.
Best regards,
Frank
On 21.05.2010 13:04, Vishal Sahu wrote:
> Hi,
>
> I am new to SNMP. In my project i have a requirement to send a snmp message
> if there is any exception on the server machine .
> Eg:- email sending failed
>
> I have implemented the code for sending a INFORM to the server if there is
> any exception.
>
>
>
>
> OctetString securityName = new OctetString("MD5DES")
> Address targetAddress = GenericAddress.parse(<some-url>);
> TransportMapping transport = new DefaultUdpTransportMapping();
> Snmp snmp = new Snmp(transport);
> USM usm = new USM(SecurityProtocols.getInstance(), new
> OctetString(MPv3.createLocalEngineID()), 0);
> SecurityModels.getInstance().addSecurityModel(usm);
> transport.listen();
>
>
> OctetString octetStringMD5DESUserPrivPassword = new
> OctetString("MD5DESUserPrivPassword")
>
> UsmUser usmUser = new UsmUser(securityName, null, null, PrivDES.ID,
> octetStringMD5DESUserPrivPassword)
> snmp.getUSM().addUser(securityName,usmUser);
>
> UserTarget target = new UserTarget()
> target.setAddress(targetAddress)
> target.setRetries(1)
> target.setTimeout(5000)
> target.setVersion(SnmpConstants.version3)
> target.setSecurityName(securityName)
>
> PDU pdu = new ScopedPDU();
> pdu.add(new VariableBinding(new OID('1.3.6.1.2.1.2.1')))
> pdu.setType(PDU.INFORM);
>
> ResponseEvent response = snmp.send(pdu, target)
> response.getResponse()
>
>
>
> The code sends the message& receives the response.
> Response is :- REPORT[reqestID=1839467505, errorStatus=0, errorIndex=0,
> VBS[1.3.6.1.6.3.15.1.1.3.0 = 39]]
>
>
> Now i want to do 2 things:-
>
> 1. How to check on snmp server that the request has been received& if
> received then what is the request.
> 2. I want to receive the response(or any string) fron SNMP server. How to do
> that.
>
>
> Any help would be appreciated.
>
>
> Thanks& Regards
> Vishal
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
--
AGENT++
http://www.agentpp.com
http://www.snmp4j.com
http://www.mibexplorer.com
http://www.mibdesigner.com
More information about the SNMP4J
mailing list