I'm the author of a Nagios plug-in that uses the TrueNAS API to check a TrueNAS server for various kinds of health and status, and it uses the 2.0 API.
https://github.com/StewLG/check_truenas_extended_play
A user/fellow developer has submitted a PR to me that attempts to use the data coming back about the zpools from the /api/v2.0/pool/ API call to work out the used/free capacity for the zpool. It does this by adding up the topology.data.size and topology.data.allocated values for all a zpool's vdevs, and doing a percentage calculation.
This math isn't working out to agree with the TrueNAS GUI, and it's off enough that it's not yet fit for deployment (10-20% off).
Are the topology.data.size and topology.data.allocated values inclusive or exclusive of parity? Do they ignore or include the RaidZ level? How can I get reasonably close to the output I see in zpool_capacity.py, which is just calling 'zpool list -H -o cap'?
https://github.com/StewLG/check_truenas_extended_play
A user/fellow developer has submitted a PR to me that attempts to use the data coming back about the zpools from the /api/v2.0/pool/ API call to work out the used/free capacity for the zpool. It does this by adding up the topology.data.size and topology.data.allocated values for all a zpool's vdevs, and doing a percentage calculation.
This math isn't working out to agree with the TrueNAS GUI, and it's off enough that it's not yet fit for deployment (10-20% off).
Are the topology.data.size and topology.data.allocated values inclusive or exclusive of parity? Do they ignore or include the RaidZ level? How can I get reasonably close to the output I see in zpool_capacity.py, which is just calling 'zpool list -H -o cap'?