公司服務器硬盤是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.