如何将 gauge32 转换为整数?

How do I convert gauge32 to integer?

谁能帮我解决这个问题?我正在尝试监控我的网络设备的湿度,我做了 snmpwalk,它是: snmpget -v2c -cpublic -mALL 172.x.x.x.1.3.6.1.4.1.13742.4.2.x.x.x.x 它说: SNMPv2-SMI::enterprises.13742.4.2.4.1.x.x = Gauge32: 2147483647 那么gauge32是什么意思呢?有什么办法可以将它转换为整数吗?

您尝试轮询的 MIB 对象在 PDU-MIB 中定义,来自 raritan [1]

RelativeHumidity   ::= TEXTUAL-CONVENTION
           DISPLAY-HINT "d"
                   STATUS      current
                   DESCRIPTION
                       "Data type for reporting sensor readings and thresholds
                       associated with humidity sensors. Relative humidity is
                       expressed as percentage and is defined as the ratio of the
                       partial pressure of water vapor in a gaseous mixture of
                       air and water vapor to the saturated vapor pressure of water
                       at a given temperature."
                   SYNTAX Unsigned32 (0..100)

humidity                OBJECT-TYPE
                        SYNTAX        RelativeHumidity
                        MAX-ACCESS    read-only
                        STATUS        current
                        DESCRIPTION
                            "The value of the external humidity sensor reported
                            as relative humidity (a percentage)."
                        ::= { humiditySensorEntry 3 }

所以您的相对湿度应该在 [0..100] 范围内。 可能有两个问题:

  1. NET-SNMP 因某些原因未能正确显示值
  2. SNMP 代理未实现此对象或设备上未安装或禁用湿度传感器