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:
Serphentas
2021-03-18 20:11:25 +01:00
committed by GitHub
parent ac7b4539ce
commit c88ef64169
13 changed files with 560 additions and 0 deletions

View File

@@ -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 [];
}