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

用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.

你可能感兴趣的:(Linux,snmp,技术文档)