博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
snmp之——2交换机MIB库ID和物理端口不对应
阅读量:6761 次
发布时间:2019-06-26

本文共 5968 字,大约阅读时间需要 19 分钟。

交换机MIB库中 MIB字符串对应的中文意思:

ifIndex 端口索引号    ifDescr 端口描述    ifType 端口类型    ifMtu 最大传输包字节数    ifSpeed 端口速度    ifPhysAddress 物理地址    ifOperStatus 操作状态    ifLastChange 上次状态更新时间

与流量相关的MIB字符串对应的中文意思:

ifInOctets 输入字节数         ifOutOctets 输出字节数    ifInUcastPkts 输入非广播包数   ifOutUcastPkts 输出非广播包数    ifInNUcastPkts 输入广播包数    ifOutNUcastPkts 输出广播包数    ifInDiscards 输入包丢弃数      ifOutDiscards 输出包丢弃数    ifInErrors 输入包错误数        ifOutErrors 输出包错误数

如何实现使用SNMP监控交换机端口带宽?

监控交换机端口带宽实际上就是监控端口入流量和出流量信息,若要监控端口流量信息就需要使用ifInOctets和ifOutOctets字符串;具体使用格式如下(手动获取端口流量,其中testPublic是community社区名称):

[root@localhost ~]# snmpwalk -v 2c -c testPublic 172.16.100.1 ifInOctets        IF-MIB::ifInOctets.1 = Counter32: 0        IF-MIB::ifInOctets.2 = Counter32: 0        IF-MIB::ifInOctets.3 = Counter32: 0        IF-MIB::ifInOctets.4 = Counter32: 0        IF-MIB::ifInOctets.6 = Counter32: 1619025492        IF-MIB::ifInOctets.7 = Counter32: 2463331598        IF-MIB::ifInOctets.8 = Counter32: 3630545960        IF-MIB::ifInOctets.9 = Counter32: 2570129655        IF-MIB::ifInOctets.10 = Counter32: 0        IF-MIB::ifInOctets.11 = Counter32: 2308743436        IF-MIB::ifInOctets.12 = Counter32: 401489415        IF-MIB::ifInOctets.13 = Counter32: 0        IF-MIB::ifInOctets.14 = Counter32: 0        IF-MIB::ifInOctets.15 = Counter32: 0        IF-MIB::ifInOctets.16 = Counter32: 1555109398        IF-MIB::ifInOctets.17 = Counter32: 0        IF-MIB::ifInOctets.18 = Counter32: 38671        IF-MIB::ifInOctets.19 = Counter32: 0        IF-MIB::ifInOctets.20 = Counter32: 0        IF-MIB::ifInOctets.21 = Counter32: 0        IF-MIB::ifInOctets.22 = Counter32: 0        IF-MIB::ifInOctets.23 = Counter32: 0        IF-MIB::ifInOctets.24 = Counter32: 0        IF-MIB::ifInOctets.25 = Counter32: 0        IF-MIB::ifInOctets.26 = Counter32: 3644608740        IF-MIB::ifInOctets.27 = Counter32: 0        IF-MIB::ifInOctets.28 = Counter32: 0        IF-MIB::ifInOctets.29 = Counter32: 2397532255        IF-MIB::ifInOctets.30 = Counter32: 0        IF-MIB::ifInOctets.31 = Counter32: 0        IF-MIB::ifInOctets.32 = Counter32: 0        IF-MIB::ifInOctets.33 = Counter32: 0        IF-MIB::ifInOctets.34 = Counter32: 0        IF-MIB::ifInOctets.35 = Counter32: 0        IF-MIB::ifInOctets.36 = Counter32: 0        IF-MIB::ifInOctets.37 = Counter32: 0        IF-MIB::ifInOctets.38 = Counter32: 0        IF-MIB::ifInOctets.39 = Counter32: 0        IF-MIB::ifInOctets.40 = Counter32: 0        IF-MIB::ifInOctets.41 = Counter32: 0        IF-MIB::ifInOctets.42 = Counter32: 0        IF-MIB::ifInOctets.43 = Counter32: 4082357090        IF-MIB::ifInOctets.44 = Counter32: 1905708319        IF-MIB::ifInOctets.45 = Counter32: 0        IF-MIB::ifInOctets.46 = Counter32: 0        IF-MIB::ifInOctets.47 = Counter32: 0        IF-MIB::ifInOctets.48 = Counter32: 0        IF-MIB::ifInOctets.49 = Counter32: 0        IF-MIB::ifInOctets.50 = Counter32: 0        IF-MIB::ifInOctets.51 = Counter32: 2710232851        IF-MIB::ifInOctets.52 = Counter32: 0

从上面可以看到,可以获取到52个接口的信息。那么,这就结束了?当然不是,实际上按照这个接口信息去统计流量信息是不正确的;因为这个交换机只有24个ethernet接口,8个光口,也就是说这个交换机实际的物理接口总共32个。但现在得到的接口却是52个,明显不正确。这种情况下该如何判断使用snmpwalk命令得到的接口相对应的物理接口是哪个?

这个时候可以使用ifDescr进行查看然后与上面的比对就可以知道了,具体用法如下(其中testPublic是community社区名称):

