mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Chrony support (#12488)
* initial chrony implementation * remove unused import * add testing data * fix test data * fix tests Co-authored-by: Jellyfrog <Jellyfrog@users.noreply.github.com>
This commit is contained in:
@@ -1634,3 +1634,29 @@ function nfsen_live_dir($hostname)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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_chrony_sources($device_id)
|
||||
{
|
||||
$options = [
|
||||
'filter' => [
|
||||
'type' => ['=', 'chronyd'],
|
||||
],
|
||||
];
|
||||
|
||||
$component = new LibreNMS\Component();
|
||||
$chronyd_cpnt = $component->getComponents($device_id, $options);
|
||||
|
||||
if (isset($chronyd_cpnt[$device_id])) {
|
||||
$id = $component->getFirstComponentID($chronyd_cpnt, $device_id);
|
||||
|
||||
return json_decode($chronyd_cpnt[$device_id][$id]['sources']);
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
Reference in New Issue
Block a user