Add ability to fetch oxidized device config via the librenms API (#10913)

* Add get_oxidized_config api route

* Add "get_oxidized_config" function.

* add get_oxidized_config docs and fix typo in the search_oxidized docs.
This commit is contained in:
theochita
2019-12-08 19:04:53 +00:00
committed by Jellyfrog
parent 096835b67d
commit 96ed161c81
3 changed files with 38 additions and 1 deletions

View File

@@ -1204,6 +1204,17 @@ function search_oxidized(\Illuminate\Http\Request $request)
}
}
function get_oxidized_config(\Illuminate\Http\Request $request)
{
$hostname = $request->route('device_name');
$result = json_decode(file_get_contents(Config::get('oxidized.url') . '/node/fetch/' . $hostname . '?format=json'), true);
if (!$result) {
return api_error(404, "Received no data from Oxidized");
} else {
return api_success($result, 'config');
}
}
function list_oxidized(\Illuminate\Http\Request $request)
{
$hostname = $request->route('hostname');