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:
VVelox
2017-12-30 05:42:51 -06:00
committed by Neil Lathwood
parent 0e13e77c5f
commit eaf70e96f6
18 changed files with 858 additions and 1 deletions

View File

@ -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();
}