[root@localhost ~]# snmpwalk -v 2c -c testPublic 172.16.100.1 ifDescr    IF-MIB::ifDescr.1 = STRING: InLoopBack0    IF-MIB::ifDescr.2 = STRING: NULL0    IF-MIB::ifDescr.3 = STRING: Console9/0/0    IF-MIB::ifDescr.4 = STRING: MEth0/0/1    IF-MIB::ifDescr.6 = STRING: GigabitEthernet0/0/1    IF-MIB::ifDescr.7 = STRING: GigabitEthernet0/0/2    IF-MIB::ifDescr.8 = STRING: GigabitEthernet0/0/3    IF-MIB::ifDescr.9 = STRING: GigabitEthernet0/0/4    IF-MIB::ifDescr.10 = STRING: GigabitEthernet0/0/5    IF-MIB::ifDescr.11 = STRING: GigabitEthernet0/0/6    IF-MIB::ifDescr.12 = STRING: GigabitEthernet0/0/7    IF-MIB::ifDescr.13 = STRING: GigabitEthernet0/0/8    IF-MIB::ifDescr.14 = STRING: GigabitEthernet0/0/9    IF-MIB::ifDescr.15 = STRING: GigabitEthernet0/0/10    IF-MIB::ifDescr.16 = STRING: GigabitEthernet0/0/11    IF-MIB::ifDescr.17 = STRING: GigabitEthernet0/0/12    IF-MIB::ifDescr.18 = STRING: GigabitEthernet0/0/13    IF-MIB::ifDescr.19 = STRING: GigabitEthernet0/0/14    IF-MIB::ifDescr.20 = STRING: GigabitEthernet0/0/15    IF-MIB::ifDescr.21 = STRING: GigabitEthernet0/0/16    IF-MIB::ifDescr.22 = STRING: GigabitEthernet0/0/17    IF-MIB::ifDescr.23 = STRING: GigabitEthernet0/0/18    IF-MIB::ifDescr.24 = STRING: GigabitEthernet0/0/19    IF-MIB::ifDescr.25 = STRING: GigabitEthernet0/0/20    IF-MIB::ifDescr.26 = STRING: GigabitEthernet0/0/21    IF-MIB::ifDescr.27 = STRING: GigabitEthernet0/0/22    IF-MIB::ifDescr.28 = STRING: GigabitEthernet0/0/23    IF-MIB::ifDescr.29 = STRING: GigabitEthernet0/0/24    IF-MIB::ifDescr.30 = STRING: GigabitEthernet0/0/25    IF-MIB::ifDescr.31 = STRING: GigabitEthernet0/0/26    IF-MIB::ifDescr.32 = STRING: GigabitEthernet0/0/27    IF-MIB::ifDescr.33 = STRING: GigabitEthernet0/0/28    IF-MIB::ifDescr.34 = STRING: GigabitEthernet0/0/29    IF-MIB::ifDescr.35 = STRING: GigabitEthernet0/0/30    IF-MIB::ifDescr.36 = STRING: GigabitEthernet0/0/31    IF-MIB::ifDescr.37 = STRING: GigabitEthernet0/0/32    IF-MIB::ifDescr.38 = STRING: Vlanif10    IF-MIB::ifDescr.39 = STRING: Vlanif20    IF-MIB::ifDescr.40 = STRING: Vlanif30    IF-MIB::ifDescr.41 = STRING: Vlanif40    IF-MIB::ifDescr.42 = STRING: Vlanif100    IF-MIB::ifDescr.43 = STRING: Eth-Trunk1    IF-MIB::ifDescr.44 = STRING: Eth-Trunk2    IF-MIB::ifDescr.45 = STRING: Vlanif200    IF-MIB::ifDescr.46 = STRING: Vlanif21    IF-MIB::ifDescr.47 = STRING: Vlanif22    IF-MIB::ifDescr.48 = STRING: Vlanif201    IF-MIB::ifDescr.49 = STRING: Vlanif202    IF-MIB::ifDescr.50 = STRING: Vlanif23    IF-MIB::ifDescr.51 = STRING: Eth-Trunk3    IF-MIB::ifDescr.52 = STRING: Vlanif66

可以看到有32个GigabitEthernet接口,8个光口也显示为GigabitEthernet的原因是这8个光口没有安装光模块,因此暂时显示为GigabitEthernet接口。

本文转自 f_066 51CTO博客,原文链接:http://blog.51cto.com/ganmu/2043635,如需转载请自行联系原作者

你可能感兴趣的文章
Google C++单元测试框架(Gtest)系列教程之二——断言、函数测试
查看>>
Apex Design Patterns
查看>>
windows、linux创建子进程
查看>>
I.MX6 DNS 查看、修改方法
查看>>
供应链是什么意思
查看>>
HTML5的学习资料(开发设计原则)
查看>>
应用程序栏【WP7学习札记之九】
查看>>
utf-8引发的页面空白
查看>>
Controller的要求
查看>>
(转) Android中shape的使用
查看>>
制作WinPE
查看>>
mysql中文字段排序( 按拼音首字母排序)的查询语句
查看>>
[置顶] 某大型银行深化系统技术方案之九:核心层之流程数据管理
查看>>
MVC把随机产生的字符串转换为图片
查看>>
《OOC》笔记(0)——为何要看这本书
查看>>
User mode Linux
查看>>
SQL Server2016 原生支持JSON
查看>>
LINUX 性能工具使用
查看>>
Atitit.Hibernate于Criteria 使用汇总and 关系查询 and 按照子对象查询 o9o
查看>>
android: Android Notification
查看>>