mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
@@ -178,6 +178,10 @@ function get_device()
|
||||
echo _json_encode($output);
|
||||
$app->stop();
|
||||
} else {
|
||||
$host_id = get_vm_parent_id($device);
|
||||
if (is_numeric($host_id)) {
|
||||
$device = array_merge($device, array('parent_id' => $host_id));
|
||||
}
|
||||
$output = array(
|
||||
'status' => 'ok',
|
||||
'devices' => array($device),
|
||||
@@ -186,7 +190,6 @@ function get_device()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function list_devices()
|
||||
{
|
||||
// This will return a list of devices
|
||||
@@ -232,7 +235,11 @@ function list_devices()
|
||||
}
|
||||
$devices = array();
|
||||
foreach (dbFetchRows("SELECT * FROM `devices` $join WHERE $sql ORDER by $order", $param) as $device) {
|
||||
$host_id = get_vm_parent_id($device);
|
||||
$device['ip'] = inet6_ntop($device['ip']);
|
||||
if (is_numeric($host_id)) {
|
||||
$device['parent_id'] = $host_id;
|
||||
}
|
||||
$devices[] = $device;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ if ($device['disabled'] == '1') {
|
||||
$class = 'alert-info';
|
||||
}
|
||||
|
||||
$host_id = dbFetchCell("SELECT `device_id` FROM `vminfo` WHERE `vmwVmDisplayName` = ? OR `vmwVmDisplayName` = ?", array($device['hostname'],$device['hostname'].'.'.$config['mydomain']));
|
||||
$host_id = get_vm_parent_id($device);
|
||||
|
||||
echo '
|
||||
<tr bgcolor="'.$device_colour.'" class="alert '.$class.'">
|
||||
|
||||
@@ -1615,6 +1615,7 @@ function set_numeric($value, $default = 0)
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
function check_git_exists()
|
||||
{
|
||||
if (`which git`) {
|
||||
@@ -1623,3 +1624,14 @@ function check_git_exists()
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function get_vm_parent_id($device)
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (empty($device['hostname'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return dbFetchCell("SELECT `device_id` FROM `vminfo` WHERE `vmwVmDisplayName` = ? OR `vmwVmDisplayName` = ?", array($device['hostname'],$device['hostname'].'.'.$config['mydomain']));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user