主页 > 网络知识 > snmp Oid整理与运用

snmp Oid整理与运用

管理信息库MIB:任何一个被管理的资源都表示成一个对象,称为被管理的对象。MIB是被管理对象的集合。它定义了被管理对象的一系列属性:对象的名称、对象的访问权限和对象的数据类型等。每个SNMP设备(Agent)都有自己的MIB。MIB也可以看作是NMS(网管系统)和Agent之间的沟通桥梁。

MIB文件中的变量使用的名字取自ISO和ITU管理的对象标识符(objectidentifier)名字空间。它是一种分级树的结构。如图2所示,第一级有三个节点:ccitt、iso、iso-ccitt。低级的对象ID分别由相关组织分配。一个特定对象的标识符可通过由根到该对象的路径获得。一般网络设备取iso节点下的对象内容。如名字空间ip结点下一个名字为ipInReceives的MIB变量被指派数字值3,因而该变量的名字为:iso.org.dod.internet.mgmt.mib.ip.ipInReceives相应的数字表示(对象标识符OID,唯一标识一个MIB对象)为:1.3.6.1.2.1.4.3

MIB树

 

snmp Oid整理与运用

 

ip组

oid: .1.3.6.1.2.1.4

1. ipRouteTable表

oid: .1.3.6.1.2.1.4.21

DEll 没有这个oid

例子:

iso.org.dod.internet.mgmt.mib.ip. ipRouteTable.ipRouteEntry.ipRouteNextHop.202.120.86.71, 1.3.6.1.2.1.4.21.1.7.202.120.86.71 ipRouteEntry IpRouteDest

oid = 1.3.6.1.2.1.4.21.1.1

IP-MIB::ip.21.1.1.0.0.0.0 = IpAddress: 0.0.0.0 IP-MIB::ip.21.1.1.10.10.4.0 = IpAddress: 10.10.4.0 IP-MIB::ip.21.1.1.10.10.4.236 = IpAddress: 10.10.4.236 IP-MIB::ip.21.1.1.10.10.4.255 = IpAddress: 10.10.4.255 IP-MIB::ip.21.1.1.127.0.0.0 = IpAddress: 127.0.0.0 IP-MIB::ip.21.1.1.127.0.0.1 = IpAddress: 127.0.0.1 IP-MIB::ip.21.1.1.127.255.255.255 = IpAddress: 127.255.255.255 IP-MIB::ip.21.1.1.255.255.255.255 = IpAddress: 255.255.255.255 IpRouteNextHop oid = `.1.3.6.1.2.1.4.21.1.7` IP-MIB::ip.21.1.7.0.0.0.0 = IpAddress: 10.10.4.254 IP-MIB::ip.21.1.7.10.10.4.0 = IpAddress: 10.10.4.236 IP-MIB::ip.21.1.7.10.10.4.236 = IpAddress: 127.0.0.1 IP-MIB::ip.21.1.7.10.10.4.255 = IpAddress: 127.0.0.1 IP-MIB::ip.21.1.7.127.0.0.0 = IpAddress:127.0.0.1 IP-MIB::ip.21.1.7.127.0.0.1 = IpAddress: 127.0.0.1 IP-MIB::ip.21.1.7.127.255.255.255 = IpAddress: 127.0.0.1 IP-MIB::ip.21.1.7.255.255.255.255 = IpAddress: 127.0.0.1 IpRouteMask oid = `.1.3.6.1.2.1.4.21.1.11` IP-MIB::ip.21.1.11.0.0.0.0 = IpAddress: 0.0.0.0 IP-MIB::ip.21.1.11.10.10.4.0 = IpAddress: 255.255.255.0 IP-MIB::ip.21.1.11.10.10.4.236 = IpAddress: 255.255.255.255 IP-MIB::ip.21.1.11.10.10.4.255 = IpAddress: 255.255.255.255 IP-MIB::ip.21.1.11.127.0.0.0 = IpAddress: 255.0.0.0 IP-MIB::ip.21.1.11.127.0.0.1 = IpAddress: 255.255.255.255 IP-MIB::ip.21.1.11.127.255.255.255 = IpAddress: 255.255.255.255 IP-MIB::ip.21.1.11.255.255.255.255 = IpAddress: 255.255.255.255 IpRouteType

oid = 1.3.6.1.2.1.4.21.1.8

IP-MIB::ip.21.1.8.0.0.0.0 = INTEGER: 3 IP-MIB::ip.21.1.8.10.10.4.0 = INTEGER: 3 IP-MIB::ip.21.1.8.10.10.4.243 = INTEGER: 3 IP-MIB::ip.21.1.8.10.10.4.255 = INTEGER: 3 IP-MIB::ip.21.1.8.127.0.0.0 = INTEGER: 3 IP-MIB::ip.21.1.8.127.0.0.1 = INTEGER: 3 IP-MIB::ip.21.1.8.127.255.255.255 = INTEGER: 3 IP-MIB::ip.21.1.8.255.255.255.255 = INTEGER: 3 2. ipAddrTable表 3. ipNetToMediaTable表 System组 Interfaces组

.1.3.6.1.2.1.2

ifDescr 端口描述

OID = .1.3.6.1.2.1.2.2.1.2

 

ifSpeed 端口速率

 

 

ifInOctets端口进出流量

 

等等...

oid的使用

以华三V7为例:

qsnmpwalk 10.11.254.1 sysDescr

SNMPv2-MIB::sysDescr.0 = STRING: H3C Comware Platform Software, Software Version 7.1.070, Release 2510P01 H3C S6800-54QT Copyright (c) 2004-2017 New H3C Technologies Co., Ltd. All rights reserved. 查询某个端口下的MAC地址

得到交换机具体端口下的MAC地址。

扫描MAC表(私有MIB)

得到MAC地址与PortInterger的对应关系

qsnmpwalk 10.11.254.1 1.3.6.1.2.1.17.7.1.2.2.1.2

SNMPv2-SMI::mib-2.17.7.1.2.2.1.2.1000.88.105.108.194.51.215 = INTEGER: 1613 SNMPv2-SMI::mib-2.17.7.1.2.2.1.2.1000.88.105.108.194.131.239 = INTEGER: 1613 ... 扫描PortInteger表(私有MIB)

得到PortInterger与IfIndex的对应关系

qsnmpwalk 10.11.254.1 1.3.6.1.2.1.17.1.4.1.2

SNMPv2-SMI::mib-2.17.1.4.1.2.1 = INTEGER: 1 SNMPv2-SMI::mib-2.17.1.4.1.2.2 = INTEGER: 2 ... SNMPv2-SMI::mib-2.17.1.4.1.2.1613 = INTEGER: 1619 扫描ifDescr表

得到IfIndex与ifDescr的对应关系

IF-MIB::ifDescr.1 = STRING: Ten-GigabitEthernet1/0/1 IF-MIB::ifDescr.2 = STRING: Ten-GigabitEthernet1/0/2 ... IF-MIB::ifDescr.1613 = STRING: NULL0 IF-MIB::ifDescr.1619 = STRING: Bridge-Aggregation1

最终对应关系:

Bridge-Aggregation1 - 1619 - 1613 - 一堆mac

 

说点什么吧
  • 全部评论(0
    还没有评论,快来抢沙发吧!