feature: Add Basic Oxidized Node List (#6017)

* feature: Add Basic Oxidized Node List
This commit is contained in:
Søren Rosiak
2017-02-27 23:32:13 +01:00
committed by Neil Lathwood
parent 55384ad1b0
commit db58fea2d2
2 changed files with 89 additions and 19 deletions

View File

@ -1436,3 +1436,39 @@ function set_image_type()
return header('Content-type: image/png');
}
}
function get_oxidized_nodes_list()
{
global $config;
$context = stream_context_create(array(
'http' => array(
'header' => "Accept: application/json",
)
));
$data = json_decode(file_get_contents($config['oxidized']['url'] . '/nodes?format=json', false, $context), true);
foreach ($data as $object) {
$device = device_by_name($object['name']);
$fa_color = $object['status'] == 'success' ? 'success' : 'danger';
echo "
<tr>
<td>
" . generate_device_link($device) . "
</td>
<td>
<i class='fa fa-square text-" . $fa_color . "'></i>
</td>
<td>
" . $object['time'] . "
</td>
<td>
" . $object['model'] . "
</td>
<td>
" . $object['group'] . "
</td>
</tr>";
}
}