[SNMP4J] Error when trying to send a Trap

Mark Stang mstang at pingidentity.com
Tue Jul 10 18:27:12 CEST 2007


Sean,
I am trying to put together a MIB file that snmptrapd will use to translate into "english" language.  Do you have an example somewhere?

thanks,

Mark

Mark J. Stang
Software Engineer
office: +1 303.468.2900
Ping Identity



-----Original Message-----
From: Gibbons, Sean [mailto:Sean.Gibbons at trueposition.com]
Sent: Mon 7/9/2007 6:44 AM
To: Mark Stang
Subject: RE: [SNMP4J] Error when trying to send a Trap
 
A PDUv1 defaults to a cold start trap.  If you want to change the type
of v1 trap you have to do 
PDUv1Object.setGenericTrap( integer )
 
where integer can be:
PDUv1.COLDSTART
PDUv1.ENTERPRISE_SPECIFIC
PDUv1.LINKDOWN
PDUv1.LINKUP
PDUv1.WARMSTART
PDUv1.AUTHENTICATIONFAILURE
 
If you set it to enterprise specific, you then need to to use the
setSpecificTrap(int) method to set what type of trap it is.  Those
numbers should be defined somewhere in the MIB, but as far as I know,
people opt to use v2 traps instead of v1 traps with the trap as an
enterprise specific.

________________________________

From: Mark Stang [mailto:mstang at pingidentity.com] 
Sent: Friday, July 06, 2007 4:45 PM
To: Gibbons, Sean
Subject: RE: [SNMP4J] Error when trying to send a Trap



Sean,
I took your advice and I am generating the v1 Traps:

Jul  6 14:44:09 mstang-lnx snmptrapd[2951]: 2007-07-06 14:44:04
0.0.0.0(via UDP: [127.0.0.1]:-29777) TRAP, SNMP v1, community public
^ISNMPv2-SMI::enterprises.28867.2 Cold Start Trap (0) Uptime: 0:00:00.00
^ISNMPv2-SMI::enterprises.28867.2.3.0 = Timeticks: (49155) 0:08:11.55

My Question is why do I get:

SNMPv2-SMI::enterprises.28867.2 Cold Start Trap (0)

Why does it think it is a Cold Start Trap?

thanks,

Mark

Mark J. Stang
Software Engineer
office: +1 303.468.2900
Ping Identity



-----Original Message-----
From: Gibbons, Sean [mailto:Sean.Gibbons at trueposition.com]
Sent: Thu 7/5/2007 12:00 PM
To: Mark Stang
Subject: RE: [SNMP4J] Error when trying to send a Trap

It's the same sort of deal but there's some differences.  First of all,
a trap will not have a reply coming back, so there's no need to create a
listener for the response.

If you are sending V1 trap, you need to make sure the PDU you create is
a PDUv1.  so here's the code from the javadoc:

PDU pdu = new PDU();
   pdu.add(new VariableBinding(new OID(new int[] {1,3,6,1,2,1,1,1})));
   pdu.add(new VariableBinding(new OID(new int[] {1,3,6,1,2,1,1,2})));
   pdu.setType(PDU.GETNEXT);

You need to do something similar, but slightly different:

PDU pdu = new PDUv1();
pdu.setType(PDU.V1TRAP);
//now you have a v1 PDU, you'll need to set the different values to
specify what type of trap it is, add variable bindings, etc. Check the
PDUv1 javadoc to see what methods are available to you.

 
________________________________

From: Mark Stang [mailto:mstang at pingidentity.com]
Sent: Thursday, July 05, 2007 1:46 PM
To: Gibbons, Sean; snmp4j at agentpp.org
Subject: RE: [SNMP4J] Error when trying to send a Trap



Well, I thought it was code for sending a trap, do you know where there
is sample code on how to send a trap?

thanks,

Mark

Mark J. Stang
Software Engineer
office: +1 303.468.2900
Ping Identity



-----Original Message-----
From: Gibbons, Sean [mailto:Sean.Gibbons at trueposition.com]
Sent: Thu 7/5/2007 11:39 AM
To: Gibbons, Sean; Mark Stang; snmp4j at agentpp.org
Subject: RE: [SNMP4J] Error when trying to send a Trap

Oh yeah, I forgot to add, I don't think you are sending a Trap.  I don't
believe a trap should be getting a response, unless there's an error of
some sort (?).  Looking at the code on in the javadoc you said you were
using you are probably doing a getnext.

