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.

相關文章
相關標籤/搜索