SNMP、MIB、OID概念的理解

1.1. SNMP概览
SNMP的基本知识介绍
简单网络管理协议(SNMP-Simple Network Management Protocol) 是一个与网络设备交互的简单方法。该规范是由IETF在1990年五月发布的RFC 1157中定义的。SNMP一般被认为至关难懂,而且过于复杂,其可用的API彷佛在原本很是简单的东西外面封装了大量的东西。如今关于SNMP的书籍又 每每只是把它更加复杂化了,而没有解释清楚。
SNMP对于任何程序设计人员来讲是特别易于理解的。整体的简化可以很好地把这个系统简化。一个网络设备以守护进程的方式运行SNMP代理,该守护进程可以响应来自网络的各类请求信息。该SNMP代理提供大量的对象标识符(OID-Object Identifiers)。一个OID是一个惟一的键值对。该代理存放这些值并让它们可用。一个SNMP管理器(客户)能够向代理查询键值对中的特定信息。从程序员的角度看,这和导入大量的全局变量没有多少区别。SNMP的OID是可读或可写的。尽管向一个SNMP设备写入信息的状况很是少,但它是各类管理应用程序用来控制设备的方法(例如针对交换机的可管理GUI)。SNMP中有一个基本的认证框架,可以让管理员发送公共名来对OID读取或写入的认证。绝大多数的设备使用不安全的公共名 "public" 。 SNMP协议经过UDP端口161和162进行通讯的。
注意,我尚未提到MIB!MIB的重要性被大大地夸大了。刚开始时,MIB显得很是复杂,可是它们其实很是简单。OID是数字的和全局的键值对。一个OID看起来和一个IPv6的地址很象,而且不一样的厂商有不一样的前缀等信息。OID都很是长,使得人们难以记住,或者对他很是感冒。所以,人们就设计了一种将数字OID翻译为人们可读的格式。这种翻译映射被保存在一个被称为 “管理信息基础"(Management Infomation Base) 或MIB的、可传递的无格式文本文件里。使用SNMP或者向SNMP设备查询,你不须要使用MIB,可是,若是没有MIB,你就得猜想你正在查看的数据是 什么。某些状况下,不使用MIB也很是简单,例如查看主机名、磁盘使用率数字,或者端口状态信息。其余状况下,就很是困难了,这个时候使用MIB就很是有 帮助。对于准备编写的应用程序来讲,为了让用户避免稳当安装MIB带来的麻烦,而严格使用数字OID是并非不多见的。安装一个MIB的动做,只是将他放置到你的SNMP客户端应用软件可以搜索到并进行上述翻译映射工做的某个位置而已。
SNMP 能够按照两种方式来使用:轮询和陷阱。轮询就是说你编写一个应用程序可以设置一个发送给一个SNMP代理查看某些值的SNMP GET请求。这种方法很是有用,由于若是该设备响应了请求,你就获得了你须要的信息,若是该设备没有响应请求,你就可以知道存在某些问题。轮询是网络监控 的一种主动形式。另外一方面,SNMP陷阱可以被用来进行被动形式的网络监控。SNMP陷阱是经过配置SNMP设备的代理,让他在某些动做发生时联系另外一个SNMP代理来实现的
备,能够配置为在某些事件发生时发送SNMP陷阱。例如,你能够配置Cisco的IOS在某个独立事件(例如链路断开)发生时,或者在任何定义的陷阱事件发生时,发送SNMP陷阱。(IOS:snmp 服务器开启了链路断开的snmp陷阱)。当陷阱事件发生时,设备中的snmp代理会发送该陷阱到一个预先配置好的一般成为陷阱主机的目标上。陷阱主机会运 行有本身的SNMP代理,该代理可以接受并处理传入的陷阱。这些陷阱的处理由陷阱处理器来完成。陷阱处理器能够用任何语言编写,而且能够经过 STDIN(标准输入)传入的来自发送陷阱的信息。该处理器以后能够根据陷阱进行任何想做的事情,例如发送邮件或者你想要的任何事情。
SNMP被普遍应用在NMS网络管理系统中(Network Management System)。知名的NMS包括BMC的Patrol、CA的Unicenter、Sun Mangegement控制台、IBM的Tivoli Netview、以及全球著名的HP Openview。 NMS的目标是提供一个监控和管理全部开启SNMP功能的设备的单一入口。经过配置你的设备代理来接受写访问,你能够从一个应用程序中处理你的网络环境。 若是你的整个环境围拢NMS解决方案架构你的环境,你就能无限制地控制、查看你的整个网络。尽管Net-SNMP提供了可用来构建你本身的NMS网管系统 的全部工具,咱们不会再进一步讨论关于NMS的话题。不过请记住,若是你认为你的SNMP设备厂商没有提供SNMP代理方面的详细信息,极可能是由于他们 但愿你购买他们的NMS网络管理系统,或者购买可以在另外一个NMS平台上使用的插件。
1.2. SNMP的三大版本
SNMP的经常使用版本有三个:SNMPv一、SNMPv二、SNMPv3
Three different version of SNMP exist: SNMPv1 (RFC’s 1155, 1157, and 1212), SNMPv2c (RFC’s 1901 through 1908), and SNMPv3 (RFC’s 3411 though 3418). The co-existence of all three versions are detailed in RFC 3584.SNMP有三个不一样的版本:SNMPv1(RFC 115五、RFC 115七、RFC 1212),SNMPv2c (RFC 190一、1908)以及 SNMPv3 (RFC 3411 - 3418). RFC 3584中详细说明了这三种版本同时共存方面的信息。
SNMPv1 is the original standard for community based management. SNMPv2 was derived from the SNMPv1 framework but had no message definition, which was later revamped aa SNMPv2c, a community based version of SNMPv2 with a message format similar to SNMPv1. SNMPv2 added several new datatypes (Counter32, Counter64, Gauge32, UInteger32, NsapAdress, and BIT STRING), as well as enhancements to OID tables and the setting of OID values. SNMPv3 is an extensable SNMPv2 framework with a new message format, ACL and security abilities, and remote configuration of SNMP parameters.
SNMPv1是为基于公共管理的初始标准。SNMPv2是SNMPv1框架下衍生出来的,可是没有定义信息,其后修订为SNMPv2c,一个带有于SNMPv1相似信息格式的给予公共管理的版本。SNMPv2添加了几个新的数据类型(Counter3二、Counter6四、Gauge3二、UInteger3二、NsapAdress 以及BIT STRING),以及对OID表和OID值的设置的加强。SNMPv3是一个带有新的信息格式、ACL、安全功能和远处SNMP参数配置的、扩展了SNMPv2框架的版本。
SNMP is based on several other standards including the Abstract Syntax Notation 1 Basic Encoding Rules (ASN.1 BER) which defines the SNMP used Datatypes and the Structure of Management Information (SMI) which details the grammar used by SNMP MIBs. SMI comes in two varieties: SMIv1 (RFC 1155) and SMIv2 (RFC 2578). SMIv1 is now obsolete and should not be used. If you choose to modify MIBs at some point you’ll need to learn SMIv2 and ASN.1 syntax, but otherwise they are interesting but unnecessary to learn.
SNMP是基于几个其余规范的,包括定义给予SNMP的数据类型的ASN.1 BER(Abstract Syntax Notation 1 Basic Encoding Rules), 以及详细描述有SNMP MIB使用的语法的管理信息结构(SMI)。SMIv1目前被独立出来,不该当再被使用。若是你选择修改MIB的某些东西,你须要学习SMIv2和ASN.1语法,不过其余状况下你只须要在兴趣时看看他,而没必要学习他。
To this day, SNMPv1 and SNMPv2c are the most commonly used, however due to the insecurity inherent to these protocols read-only access is typical. In general, don’t bother with SNMPv3 unless you really need the added security features.
如今,SNMPv1和SNMPv2被普遍应用,可是因为这些协议的不安全特性,一般只使用只读访问。一般,除非你确实须要附加安全特性,不然你不须要过多地关注SNMPv3。SNMPv3是具备安全性的通讯协议。
1.3. 本文不涉及的话题
本文中不会涉及如何编写代理、MIB模块等方面的话题。
There are several subject we will not be discussing in this paper. These topics include writing agents or sub-agents, writing MIB modules, trap generation and trap sending, synchronous vs asynchronous SNMP coding, and MIB parsing.
本文中,有几个主题咱们不会讨论。这些主题包括编写代理或子代理,编写MIB模块、陷阱生成以及陷阱发送、同步和一步SNMP代码编写,以及MIB解释器。
Something that scares new or inexperienced coders away from the Net-SNMP documentation is the seemingly constant reference to synchronous and asynchronous applications. Don’t be afraid, thats referring to applications that can’t afford to sit and wait for a response. If your application needs a non-blocking method of handling SNMP traffic, use the asynchronous interface (eg: GUIs, Threads, Forking, etc). Otherwise, just stick with the synchronous interfaces for typical use.
Net-SNMP中关于同步和异步应用程序的文档,经常会把没有经验的编码新手给吓唬住。别担忧,那只是指没法坐等响应的应用程序。若是你的应用程序须要以非阻塞方式处理SNMP数据流,就使用一步接口(例如GUI、线程、forking等)。不然,只须要使用同步接口就能够了。
Lastly, this document addresses the use of Net-SNMP on UNIX systems only. Please refer to the Net-SNMP website for information regarding development on Win32.
本文中的后面会针对Unix系统中使用的问题,请参考Net-SNMP网站了解关于在Win32中开发的信息。

