我已经用下面的公式配置了带宽利用率,我在 snmpwalk 之后得到的数据。
利用率 = ( ifinOctect * 8 * 100 ) /( ifspeed * delta_time )
现在我想知道这个命令的输出单位是什么。
我已经用下面的公式配置了带宽利用率,我在 snmpwalk 之后得到的数据。
利用率 = ( ifinOctect * 8 * 100 ) /( ifspeed * delta_time )
现在我想知道这个命令的输出单位是什么。
RFC2863定义了 IF-MIB 并对什么ifInOctets和ifSpeed(第 3.1.7 段)有明确的解释:
ifInOctets OBJECT-TYPE
SYNTAX Counter32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The total number of octets received on the interface,
including framing characters. [...]"
但是,我不会ifInOctets在现代设备上使用。由于这些是 32 位计数器,因此在您阅读之前,您面临着计数器换行(达到最大整数)的高风险。当可用时(并且任何现代设备都应该有它)ifHCInOctets更有用,因为它使用 64 位计数器:
ifHCInOctets OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The total number of octets received on the interface,
including framing characters. This object is a 64-bit
version of ifInOctets.
看看你的计算:
您的计算似乎是试图将链接利用率确定为百分比。但是,您描述它的方式不起作用。ifInOctets是接收到的八位字节总数的绝对数。那里没有时间的概念。
要确定链路利用率,您必须进行两次测量(接收数据包的增加)。通过将其除以时间差delta_time,您可以获得测量时间间隔内的平均数据包数/秒。将其乘以 8 以将八位字节转换为位。如果将该结果除以ifSpeed(以位/秒为单位),您将得到一个代表接口利用率的分数。最后将它乘以 100 会给你一个百分比。
因此,如果ifInOctet1和ifInOctet2是两个连续测量time_delta的时间间隔,则计算将是:
Utilization = ((ifInOctet2 - ifInOctet1) * 8 / delta_time) / ifSpeed * 100