SNMP support large filesystem > 16TB
如何让 SNMP 正确返回超过 16TB 的文件系统
需要 Net-SNMP >= 5.5
在snmpd.conf
中加入以下配置,realStorageUnits 0
详见 https://linux.die.net/man/5/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 hrStorageAllocationUnits, 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.
总就来说就是,默认情况下 SNMP 的 hrStorageAllocationUnits
是真实的 Block size,常见为 4096 bytes
1 | [root@pan ~]# stat -f . |
于是 hrStorageSize
就会超过 Integer32 的最大值