使用SNMP抓取远程服务器磁盘容量信息有误
2014-10-02 07:20
411 查看
公司服务器硬盘是44T,使用snmpwalk抓出来才2T,见下面红色字体
root@CTL-BJ-BJYZ-SER-09:# snmpwalk -v 2c -c ******** .1.3.6.1.4.1.2021.9.1.6
iso.3.6.1.4.1.2021.9.1.6.1 = INTEGER: 226311584
iso.3.6.1.4.1.2021.9.1.6.2 = INTEGER: 0
iso.3.6.1.4.1.2021.9.1.6.3 = INTEGER: 0
iso.3.6.1.4.1.2021.9.1.6.4 = INTEGER: 10240
iso.3.6.1.4.1.2021.9.1.6.5 = INTEGER: 0
iso.3.6.1.4.1.2021.9.1.6.6 = INTEGER: 6608132
iso.3.6.1.4.1.2021.9.1.6.7 = INTEGER: 5120
iso.3.6.1.4.1.2021.9.1.6.8 = INTEGER: 25716020
iso.3.6.1.4.1.2021.9.1.6.9 = INTEGER: 2147483647
使用df -Hl 查看如下:
Filesystem Size Used Avail Use% Mounted on
/dev/sdb 44T 13G 42T 1% /data
通过查询相关资料,当磁盘大于16T时候,会出现此问题。
snmp在制作MIB库时,表的索引项是Integer32类型的,这就造成了错误。
2147483647 = 2^31 (the maximum limit of a signed 32 bit integer (2147483647)),超出此值都会显示为 2147483647 ,SMI定义了一定数量的OID返回的数据类型。其中就有Integer整型,Signed 32bit Integer (values between -2147483648 and 2147483647). 有符号32位整数(值范围: -2147483648 - +2147483648)
此BUGRedhat已经有说明,参见:https://bugzilla.redhat.com/show_bug.cgi?id=654384
文中说的很详细:In new Net-SNMP release it does not wrap at 2^31 but sticks to it if the real value is higher, i.e. reports 2147483647 for all devices bigger than 2 billion of allocation unit (instead of reporting 'size modulo 2^21').
Redhat已经修复此bug,如下:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/5/html/5.7_Technical_Notes/net-snmp.html#RHBA-2011-1076
描述如下:
BZ#654384
Previously, the snmpd daemon strictly implemented RFC 2780. However, this specification no longer scales well with modern big storage devices with small allocation units, and consequently, snmpd reported a wrong value of the HOST-RESOURCES-MIB::hrStorageSize object when working with a large file system (larger than 16TB), because the accurate value would not fit into Integer32 as specified in the RFC. To address this issue, this update adds a new option to the /etc/snmp/snmpd.conf configuration file, realStorageUnits. By changing the value of this option to 0, users can now enable recalculating all values in hrStorageTable to ensure that the multiplication of hrStorageSize and hrStorageAllocationUnits always produces an accurate device size. On the other hand, the values of hrStorageAllocationUnits are artificial and do not represent the real size of the allocation unit on the storage device.
本文出自 “我的《奋斗》” 博客,请务必保留此出处http://wangmukun.blog.51cto.com/651644/1560333
root@CTL-BJ-BJYZ-SER-09:# snmpwalk -v 2c -c ******** .1.3.6.1.4.1.2021.9.1.6
iso.3.6.1.4.1.2021.9.1.6.1 = INTEGER: 226311584
iso.3.6.1.4.1.2021.9.1.6.2 = INTEGER: 0
iso.3.6.1.4.1.2021.9.1.6.3 = INTEGER: 0
iso.3.6.1.4.1.2021.9.1.6.4 = INTEGER: 10240
iso.3.6.1.4.1.2021.9.1.6.5 = INTEGER: 0
iso.3.6.1.4.1.2021.9.1.6.6 = INTEGER: 6608132
iso.3.6.1.4.1.2021.9.1.6.7 = INTEGER: 5120
iso.3.6.1.4.1.2021.9.1.6.8 = INTEGER: 25716020
iso.3.6.1.4.1.2021.9.1.6.9 = INTEGER: 2147483647
使用df -Hl 查看如下:
Filesystem Size Used Avail Use% Mounted on
/dev/sdb 44T 13G 42T 1% /data
通过查询相关资料,当磁盘大于16T时候,会出现此问题。
snmp在制作MIB库时,表的索引项是Integer32类型的,这就造成了错误。
2147483647 = 2^31 (the maximum limit of a signed 32 bit integer (2147483647)),超出此值都会显示为 2147483647 ,SMI定义了一定数量的OID返回的数据类型。其中就有Integer整型,Signed 32bit Integer (values between -2147483648 and 2147483647). 有符号32位整数(值范围: -2147483648 - +2147483648)
此BUGRedhat已经有说明,参见:https://bugzilla.redhat.com/show_bug.cgi?id=654384
文中说的很详细:In new Net-SNMP release it does not wrap at 2^31 but sticks to it if the real value is higher, i.e. reports 2147483647 for all devices bigger than 2 billion of allocation unit (instead of reporting 'size modulo 2^21').
Redhat已经修复此bug,如下:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/5/html/5.7_Technical_Notes/net-snmp.html#RHBA-2011-1076
描述如下:
BZ#654384
Previously, the snmpd daemon strictly implemented RFC 2780. However, this specification no longer scales well with modern big storage devices with small allocation units, and consequently, snmpd reported a wrong value of the HOST-RESOURCES-MIB::hrStorageSize object when working with a large file system (larger than 16TB), because the accurate value would not fit into Integer32 as specified in the RFC. To address this issue, this update adds a new option to the /etc/snmp/snmpd.conf configuration file, realStorageUnits. By changing the value of this option to 0, users can now enable recalculating all values in hrStorageTable to ensure that the multiplication of hrStorageSize and hrStorageAllocationUnits always produces an accurate device size. On the other hand, the values of hrStorageAllocationUnits are artificial and do not represent the real size of the allocation unit on the storage device.
本文出自 “我的《奋斗》” 博客,请务必保留此出处http://wangmukun.blog.51cto.com/651644/1560333
相关文章推荐
- 使用JAVA代码通过SSH访问远程windows,获取磁盘信息
- Mac OS X 使用sshfs挂载Linux远程服务器磁盘
- C#获取本地或远程磁盘使用信息
- php 获取远程服务器信息 get_headers 的使用
- Linux使用nfs映射远程服务器磁盘目录
- C#小伎俩获取本地或远程磁盘使用信息
- Mac OS X 使用sshfs挂载Linux远程服务器磁盘
- 远程采集服务器指标信息(三)通过snmp
- Windows系统中使用WMI获取远程服务器的信息
- 使用nfs映射远程服务器磁盘目录
- C#实现通过程序自动抓取远程Web网页信息
- 使用Java访问LDAP服务器中的数据信息
- C#实现通过程序自动抓取远程Web网页信息
- 使用远程桌面连接Windows2000时报错终端服务器超出了最大允许连接数
- SQL Server使用链接服务器远程取数据
- Sql Server使用链接服务器远程取数据
- C#实现通过程序自动抓取远程Web网页信息
- 关于DateTime在远程服务器使用以及日期与时间格式的问题
- 服务器上出现应用程序错误。此应用程序的当前自定义错误设置禁止远程查看应用程序错误的详细信息(出于安全原因)。
- SQL Server 阻止了对组件 'Ad Hoc Distributed Queries' 的 STATEMENT'OpenRowset/OpenDatasource' 的访问,因为此组件已作为此服务器安全配置的一部分而被关闭。系统管理员可以通过使用 sp_configure 启用 'Ad Hoc Distributed Queries'。有关启用 'Ad Hoc Distributed Queries' 的详细信息