SNMP: Incorrect values when calculating pool size values

nozzler

Cadet
Joined
Sep 23, 2020
Messages
4
Hi all,

I am attempting to find the cause of my miscalculation when attempting to retrieve the zpool total size, available size, and used size of one of my pools via SNMP. This is only affecting one of my pools.

I am retrieving the values when running:
snmpwalk -v 2c -c [community] [IP of NAS] 1.3.6.1.4.1.50536.1.1


The offending pool values
Pool name:
FREENAS-MIB::zpoolDescr.3 = STRING: pool4
Allocation Units:
FREENAS-MIB::zpoolAllocationUnits.3 = INTEGER: 65536 Bytes
Total size:
FREENAS-MIB::zpoolSize.3 = INTEGER: 1522532352

I am calculating the total bytes by multiplying the zpoolAllocationUnits by zpoolSize.
65536*1522532352 = 99780680220672

Then taking that value and dividing by 1099511627776 to get total TiB:
99780680220672/1099511627776 = 90.75

90.75 is not correct. It should be 67.

Here is an example for available space (to have another data point):
(zpoolAllocationUnits * zpoolAvailable) / 1099511627776 = x
(65536*1211604351)/1099511627776 =72.21

Output of "zfs get" for sanity's sake:
Code:
root@nas1:~ # zfs get all pool4
NAME   PROPERTY              VALUE                  SOURCE
pool4  type                  filesystem             -
pool4  creation              Fri May 15 17:10 2020  -
pool4  used                  14.1T                  -
pool4  available             52.9T                  -



A correct pool value
Pool name:
FREENAS-MIB::zpoolDescr.2 = STRING: pool3
Allocation Units:
FREENAS-MIB::zpoolAllocationUnits.2 = INTEGER: 4096 Bytes
Total size:
FREENAS-MIB::zpoolSize.2 = INTEGER: 973078528

This comes out to 3.625TiB. This is correct!


Something about the oddball zpoolAllocationUnits is messing up the calculation.


System information:
  • Supermicro X9DRD-7LN4F
  • Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
  • 64GB RAM
  • Drive info:
    • "pool4"
      • 10x10TB
      • WD Reds
      • RaidZ2
    • "pool3"
      • 4x2TB
      • WD Gold
      • Raid10
      • 2x300GB SSD ZIL
    • "volume1"
      • 4x1TB
      • Samsung EVO SSD
      • Raid 10
    • "volume2"
      • 4x500GB
      • Samsung EVO SSD
      • Raid 10
  • Controllers: Onboard and 2x LSI 9211-8I
  • NIC: IBM Mellanox ConnectX-2 EN Dual SFP+ 10GigE PCI-e 2.0 x8 81Y1541

Thanks!
 

nozzler

Cadet
Joined
Sep 23, 2020
Messages
4
Can't find an edit button. Here is the version of FreeNAS.
Version: FreeNAS-11.3-U2.1
 

Heracles

Wizard
Joined
Feb 2, 2018
Messages
1,401
The reason is here :

  • pool4"
    • 10x10TB
    • WD Reds
    • RaidZ2
  • "pool3"
    • 4x2TB
    • WD Gold
    • Raid10
    • 2x300GB SSD ZIL
  • "volume1"
    • 4x1TB
    • Samsung EVO SSD
    • Raid 10
  • "volume2"
    • 4x500GB
    • Samsung EVO SSD
    • Raid 10

The only pool for which your trick does not work is RaidZ2. Sometimes, the space is expressed as total space and sometimes, as usable space. In RaidZ2, you need to count some space for parity, something that does not exists with mirrors. The space used for parity exists (total space) but is not usable.
 
Top