class

SNMP::Session

Inherits Reference / Object

Constants

SNMP_TRAP_OID_OID = "1.3.6.1.6.3.1.1.4.1.0"
SYS_UPTIME_OID = "1.3.6.1.2.1.1.3.0"

Standard first two varbinds of an SNMPv2 notification (RFC 3416 4.2.6).

Constructors

new(community : String = "public")
Source

Instance methods

community
Source
community=(community : String)
Source
engine_validation_probe
Source
get(oids : Enumerable(String), request_id = rand(REQUEST_ID_RANGE))

Multi-varbind Get: one GetRequest carrying every OID (RFC 3416 allows a PDU to bind several variables), answered by a single Response with N varbinds.

Source
get(oid, request_id = rand(REQUEST_ID_RANGE))
Source
get_bulk(oids : Enumerable(String), non_repeaters = 0, max_repetitions = 10, request_id = rand(REQUEST_ID_RANGE))

GetBulk (RFC 3416): retrieve up to max_repetitions successors for each repeating varbind in one round-trip. The first non_repeaters OIDs are treated as plain GetNext, the rest as repeaters.

Source
get_next(oids : Enumerable(String), request_id = rand(REQUEST_ID_RANGE))
Source
get_next(oid, request_id = rand(REQUEST_ID_RANGE))
Source
inform(oid, uptime = 0, varbinds : Array(VarBind) = [] of VarBind, request_id = rand(REQUEST_ID_RANGE))

Build an Inform (same shape as a v2 trap, but confirmed by the receiver).

Source
must_revalidate?

Maintain compatibility with V3 session

Source
parse(message : ASN1::BER, security = nil) : SNMP::Message

Decode a v1/v2c message, rejecting a v3 one. The security parameter is accepted for signature parity with V3::Session#parse but is unused here.

Source
prepare(message : Message) : ASN1::BER
Source
reboot
Source
set(values : Hash(String, _), request_id = rand(REQUEST_ID_RANGE))

Multi-varbind Set: one SetRequest assigning every OID => value pair. The Hash keeps insertion order, so the varbinds go out in the order they were given.

Source
set(oid, value, request_id = rand(REQUEST_ID_RANGE))
Source
trap_v1(enterprise, agent_address, generic_trap : GenericTrap, specific_trap = 0, uptime = 0, varbinds : Array(VarBind) = [] of VarBind, request_id = rand(REQUEST_ID_RANGE))

Build an RFC 1157 SNMPv1 Trap (its own wire structure). enterprise is the enterprise OID, agent_address a dotted-quad IPv4 string.

Source
trap_v2(oid, uptime = 0, varbinds : Array(VarBind) = [] of VarBind, request_id = rand(REQUEST_ID_RANGE))

Build an SNMPv2-Trap: sysUpTime.0 + snmpTrapOID.0 followed by varbinds.

Source
update_time
Source
validate(message : ASN1::BER)
Source
validate(message : V3::Message)
Source