It was in July that I talked about this topic simply in
this thread with Scott, “Whether MIB documents are mandatory”. I did not
have much time then, so the answer from me was quite simply and it missed a lot
of details. Therefore, now I try to provide more information in this post.
MIB Document Content
I believe everyone that reads an SNMP book before knows that MIB documents
contain manageable object definitions. Simply speaking, you can find what you
can do with the device by analysing the documents carefully.
For example, in SNMPv2-MIB.txt there are several general objects defined,
such as sysLocation. By reading DESCRIPTION sections of their
definitions, you can get an idea what information these objects provide.
sysLocation OBJECT-TYPE
SYNTAX DisplayString (SIZE (0..255))
MAX-ACCESS read-write
STATUS current
DESCRIPTION
"The physical location of this node (e.g., 'telephone
closet, 3rd floor'). If the location is unknown, the
value is the zero-length string."
::= { system 6 }
Basic Usage on Manager Side
On manager side, it is usual to extract numerical forms of OID and use them in source code.
For example, during my first few experiments on SNMP I was the “human MIB parser” who provided the numbers used in source files. #SNMP 0.5 forced a lot of users to follow me because there was no MIB support then.
Variable test = new Variable(new ObjectIdentifier(new uint[] { 1, 3, 6, 1, 2, 1, 1, 1, 0 }));
Variable variable = Manager.Get(VersionCode.V1, new IPEndPoint(IPAddress.Parse(ip), 161), new OctetString("public"), new List() {test}, 5000)[0];
It is rather difficult to understand the source code and maintain the numbers whenever the MIB documents are updated, which is a common case during private MIB development process where nobody can foresee the final document.
So as to make the MIB document alive and let it behaviour like a contract among team members, in later versions of #SNMP, textual OID support is added.
Variable test = new Variable(new ObjectIdentifier("SNMPv2-MIB::sysLocation"));

0 comments:
Post a Comment