-----Original Message-----
From: snmp4j-bounces at agentpp.org [mailto:snmp4j-bounces at agentpp.org] On
Behalf Of Gibbons, Sean
Sent: Thursday, July 05, 2007 1:33 PM
To: Mark Stang; snmp4j at agentpp.org
Subject: RE: [SNMP4J] Error when trying to send a Trap

It should mean the listener is having a problem.  Looking at your code
it is probably because you didn't put in the right OID.

You give the oid as 1.3. 6.1.4.1.28867.2,   which I doubt is a valid
oid.  You note in the comment that it should be .28867.2.2.0 so try:

  pdu.add(new VariableBinding(new OID(new int[]
                    { 1, 3, 6, 1, 4, 1, 28867, 2, 2, 0 }))); //
.28867.2.2.0


________________________________

From: Mark Stang [mailto:mstang at pingidentity.com]
Sent: Thursday, July 05, 2007 1:25 PM
To: Gibbons, Sean; snmp4j at agentpp.org
Subject: RE: [SNMP4J] Error when trying to send a Trap



Thanks for the quick response.

Where is it trying to "get or set the OID"?

Does that mean that it didn't send the Trap or does it mean that the
"listener" had an issue?

thanks,

Mark

Mark J. Stang
Software Engineer
office: +1 303.468.2900
Ping Identity



-----Original Message-----
From: Gibbons, Sean [mailto:Sean.Gibbons at trueposition.com]
Sent: Thu 7/5/2007 11:13 AM
To: Mark Stang; snmp4j at agentpp.org; snmp4j at agentpp.org
Subject: RE: [SNMP4J] Error when trying to send a Trap

"No such name[2]" is reffering to the error type in the message.  2 is
the value for the "no such name" error, meaning the agent was asked to
get or set an OID that it can't find.

-----Original Message-----
From: snmp4j-bounces at agentpp.org [mailto:snmp4j-bounces at agentpp.org] On
Behalf Of Mark Stang
Sent: Thursday, July 05, 2007 1:09 PM
To: snmp4j at agentpp.org; snmp4j at agentpp.org
Subject: [SNMP4J] Error when trying to send a Trap

Hi,
I took the example in the Snmp.html javadoc and tried to adapt it for my
use.  I am trying to send a simple v1 Trap.  If I use the exact code
from the example, it works fine.  Or at least the value printed out by
the listener says that the response is fine.

10:51:43,351 INFO  [STDOUT] Received response PDU is:
RESPONSE[requestID=1644014217, errorStatus=Success(0), errorIndex=0,
VBS[1.3.6.1.2.1.1.2.0 = 1.3.6.1.4.1.8072.3.2.10]]

However, when I try and change the OID to be mine:

                    pdu.add(new VariableBinding(new OID(new int[]
                    { 1, 3, 6, 1, 4, 1, 28867, 2 }))); // .28867.2.2.0


I get this:

11:01:36,410 INFO  [STDOUT] Received response PDU is:
RESPONSE[requestID=1891488794, errorStatus=No such name(2),
errorIndex=1, VBS[1.3.6.1.4.1.28867.2 = Null]]

What does the error mean?  What does it mean "No such name(2)"?

Is there some documentation that explains this?

thanks,

Mark

Mark J. Stang
Software Engineer
office: +1 303.468.2900
Ping Identity
_______________________________________________
SNMP4J mailing list
SNMP4J at agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j


Confidentiality Notice
This e-mail (including any attachments) is intended only for the
recipients named above. It may contain confidential or privileged
information and should not be read, copied or otherwise used by any
other person. If you are not a named recipient, please notify the sender
of that fact and delete the e-mail from your system.








Confidentiality Notice
This e-mail (including any attachments) is intended only for the
recipients named above. It may contain confidential or privileged
information and should not be read, copied or otherwise used by any
other person. If you are not a named recipient, please notify the sender
of that fact and delete the e-mail from your system.

_______________________________________________
SNMP4J mailing list
SNMP4J at agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j


Confidentiality Notice
This e-mail (including any attachments) is intended only for the
recipients named above. It may contain confidential or privileged
information and should not be read, copied or otherwise used by any
other person. If you are not a named recipient, please notify the sender
of that fact and delete the e-mail from your system.






Confidentiality Notice
This e-mail (including any attachments) is intended only for the
recipients named above. It may contain confidential or privileged
information and should not be read, copied or otherwise used by any
other person. If you are not a named recipient, please notify the sender
of that fact and delete the e-mail from your system.







Confidentiality Notice
This e-mail (including any attachments) is intended only for the recipients named above. It may contain confidential or privileged information and should not be read, copied or otherwise used by any other person. If you are not a named recipient, please notify the sender of that fact and delete the e-mail from your system.





More information about the SNMP4J mailing list