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.