2. MIB和OID
OID(对象标识符),是SNMP代理提供的具备惟一标识的键值。MIB(管理信息基)提供数字化OID到可读文本的映射。
2.1. OID
OID的编写规则和习惯
SNMP OIDs are laid out in a hierarchy forming unique addresses into a tree similar to the DNS hierarchy. Like many other forms of addressing, OIDs can be used in 2 forms: fully qualified and relative (sometimes called ”relevant”).
SNMP OID是用一种按照层次化格式组织的、树状结构中的惟一地址来表示的,它与DNS层次类似。与其余格式的寻址方式类型,OID以两种格式加以应用:全名和先对名(有时称为“相关”)
The fully qualified form starts from the root and moves outward to the individual value on a device. An example of a fully qualified address is:
彻底验证格式从root根开始,而且向外移到某个设备的独立的质上。例如一个完整验证的地址为:
This OID could be rewritten in human readable form as:
该OID可用人们可读的方式重写为:
All fully qualified OIDs will begin with .iso.org.dod.internet.private represented numerically as .1.3.6.1.4. Almost all OIDs will then be followed by enterprises (.1) and a unique number for the vendor as assigned by the Internet Assigned Numbers Authority (IANA). In the example OID 789 represents the vendor ID for the Network Appliance Corporation (NetApp). Everything beyond the vendor ID is based on the vendors implementation and may vary between implementations. Please note the prefixing dot before iso. Similar to the trailing dot in DNS, properly qualified IODs begin with a dot representing the root.
全部彻底验证OID都有 .iso.org.dod.internet.private 开始,数字表达为: .1.3.6.4. 。几乎全部的OID都会跟上企业(.1)和由IANA(互联网编号分配中心分配的)惟一的厂商标号。例如OID 789表示Network Appliance格式的厂商编号( NetApp )。厂商编号后面的是基于厂商实现的功能,而且各不相同。请注意,在iso.前面的 . ` ,与DNS中的后点类似,正确验证的OID是有一个表示根的前缀 `. 开始的。
The complete list of enterprise assignments can be found at the IANA website: http://www.iana.org/assignments/enterprise-numbers
IANA网站上找到企业分配完整的清单 : http://www.iana.org/assignmenets/enterprise-numbers
The relative form of an OID, on the other hand, begins from the enterprises value and leaves all the implied addressing off. So we can use the relative form of the above OID as enterprises.netapp.netapp1.raid.diskSummary.diskSpareCount.0 or numerically as .1.789.1.6.4.8.0 .
OID的相对格式,从企业值开始,略过全部的隐含地址。所以,咱们能够用相对地址 enterprises.netapp.netappl.raid.diskSUmmary.diskSpaceCount.0 来表示上述的OID,或者用数字格式 .1.789.6.4.8.0 .
A common form of writing OIDs is by the name of the MIB and a unique key defined within the MIB. For instance, we could rewrite the above OID into the condensed form NETWORK-APPLIANCE-MIB::diskSpareCount.0 . This condensed form follows the convention of MIB Name::Unique Key.instance. Some keys, while unique, can be represented by multiple instances of that key, and thus all OIDs end with an instance value. This is why you’ll notice that most OIDs end with a .0 .
写OID的经常使用格式是用MIB名称和在MIB中定义的惟一键值。例如,咱们能够用简写的格式重写上述OID:
NETWORK-APPLIANCE-MIB::diskSpareCount.0
MIB中OID的书写格式规则为::MIB Name::惟一键值.instance.
某些惟一键值,可用多个实例表示,这样全部的OID都以实例值结尾。这就是为何你得注意到大多数OID都是以一个 .0 结尾的。

