mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* Freenas zpool improvement Don't try to multiply two strings (cast units to int) No need to double fetch database entries to check if it exists. Only poll zpoolUsed to speed up polling * Block zpool usage on new devices, they dropped support. TRUENAS-MIB included for reference * Fix polling, update test data
25 lines
871 B
PHP
25 lines
871 B
PHP
<?php
|
|
|
|
if ($device['os'] == 'truenas') {
|
|
$zpooltable_array = snmpwalk_cache_oid($device, 'zpoolTable', null, 'FREENAS-MIB');
|
|
|
|
if (is_array($zpooltable_array)) {
|
|
foreach ($zpooltable_array as $index => $zpool) {
|
|
// 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,
|
|
$index,
|
|
'zpool',
|
|
'freenas-zpool',
|
|
$zpool['zpoolDescr'],
|
|
$zpool['zpoolSize'] * $units,
|
|
$units,
|
|
$zpool['zpoolUsed'] * $units,
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|