tags:

views:

157

answers:

1

Suppose I'm writing an SNMP v1/2 agent.

Is it mandatory to append the instance number to the variable OIDs in a trap PDU?

In SNMP V1 for instance a trap is defined in RFC 1157, with these fields:

  • Enterprise
  • Agent address
  • Generic trap type
  • Specific trap code
  • Time stamp
  • Variable bindings

The "variable bindings" section consist of a list of variable names and values. According to RFC 1157 :

In general, the name of an SNMP variable is an OBJECT IDENTIFIER of the form x.y, where x is the name of a non-aggregate object type defined in the MIB and y is an OBJECT IDENTIFIER fragment that, in a way specific to the named object type, identifies the desired instance.

What's bothering me is the "In general", is the .y mandatory?

+3  A: 

Yes, it's mandatory to include instance subidentifiers for any variable OIDs in the variable bindings. The paragraph is describing the general (i.e., generic) form for a variable OID, not using "in general" to mean a non-committal "well, it's usually like this, but not always". Later RFCs use more concrete wording:

A variable-binding list is a simple list of variable bindings.

The name of a variable is an OBJECT IDENTIFIER which is the concatenation of the OBJECT IDENTIFIER of the corresponding object- type together with an OBJECT IDENTIFIER fragment identifying the instance. The OBJECT IDENTIFIER of the corresponding object-type is called the OBJECT IDENTIFIER prefix of the variable.

[RFC 3416, section 2.1]

Michael Kirkham
Good to know. We're actually facing several other snmp agents which send traps without providing the instance number and it's causing some trouble. To identify the corresponding instance we'd have to go through all of them and compare with the values in the trap. I feel that's kinda hackish.
f4
It was not an uncommon agent bug 10 - 15 years ago, back when I was doing SNMP compliance testing. Surprising that implementers still get that wrong!I should note, though, that it's not necessary for a VALUE to have instance identifiers if it's not identifying an instance of anything. For example, a linkUp trap in SNMPv2c/v3 is identified by snmpTrapOID.0 = linkUp (1.3.6.1.6.3.1.1.4.1.0 = 1.3.6.1.6.3.1.1.5.4), not linkUp.0. But the OID identifying the variable MUST include instance identifier(s) (always .0 for a scalar).
Michael Kirkham