2.2. MIB
MIB介绍
The structure of a MIBs internals are a little strange and foreign at first, but it’s structured well enough that you can poke through it pretty intelligently without really knowing what your doing. The structure of a MIB comes from the Structure of Management Information (SMI) standard detailed in IETF RFC 1155 and 2578. If you choose to modify or write your own MIBs you’ll benefit from understanding SMI before hacking much on MIBs.
MIB的内部结构刚开始时会让人感受有些奇怪和很差理解,不过它的结构很是好,你能够在不懂的状况下一个一个看进去。MIB的结构来源于IETF RFC1155和2578定义的管理信息结构。若是你想要修改或编写本身的MIB,在动手前理解SMI很是有帮助。
Lets look at the header of a MIB to get a better idea of how they work:
为了更好地理解他们是怎样工做的,咱们先来看看MIB的头:
-- PowerNet-MIB {iso org(3) dod(6) internet(1) private(4)
-- enterprises(1) apc(318) }

PowerNet-MIB DEFINITIONS ::= BEGIN

IMPORTS
enterprises, IpAddress, Gauge, TimeTicks FROM RFC1155-SMI
DisplayString FROM RFC1213-MIB
OBJECT-TYPE FROM RFC-1212
TRAP-TYPE FROM RFC-1215;

apc OBJECT IDENTIFIER ::= { enterprises 318 }
products OBJECT IDENTIFIER ::= { apc 1 }
apcmgmt OBJECT IDENTIFIER ::= { apc 2 }

