SNMP Messages
Introduction
SNMP messages are used for two cases:
-
A unidirectional request from any application to an SNMP application.
-
A request from an SNMP application to any application, with a subsequent response.
-
!SNMP-S-REQUEST
-
!SNMP-S-RESPONSE
-
!SNMP-C-REQUEST
(unidirectional, no response)
Note that these messages begin with the special !
character, and so are treated
as administration messages. They will be passed between applications using the
dedicated administration message FIFO mechanism, and will always be processed before
user-level messages are processed.
!SNMP-S-REQUEST
The !SNMP-S-REQUEST
message is sent by SnmpApp to any application (including itself and the WatchdogApp) when
receiving an external SNMP request addressed to that application.
The attributes of the !SNMP-S-REQUEST
message are:
Field | Type | Description |
---|---|---|
pdu_type |
String | [Required] The RFC 3416 PDU type of the received SNMP message. The only message types sent on by the SnmpApp are:
|
varbinds |
Array of Object | [Required] The variable bindings received from the remote client. May be empty. |
scalars |
Integer | The number of variable bindings to treat as scalars in response (RFC 3416 non-repeaters ). Only present for get-bulk-request messages. |
rows |
Integer | The number of rows to return in response for each non-scalar OID (RFC 3416 max-repetitions ). Only present for get-bulk-request messages. |
Each entry in the varbinds
array contains the following fields:
Field | Type | Description |
---|---|---|
type |
String | [Required] The type of the variable binding value, if any. See below. |
oid |
String | [Required] The (unpacked) OID in dot-notated format. |
oid_hex |
String | [Required] The (unpacked) hexadecimal string for the OID. |
oid_parts |
Array of Integer | [Required] An array of the discrete OID integer parts. |
value |
Varying | The value of the variable binding if present, as received from the remote client. |
Note that the type
for each varbind
entry will be one of the following, based on the internal implementation of RFC 3416:
- RFC 3416
SimpleSyntax
:integer-value
string-value
objectID-value
- RFC 3416
ApplicationSyntax
:ipAddress-value
counter-value
unsigned-integer-value
timeticks-value
big-counter-value
- RFC 3416 non-value indicators:
unSpecified
noSuchObject
noSuchInstance
endOfMibView
Note that the RFC 3416 application-wide syntax arbitrary-value
is not supported.
An example request might be:
{
pdu_type => 'get-request',
varbinds => [
{
oid => '1.3.6.1.2.1.1.3.0',
oid_hex => '2b06010201010300',
oid_parts => [ '1', '3', '6', '1', '2', '1', '1', '3', '0' ],
type => 'integer-value',
value => 0
}
]
}
}
!SNMP-S-RESPONSE
The !SNMP-S-RESPONSE
is returned by an application in response to an inbound !SNMP-S-REQUEST
message.
The attributes of the !SNMP-S-RESPONSE
message are:
Field | Type | Description |
---|---|---|
varbinds |
Array of Object | As for varbinds in SNMP server request message.Ignored when either error_index or error_status is present.(Default: when error_index is 0 , an empty array, otherwise the received variable bindings from the remote client) |
error_index |
Integer | Which variable binding in the request message caused a failure in processing as per RFC 3416. Note that variable bindings are 1-indexed. (Default: 0 ) |
error_status |
Integer | The value to use for the RFC 3416 error-status in the response to the remote client.(Default: 0 ) |
The fields of each entry in the varbinds
(or in an array varbind
) are:
Field | Type | Description |
---|---|---|
oid |
String` | [Required] The OID in dot-notated format. |
type |
String | [Conditional] As for type in the SNMP server request message. If not present, the variable binding will not be sent on the wire. |
value |
Varying | The value to use for the variable binding, if any. (Default: no value for uncountable value types and 0 otherwise) |
Neither oid_hex
nor oid_parts
are used in the response. The OID sent on the wire will be computed from the oid
parameter.
Note that for strict compliance with RFC 3416, for get-request
responses where no match to a local OID was found, the
type
for the variable binding should be noSuchInstance
if a prefix match exists to a local OID and noSuchObject
otherwise.
An example successful response might be:
{
varbinds => [
{
oid => '1.3.6.1.2.1.1.3.0',
type => 'integer-value',
value => 0
}
]
}
An example unsuccessful response might be:
{
error_index => 1,
error_status => 2 # noSuchName
}
Refer to RFC 3416 for further details of how response messages should be constructed.
!SNMP-C-REQUEST
The !SNMP-C-REQUEST
message is sent by any application to an SnmpApp and contains details for an SNMP v3 message to
be sent to an external party.
Note that this message (and its counterpart sent externally) is unidirectional and does not have or expect a response. It is expected that this is used solely for sending SNMP v3 traps.
The attributes of the !SNMP-C-REQUEST
message are:
Field | Type | Description |
---|---|---|
engine_id |
Binary String | [Required] The packed binary string containing the SNMP v3 engine ID of the application sending the message. Used as the context engine ID in outgoing PDUs. |
request_id |
Integer | [Required] The request ID for the PDU. |
timestamp |
Integer | [Required] The epoch value that the message was generated at. |
severity |
String | [Conditional] The human-readable severity of the trap. Required when pdu_type is snmpv2-Trap . |
application |
String | [Conditional] The name of the application that generated the trap. Required when pdu_type is snmpv2-Trap . |
event_id |
String | [Conditional] The trap alarm ID. Required when pdu_type is snmpv2-Trap . |
message |
String | [Conditional] The trap message. Required when pdu_type is snmpv2-Trap . |
pdu_type |
String | The PDU type to send. One of get-request , get-next-request , response , set-request , inform-request , snmpv2-Trap , or report . Note that no responses will be provided.(Default: snmpv2-Trap ) |
context |
String | The SNMP v3 PDU context for the message. (Default: '' , an empty string) |
error_status |
Integer | The SNMP v3 PDU error-status value.(Default: 0 ) |
error_index |
Integer | The SNMP v3 PDU error-index value.(Default: 0 ) |
varbinds |
Array | The array of OID name/value pairs to send in the PDU. (Default: an empty array) |