mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
It's also possible to do zpool IO from the MIB, but diskIO on LibreNMS makes a lot of assumptions about it coming from the UCD MIB. This changeset adds detection for FreeNAS and TrueNAS - despite having their own enterprise number, the snmpd uses the FreeBSD one. The naming is a bit all over the place, because this reflects reality - IXSystems produce FreeNAS and TrueNAS, the product lines have merged to eliminate FreeNAS, but TrueNAS still calls itself FreeNAS everywhere except the GUI.
22 lines
1012 B
PHP
22 lines
1012 B
PHP
<?php
|
|
|
|
$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'];
|
|
|
|
discover_storage($valid_storage, $device, $zpool['zpoolIndex'], 'zpool', 'freenas-zpool', $zpool['zpoolDescr'], $zpool['zpoolTotal'], $zpool['zpoolAllocationUnits'], $zpool['zpoolUsed']);
|
|
}
|
|
}
|
|
}
|
|
}
|