Comments can be inserted into a MIB by prepending them with two dashes. In the header the declaration BEGIN starts off the MIB. Imports can be used to pull information from other MIBs, typically those mandated by the MIB-II standard.
能够用行开头为 -- 的方法在MIB中加入注释
头部用 BEGIN`声明来开始MIB的定义
`Imports 可用来从其余MIB中提取信息,一般用它来提取MIB-II规范要求的内容
The MIB lays out the structure of OID addresses starting from the enterprises value. Here the enterprise value 318 maps to ”apc” (relative address .1.318). Typically then several categories are defined. Here we see 2 categories: products (.1.318.1) and apcmgmt (.1.318.2). Notice that in the curly braces two values are specified, its parent address followed by its address. So the products identifier is parented by the apc identifier which is parented by the enterprises identifier, so on and so forth. This type of categorization and subcategorizing will typically continue on in the header of the MIB for awhile segmenting the available keys into tight subgroupings. By segmenting values out in this way it makes the available keys easier to navigate.
MIB放置从enterprise值开始的OID地 址的结构。在此,enterprise值是318, 对应 "apc" (相对地址为 .1.318)。 一般以后会定义几个类别。注意在花括号间定义的两个值,其父地址后面跟一个它本身的地址。所以产品标识符有apc标识符表示,其父为enterprise 标识符,以此类推。类别和自类别的类型一般跟在MIB头的后面,而且把有用的键值分割为子组。经过分段,各类值分别被列出,这样可用的值更容易浏览。
The real meat of the MIB is in the description of object types. Here’s an example of a integer key:
MIB的真正好处在于对象类型的描述。如下是一个整形键值的例子:程序员

  1. upsBasicOutputStatus OBJECT-TYPEweb

  2. SYNTAX INTEGER {vim

  3.    unknown(1),浏览器

  4.    onLine(2),安全

  5.    onBattery(3),服务器

  6.    onSmartBoost(4),网络

  7.    timedSleeping(5),架构

  8.    softwareBypass(6),app

  9.    off(7),框架

  10.    rebooting(8),

  11.    switchedBypass(9),

  12.    hardwareFailureBypass(10),

  13.    sleepingUntilPowerReturn(11),

  14.    onSmartTrim(12)

  15. }

  16. ACCESS read-only

  17. STATUS mandatory

  18. DESCRIPTION

  19.    "The current state of the UPS. If the UPS is unable

  20.     to determine the state of the UPS this variable is set

  21.     to unknown(1)."

  22. ::= { upsBasicOutput 1 }

