SNMP is reporting total disk space as 1TB instead of 2TB
Posted on 2013-05-27
I'm running a FreeNAS server which is on FreeBSD, running the "bsnmpd" daemon for SNMP.
The server is being monitored by a "Centreon Enterprise Server" (CES) server, which checks disk space via SNMP using the "check_centreon_snmp_remote_storage" script.
The problem is the check is coming back showing the "total size" of the disk to be 1024GB, even though the disks are larger than that.
I've confirmed that the Centreon script is working properly. It's the SNMP daemon that is incorrectly reporting the total size of the disk.
Here's an example of the results I see if I use SNMPWALK to examine one of FreeNAS's disks which I know is 3TB in size:
HOST-RESOURCES-MIB::hrStorageDescr.12 = STRING: /mnt/BIGDISK, type: zfs, dev: BIGDISK
HOST-RESOURCES-MIB::hrStorageSize.12 = INTEGER: 2147483647
HOST-RESOURCES-MIB::hrStorageAllocationUnits.12 = INTEGER: 512 Bytes
HOST-RESOURCES-MIB::hrStorageUsed.12 = INTEGER: 1730777472
Doing the math with the AllocationUnits, this translates into 1024GB total size, and 825.3GB used. But that's not correct. My disks are 3TB in size.
This is happening for ALL disks on two different FreeNAS servers which exceed 1TB. Any disks which are LESS than 1TB get reported correctly. Sounds like an integer overflow issue since the number is precisely 2147483647.
I guess this is a problem with bsnmpd, or the libraries inside which are calculating the size of the disk, but is there a way I can go about trying to fix it?