mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
feature: Added ZFS support for FreeBSD (#7938)
* add the ZFS graphs * And now the ZFS non-graph stuff. Still need to move it over to using JSON. * Now uses JSON. * use stripslashes as SNMPD loves to slash up the JSON * Document ZFS. * very minor formatting cleanup * minor formatting cleanup and remove a bit of code from when I was mucking around debugging it all
This commit is contained in:
@ -128,10 +128,13 @@ function nicecase($item)
|
||||
|
||||
case 'pi-hole':
|
||||
return 'Pi-hole';
|
||||
|
||||
|
||||
case 'freeradius':
|
||||
return 'FreeRADIUS';
|
||||
|
||||
case 'zfs':
|
||||
return 'ZFS';
|
||||
|
||||
default:
|
||||
return ucfirst($item);
|
||||
}
|
||||
@ -1663,3 +1666,28 @@ function generate_stacked_graphs($transparency = '88')
|
||||
return array('transparency' => '', 'stacked' => '-1');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ZFS pools for a device... just requires the device ID
|
||||
* an empty return means ZFS is not in use or there are currently no pools
|
||||
* @param $device_id
|
||||
* @return array
|
||||
*/
|
||||
function get_zfs_pools($device_id)
|
||||
{
|
||||
$options=array(
|
||||
'filter' => array(
|
||||
'type' => array('=', 'zfs'),
|
||||
),
|
||||
);
|
||||
|
||||
$component=new LibreNMS\Component();
|
||||
$zfsc=$component->getComponents($device_id, $options);
|
||||
|
||||
if (isset($zfsc[$device_id])) {
|
||||
$id = $component->getFirstComponentID($zfsc, $device_id);
|
||||
return json_decode($zfsc[$device_id][$id]['pools']);
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
Reference in New Issue
Block a user