MIB数据类型

本文详细介绍了SMI定义的OID返回的各种数据类型,包括有符号和无符号整数、二进制或文本数据、IP地址、计数器等,并通过Net-SNMP工具返回的数据类型示例说明了这些数据类型的使用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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 Rockwood

IF-MIB::ifPhysAddress.1 = STRING: 0:c0:b7:63:ca:4c

SNMPv2-MIB::sysUpTime.0 = Timeticks: (47372422) 5 days, 11:35:24.22

IF-MIB::ifAdminStatus.1 = INTEGER: up(1)

SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.318.1.3.7

RFC1213-MIB::atPhysAddress.1.1.10.10.1.1 = Hex-STRING: 00 50 73 28 47 A0

RFC1213-MIB::atNetAddress.1.1.10.10.1.1 = Network Address: 0A:0A:01:01

IF-MIB::ifSpeed.1 = Gauge32: 10000000

SNMPv2-MIB::snmpInPkts.0 = Counter32: 316

SNMPv2-MIB::snmpOutPkts.0 = Counter32: 314


This 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找到返回值,并且为我们提供該值的文本表示。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值