通过SNMP获取接口速率 32位与64位的区别

  • 首先,接口的速率是指单位时间内数据总量,那么实际在监控时也是通过数据总量这个累计值来计算得出速率,这个累计值MIB中是有自己的名称的。从设计出发点上来讲,咱们通过这个值主要是为了获得速率等信息,但是这个值是个累计值,这就会导致这个值可以无限的增加,大家知道计算机处理数据时是有位长限制的,那么怎么办呢?将这个值清0重新进行计算。这样就有了个最大值,当达到这个值时,就会重新计算,这个值即2^32或2^64。
  • 在MIB中,ifOutOctets和ifInOctets来分别表示接口流出数据量和接口流入数据量,单位是字节。其数据类型为counter32。其能表示最大值为2^32Byte=4GB。
  • ifHCOutOctets和ifHCInOctets也是分别表示接口流出数据量和接口流入数据量其数据类型为counter64,最大值为16EB这个值的概念是如果千兆口满跑4000多年才能达到。
  • 但是如果是counter32位的呢,千兆口满跑32秒即可达到此值。那么这就派生出问题了,如果接口的速率非常高那么用32位的来获取的值很有可能就不准确了。所以大家尽量使用64位的来取值,但前提是系统支持。这个可以通过MIB browser来扫描判断。
  1. IF-MIB:ifInOctets

  2. OID 1.3.6.1.2.1.2.2.1.10

  3. Type Counter32

  4. desc The total number of octets received on the interface , including framing characters. Discontinuities in the value of this counter can occur at re-initialization of the management system , and at other times as indicated by the value of ifCounterDiscontinuityTime.

  5. IF-MIB:ifOutOctets

  6. OID 1.3.6.1.2.1.2.2.1.16

  7. Type Counter32 4.The total number of octets transmitted out of the interface , including framing characters. Discontinuities in the value of this counter can occur at re-initialization of the management system , and at other times as indicated by the value of ifCounterDiscontinuityTime.

  8. IF-MIB:ifHCInOctets 2.OID 1.3.6.1.2.1.31.1.1.1.6

  9. Type Counter64

  10. The total number of octets received on the interface , including framing characters. This object is a 64-bit version of ifInOctets. Discontinuities in the value of this counter can occur at re-initialization of the management system , and at other times as indicated by the value of ifCounterDiscontinuityTime.

  11. IF-MIB:ifHCOutOctets

  12. OID 1.3.6.1.2.1.31.1.1.1.10

  13. Type Counter64

  14. The total number of octets transmitted out of the interface , including framing characters. This object is a 64-bit version of ifOutOctets. Discontinuities in the value of this counter can occur at re-initialization of the management system , and at other times as indicated by the value of ifCounterDiscontinuityTime.

转载于:https://my.oschina.net/taomac/blog/796132

  • 0
    点赞
  • 0
    评论
  • 1
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

表情包
插入表情
评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符
©️2021 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值