diff --git a/includes/discovery/storage/freenas-zpool.inc.php b/includes/discovery/storage/freenas-zpool.inc.php index e02ed96e6f..b670a38460 100644 --- a/includes/discovery/storage/freenas-zpool.inc.php +++ b/includes/discovery/storage/freenas-zpool.inc.php @@ -3,20 +3,21 @@ if ($device['os'] == 'truenas') { $zpooltable_array = snmpwalk_cache_oid($device, 'zpoolTable', null, 'FREENAS-MIB'); - $sql = "SELECT `storage_descr` FROM `storage` WHERE `device_id` = '" . $device['device_id'] . "' AND `storage_type` != 'zpool'"; - $tmp_storage = dbFetchColumn($sql); - if (is_array($zpooltable_array)) { foreach ($zpooltable_array as $index => $zpool) { - if (isset($zpool['zpoolDescr'])) { - if (!in_array($zpool['zpoolDescr'], $tmp_storage)) { - $zpool['zpoolIndex'] = $index; - $zpool['zpoolTotal'] = $zpool['zpoolSize'] * $zpool['zpoolAllocationUnits']; - $zpool['zpoolAvail'] = ($zpool['zpoolAvailable'] * $zpool['zpoolAllocationUnits']); - $zpool['zpoolUsed'] = $zpool['zpoolTotal'] - $zpool['zpoolAvail']; + // new devices return a status string at zpoolAllocationUnits (.1.3.6.1.4.1.50536.1.1.1.1.3) and no longer support zpool usage stats + if (is_numeric($zpool['zpoolAllocationUnits'])) { + $units = (int) $zpool['zpoolAllocationUnits']; - discover_storage($valid_storage, $device, $zpool['zpoolIndex'], 'zpool', 'freenas-zpool', $zpool['zpoolDescr'], $zpool['zpoolTotal'], $zpool['zpoolAllocationUnits'], $zpool['zpoolUsed']); - } + discover_storage($valid_storage, $device, + $index, + 'zpool', + 'freenas-zpool', + $zpool['zpoolDescr'], + $zpool['zpoolSize'] * $units, + $units, + $zpool['zpoolUsed'] * $units, + ); } } } diff --git a/includes/polling/storage/freenas-zpool.inc.php b/includes/polling/storage/freenas-zpool.inc.php index 712dafaa21..2b02687d46 100644 --- a/includes/polling/storage/freenas-zpool.inc.php +++ b/includes/polling/storage/freenas-zpool.inc.php @@ -1,13 +1,17 @@