Added API to feed into Oxidized

This commit is contained in:
laf
2015-05-07 00:32:58 +01:00
parent 7f5a64967e
commit f5d02ab18d
3 changed files with 46 additions and 0 deletions

View File

@@ -699,3 +699,17 @@ function get_inventory() {
$app->response->headers->set('Content-Type', 'application/json');
echo _json_encode($output);
}
function list_oxidized() {
// return details of a single device
$app = \Slim\Slim::getInstance();
$app->response->headers->set('Content-Type', 'application/json');
$devices = array();
foreach (dbFetchRows("SELECT hostname,os FROM `devices` WHERE `status`='1'") as $device) {
$devices[] = $device;
}
$app->response->headers->set('Content-Type', 'application/json');
echo _json_encode($devices);
}