Before we got into that, lets see what is SNMP?
Simple Network Management Protocol (SNMP) is an application–layer protocol for exchanging management information between network devices. It is a part of Transmission Control Protocol⁄Internet Protocol (TCP⁄IP) protocol suite.
SNMP is one of the widely accepted protocols to manage and monitor network elements. Most of the professional–grade network elements come with bundled SNMP agent. These agents have to be enabled and configured to communicate with the network management system (NMS).
SNMP consists of
A manager or management system is a separate entity that is responsible to communicate with the SNMP agent implemented network devices. This is typically a computer that is used to run one or more network management systems.
A managed device or the network element is a part of the network that requires some form of monitoring and management e.g. routers, switches, servers, workstations, printers, UPSs, etc…
The agent is a program that is packaged within the network element. Enabling the agent allows it to collect the management information database from the device locally and makes it available to the SNMP manager, when it is queried for. These agents could be standard (e.g. Net-SNMP) or specific to a vendor (e.g. HP insight agent)
Every SNMP agent maintains an information database describing the managed device parameters. The SNMP manager uses this database to request the agent for specific information and further translates the information as needed for the Network Management System (NMS). This commonly shared database between the Agent and the Manager is called Management Information Base (MIB).
In other words, MIB files are the set of questions that a SNMP Manager can ask the agent. Agent collects these data locally and stores it, as defined in the MIB. So, the SNMP Manager should be aware of these standard and private questions for every type of agent.
Management Information Base (MIB) is a collection of Information for managing network element. The MIBs comprises of managed objects identified by the name Object Identifier (Object ID or OID).
A typical object ID will be a dotted list of integers. For example, the OID in RFC1213 for “sysDescr” is .220.127.116.11.18.104.22.168
Now the real question…how to find the SNMP OID corresponds to SNMP Object name in Junos?
For that firstly, we need to find the exact object name
Lets say we have to check the OID corresponding to BGP AS, in this we can either give the command as following:
show snmp mib walk 1 | match bgp
This will be give us number of results however if we already know the object name then we can match that specific name. Currently I don’t know so I just mentioned bgp and it gave me lots of output.
RE-1> show snmp mib walk 1 | match bgp bgpVersion.0 = 10 bgpLocalAs.0 = 65004 bgpPeerIdentifier.10.0.0.241 = 0.0.0.0 bgpPeerIdentifier.10.10.10.10 = 0.0.0.0 bgpPeerIdentifier.10.10.10.14 = 0.0.0.0 bgpPeerIdentifier.10.10.10.18 = 0.0.0.0 bgpPeerIdentifier.10.30.205.2 = 0.0.0.0 bgpPeerIdentifier.10.30.205.6 = 0.0.0.0 . . .
I can see one of the output is bgpLocalAs.0 which is I am after, so lets see how we can get the OID corresponding to it.
RE-1> show snmp mib walk bgpLocalAs | display xml <rpc-reply xmlns:junos="http://xml.juniper.net/junos/15.1F6/junos"> <snmp-object-information xmlns="http://xml.juniper.net/junos/15.1F6/junos-snmp"> <snmp-object> <name>bgpLocalAs.0</name> <object-value-type>number</object-value-type> <object-value>65004</object-value> <oid>22.214.171.124.126.96.36.199.0</oid> </snmp-object> </snmp-object-information> <cli> <banner></banner> </cli> </rpc-reply>
Here it is , so we got the OID and you can use this OID in NMS systems to poll this specific object.