Storage
banshee/storage-collection/storage/truenas/snmp/core/
pools
The health and the space of each ZFS pool of a TrueNAS CORE by SNMP (FREENAS-MIB).
by banshee1 installation2 versions
v2Latest
Published on October 28, 2026. One naming convention across collections; documentation completed.
// The health and space of each ZFS pool of a TrueNAS CORE, by SNMP (FREENAS-MIB, revision 2020-05-28): the
// layout of TrueNAS CORE 12 and 13 and of TrueNAS SCALE up to 22.12. TrueNAS SCALE 23.10 and later serve
// TRUENAS-MIB, whose pool table has other columns: read it with storage/truenas/snmp/scale/pools.
// The sizes are counted in allocation units, which the agent chooses so that they fit in 32 bits: a size
// in bytes is the count times zpoolAllocationUnits.
need('protocol:snmp');
per('pool', 'Pools');
output('health', 'text', array('label' => 'Health', 'per' => 'pool'));
output('used-percent', 'number', array('label' => 'Used space', 'unit' => '%', 'per' => 'pool'));
output('free', 'number', array('label' => 'Free space', 'unit' => 'GiB', 'per' => 'pool'));
output('size', 'number', array('label' => 'Size', 'unit' => 'GiB', 'per' => 'pool'));
watch.expect('unhealthy', 'Pool not online', 'health', array('warning' => array('online')));
watch.state('failed', 'Pool failed', 'health', array('critical' => array('faulted', 'unavail', 'removed')));
watch.above('used', 'Used space', 'used-percent', array('warning' => 80, 'critical' => 90));
watch.above('full-soon', 'Full within a week', 'used-percent', array('warning' => 99, 'ahead' => '7 d'));
watch.missing('missing', 'Pool missing', 'health', array('enabled' => false));
// FREENAS-MIB, zpoolTable (1.3.6.1.4.1.50536.1.1.1), by zpoolIndex: zpoolDescr, zpoolAllocationUnits,
// zpoolSize, zpoolUsed, zpoolAvailable and zpoolHealth.
$pools = snmp.table(array(
'name' => '1.3.6.1.4.1.50536.1.1.1.1.2',
'units' => '1.3.6.1.4.1.50536.1.1.1.1.3',
'size' => '1.3.6.1.4.1.50536.1.1.1.1.4',
'used' => '1.3.6.1.4.1.50536.1.1.1.1.5',
'available' => '1.3.6.1.4.1.50536.1.1.1.1.6',
'health' => '1.3.6.1.4.1.50536.1.1.1.1.7',
));
// ZPoolHealthType, as zpool status says it.
$healths = array(0 => 'online', 1 => 'degraded', 2 => 'faulted', 3 => 'offline', 4 => 'unavail', 5 => 'removed');
$read = 0;
foreach ($pools as $row) {
if (!list.has($row, 'name')) {
continue;
}
$read = $read + 1;
$name = $row['name'];
value('health', list.get($healths, list.get($row, 'health', ''), 'unknown'), $name);
if (!list.has($row, 'units') || !list.has($row, 'used') || !list.has($row, 'available')) {
continue;
}
// Used over used plus available: what zpool list shows as its capacity.
$used = $row['used'] * $row['units'];
$available = $row['available'] * $row['units'];
if ($used + $available > 0) {
value('used-percent', number.round(100 * $used / ($used + $available), 1), $name);
}
value('free', number.round($available / 1073741824, 1), $name);
value('size', number.round(($used + $available) / 1073741824, 1), $name);
}
if ($read == 0) {
fail('misconfigured', 'The agent serves no pool (zpoolTable, FREENAS-MIB)',
'A TrueNAS SCALE 23.10 or later serves TRUENAS-MIB: use storage/truenas/snmp/scale/pools.');
}