snmp对超过16T的磁盘大小识别不对的解决办法

当使用SNMP获取超过16TB的磁盘信息时,由于HR-RESOURCES-MIB中hrStorageSize为32位整型导致计算错误。参考Red Hat的Bugzilla,解决方案是在/etc/snmp/snmpd.conf中添加一行'realStorageUnits 0'。这将使SNMP重新计算大存储驱动器的hrStorageAllocationUnits、hrStorageSize和hrStorageUsed,以确保其乘积反映出真实的存储大小。

用snmp获取磁盘信息的时候,当硬盘大小超过16T,导致HOST-RESOURCES-MIB::hrStorageAllocationUnitsHOST-RESOURCES-MIB::hrStorageSize的值不正确,原因是根据RFC 2790中的定义hrStorageSize是32bit整形,超过了他的表示范围

参考这里:https://bugzilla.redhat.com/show_bug.cgi?id=654384


解决办法就是修改/etc/snmp/snmpd.conf

增加一行

realStorageUnits 0

realStorageUnits默认为1


贴一下解释,直接拷贝的 man snmpd.conf

realStorageUnits
              controlls how the agent reports hrStorageAllocationUnits, hrStorageSize and hrStorageUsed in  hrStorageTable.   With
              this  option  set to ’0’, the agent re-calculates these values for big storage drives with small allocation units so
              hrStorageAllocationUnits x hrStorageSize gives real size of the storage.

              Example:
                     Linux xfs 16TB filesystem with 4096 bytes large blocks will be reported as  hrStorageAllocationUnits  =  8192
                     and hrStorageSize = 2147483647, so 8192 x 2147483647 gives real size of the filesystem (=16 TB).

              Setting  this  directive to ’1’ (=default) turns off this calculation and the agent reports real hrStorageAllocatio-
              nUnits, but it might report wrong hrStorageSize for big drives because the value won’t fit into Integer32.  In  this
              case, hrStorageAllocationUnits x hrStorageSize won’t give real size of the storage.

评论 3
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值