To operate a device with SNMP, a set of managed information supported by the device, which is usually called a managed object (MO), requires a definition. In SNMP, it is defined as a Management Information Base (MIB). If the device supports SNMP, specify which MIBs are supported in the Feature, and the Manager can collect information based on the MIBs.
In this post, I will briefly look at MIB.
MIB Overview
MIB is a text file written in ASN.1 syntex. Since it is a standard syntex, it can interpret either standard MIB or private MIB.
Taking RFC 1213 (MIB-2) as an example, objects are defined as shown below.
sysUpTime OBJECT-TYPE
SYNTAX TimeTicks
ACCESS read-only
STATUS mandatory
DESCRIPTION
"The time (in hundredths of a second) since the
network management portion of the system was last
re-initialized."
::= { system 3 }
sysContact OBJECT-TYPE
SYNTAX DisplayString (SIZE (0..255))
ACCESS read-write
STATUS mandatory
DESCRIPTION
"The textual identification of the contact person
for this managed node, together with information
on how to contact this person."
::= { system 4 }
SNMP OID
Manager and Agent communicate through SNMP, and when performing GET/SET operation, it is necessary to specify which object to GET/SET to each other. OID value is required for this.
OIDs have a hierarchical structure and have a unique value for all devices worldwide. In the example above, the object called 'sysUpTime' has an OID of 1.3.6.1.2.1.1.3 and is delivered to the SNMP PDU.
You can find out the OID values through RFC 1213,
mib-2 OBJECT IDENTIFIER ::= {mgmt 1}
mgmt is predefined with a value of 1.3.6.1.2. in RFC 1213, and mib-2 has the value of 1 under mgmt.
In other words, mib-2's OID is 1.3.6.1.2.1.
system OBJECT IDENTIFIER ::= {mib-2 1}
system is defined as a value of 1 under mib-2. That is, the OID becomes 1.3.6.1.2.1.1.
sysUpTime ::= {system 3}
sysUpTime is defined as a value of 3 under system. The OID value becomes 1.3.6.1.2.1.1.3.
MIB OID can be defined in two types as follows, depending on its nature.
Scalar: Single value (instance)
Table: Multiple values (instance), index is required.
For Scalar, you can read that value by
adding .0 to the OID.
In the case of a table, there are multiple
values, so an index of the value is required.
(For
example, if there are multiple LAN ports, specify which port information to
read)
Syntex
You can refer to rfc4181 for the guide to
create the MIB, but if you refer to the already created standard MIB, you can
write it without difficulty. Usually, when opening a MIB file with an editor or
using a tool like brower, the following two values are mainly seen.
SYNTEX: You can think of it as Data Type.
ACCESS: read-only, read-write, read-create,
if you can read and write or not.
Comments
Post a Comment