复制代码

Here is defined the upsBasicOutputStatus key with a return type of INTEGER. The returned integer maps to one of 12 different return values as listed. Notice that in the MIB a description of the key is provided. These descriptions can be extremely useful in determining which objects can best provide the data you want, especially if you don’t have MIB documentation supplied by the vendor.
在此定义了一个具备整型返回值的upsBasicOutputStatus键值。返回的整型对应到列出的12个不一样的数值中的一个。注意在MIB中,提供了该键值的描述。在肯定那个对象可以提供最好地你须要的数据时,特别有帮助,特别是当厂商没有提供MIB文档的状况下。
Notice also that the last line of the object type description includes the numeric value 1 with upsBasicOutput as the parent. If we follow this parenting backwards in the MIB we’d find that upsBasicOutput has the value 1 and is parented by upsOutput which has the value 4 and is parented by ups which has a value of 1, which is parented by hardware which has a value of 1, which is parented by products with a value of 1 which is parented by apc with a value of 318, which is parented by enterprises with a value of 1. So, if we put all that mapping together we get a relative address for the key upsBasicOutputStatus of .1.318.1.1.1.4.1.1.0. Remember that the trailing .0 represents the first instance of the key. Applications called MIB Browsers can easily parse a MIB and make navigation much quicker than flipping through the file in vim, but don’t be fooled into thinking it’s difficult without such a tool.
注意对象类型描述的最后一行包括有数值1,其父为数字为1的upsBasicOutput。若是咱们按照这个父节点返推,咱们会发现upsBasicOutput的值为1,而且其父节点是值为4的upsOutput, upsOutput的父节点是值为1的ups,upsOutput的父节点是值为1的hardware, hardware的父节点是值为1的products,products的父节点是值为318的apc,apc的父节点的是值为1的enterprise。所以,若是咱们咱们把全部的对应关系合起来,咱们就获得 .1.319.1.1.1.4.1.1.0的upsBasicOutputStatus键值的相对地址。记住末尾的.0表示该键值的第一个实例。MIB浏览器这样的应用程序能够简化MIB解析,它可以比经过vim浏览文件的方式更加快捷地浏览,不过不要觉得没有这样的工具就很是困难了。
So, whats really important to notice here is that the MIB is really just providing us with a road map of the OIDs available on the agent we wish to get values from. A MIB describes both where to find a value and what it returns. We can still interface with a device without the MIB, it’s just much easier when you get a return of ”Up” instead of ”1”. By leveraging the options of the Net- SNMP CLI tools you can decide just how you wish to return output which will be different if your just using the tool from the command line (where ”Up” is preferable) or if your calling the tool from a script (where ”1” is preferable).
所以,在这里真正须要注意的是,MIB其实只是提供给咱们一张咱们想从某个SNMP代理中得到的可用OID的 各类值的地图。一个MIB描述了在哪里找某个值、以及返回结果是什么。咱们能够不用MIB与设备进行交互,只不过在理得到'Up'的返回值,要比‘1’的 返回值要简单的多。经过利用Net-SNMP命令行工具,你能够决定你但愿返回结果的输出样式(这种方式下使用“Up"这样的格式更好),或者你用脚本调 用工具时(这种方式下使用”1“的格式就更好)。

2.3. OID数据类型
SMI定义的OID返回值的数据类型。
SMI defines a fixed number of datatypes which are returned by OIDs. These datatypes include:
SMI定义了必定数量的OID返回的数据类型。这些数据类型包括:
Integer 整型
Signed 32bit Integer (values between -2147483648 and 2147483647). 有符号32位整数(值范围: -2147483648 - +2147483648)
Integer32
Same as Integer. 与Integer相同。
UInteger32
Unsigned 32bit Integer (values between 0 and 4294967295). 无符号32位整数(值范围:0-4294967295).
Octet String
Arbitrary binary or textual data, typically limited to 255 characters in length. 任意二进制或文本数据,一般长度限制在255个字符内。
Object Identifier
An OID. 一个OID。
Bit String
Represents an enumeration of named bits. This is an unsigned datatype. 表示取名的位的枚举。这是一个无符号的数据类型。
IpAddress
An IP address. 一个IP地址。
Counter32
Represents a non-negative integer which monotonically increases until it reaches a maximum value of 32bits-1 (4294967295 dec), when it wraps around and starts increasing again from zero. 表示一个非负的整数(可递增到32位最大值-1),而后恢复并从0开始递增。
Counter64
Same as Counter32 but has a maximum value of 64bits-1. 与Counter32相同,最大值为64位的最大值-1。
Gauge32
Represents an unsigned integer, which may increase or decrease, but shall never exceed a maximum value. 表示无符号整数,可增长或减小,可是不超过最大值。
TimeTicks
Represents an unsigned integer which represents the time, modulo 2ˆ32 (4294967296 dec), in hundredths of a second between two epochs. 表示表明数据的一个无符号整数,2^32取模(4294967296),两个值之间为百分之一秒。
Opaque
Provided solely for backward-compatibility, its no longer used. 提供向下兼容,再也不使用的数据类型
NsapAddress Represents an OSI address as a variable-length OCTET STRING. 表示一个用变长八进制字符窗表示的OSI地址。 Net-SNMP tools will report the datatype when returning an OID unless you otherwise disregard it. As an example of that you’ll see:Net-SNMP工具在返回一个OID时会包括其数据类型,除非你不想要他。如下是一个例子:SNMPv2-MIB::sysContact.0 = STRING: Ben RockwoodIF-MIB::ifPhysAddress.1 = STRING: 0:c0:b7:63:ca:4cSNMPv2-MIB::sysUpTime.0 = Timeticks: (47372422) 5 days, 11:35:24.22IF-MIB::ifAdminStatus.1 = INTEGER: up(1)SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.318.1.3.7RFC1213-MIB::atPhysAddress.1.1.10.10.1.1 = Hex-STRING: 00 50 73 28 47 A0RFC1213-MIB::atNetAddress.1.1.10.10.1.1 = Network Address: 0A:0A:01:01IF-MIB::ifSpeed.1 = Gauge32: 10000000SNMPv2-MIB::snmpInPkts.0 = Counter32: 316SNMPv2-MIB::snmpOutPkts.0 = Counter32: 314This is a fairly typical spread of datatypes returned by Net-SNMP tools. Notice that some values are being automatically interpreted by Net-SNMP, such as the sysUpTime and ifAdminStatus. The MIB was used when these values were returned and Net-SNMP was nice enough to find the return value in the MIB and give us the textual representation of the value.这是一个至关典型的由Net-SNMP工具返回的数据类型表单。注意有些值已经由Net-SNMP自动解释了,好比sysUpTime和ifAdminStatus。这些值返回时使用到MIB,Net-SNMP会在MIBzhong找到返回值,而且为咱们提供该值的文本表示。2.4. MIB II MIB IIIETF RFC 1213 ”defines the second version of the Management Information Base (MIB-II) for use with network management protocols in TCP/IP-based internets.” All SNMP agent and tool distributions should include MIBs that will comply with MIB-II and all devices should at the very least return values that comply with the MIB-II standard.Within the MIB-II standard several OID groups are defined, including:The System Group Basic system identification and information OIDs such as sysDescr, sysContact, sysName, SysLocation, etc. (Reported by Net-SNMP in SNMPv2-MIB) The Interfaces Group Network Interface information such as ifDescr, ifType,ifSpeed, ifAdminStatus, etc. (Reported by Net-SNMP in IF-MIB) The Address Translation Group Address Translation (AT) information mapping Physical to Logical addressing such as atNetAddress, atPhysAddress,etc. (Reported by Net-SNMP in RFC1213-MIB) The IP Group IP stats and settings such as ipInReceives, ipForwarding, ip-InAddrErrors, etc. (Reported by Net-SNMP in IP-MIB) The ICMP Group ICMP stats and settings such as icmpInMsgs, icmpIn-Errors, icmpInRedirects, etc. (Reported by Net-SNMP in IP-MIB) The TCP Group TCP stats and settings such as tcpActiveOpens, tcpPassiveOpens,tcpInErrs, etc. (Reported by Net-SNMP in TCP-MIB) The UDP Group UDP stats and settings such as udpInDatagrams, udpIn-Errors, etc. (Reported by Net-SNMP in UDP-MIB) The EGP Group EGP stats and settings (if the device support EGP) such as egpNeighAs, egpNeighMode, etc (Reported by Net-SNMP in RFC1213-MIB) The Transmission Group Device specific media transmition stats and settings(Reported by Net-SNMP in RFC1213-MIB or your vendor MIB) The SNMP Group SNMP stats and settings such as snmpInPkts, snmp-InASNParseErrs, snmpInTraps, etc. (Reported by Net-SNMP in SNMPv2-MIB) If you do a default walk of an SNMP device the MIB-II data should be returned. All data with the exception of the EGP and Transmission groups are requirements of the standard. For most networking devices such as routers this information is usually sufficient to provide most of the information you could want.2.5. 为Net-SNMP添加MIB 如何为Net-SNMP添加MIB信息Additional MIBs can be added to your Net-SNMP installation by simply copying them into the $(PREFIX)/share/snmp/mibs directory. MIBs should be (re)named to follow the convention (MIB NAME).txt for clarity. You can find the MIBs proper name on the first uncommented line of the MIB (eg: Name- MIB DEFINITIONS ::= BEGIN).For example, if you downloaded MIB for the JetDirect Management Card found on HP LaserJet printers it might have been named something like ”hpjetdirect. mib”. The header of the MIB looks like the following:-- (C) COPYRIGHT HEWLETT-PACKARD COMPANY 1997.-- LaserJet 5Si Printer Model Specific MIB.--LaserJet5Si-MIB DEFINITIONS ::= BEGINThis MIB should be renamed to ”LaserJet5Si-MIB.txt” and copied into the Net-SNMP mibs/ directory.By following this convention it assures greater clarity when utilizing the various MIBs and a consistency with all other installed MIBs.MIBs can be specified by a command line tool using the -m argument or the MIBS environmental variable for libsnmp applications including the PERL module. MIBs can be referenced locally by supplying a proper path (ie: - m ”./MY MIB.txt”) or globally by supplying the MIB name without the .txt suffix (ie: -m ”MY MIB”) if it’s located in the Net-SNMP MIBs directory.

相关文章
相关标签/搜索