Commit version 24.12.13800
This commit is contained in:
@ -4,200 +4,207 @@
|
||||
*
|
||||
* This file is part of Observium.
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage web
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
|
||||
* @package observium
|
||||
* @subpackage web
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
// Print permission error and exit if the user doesn't have write permissions
|
||||
if (!is_entity_write_permitted($device['device_id'], 'device')) {
|
||||
print_error_permission();
|
||||
return;
|
||||
print_error_permission();
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<?php
|
||||
<?php
|
||||
|
||||
$box_args = array('title' => 'Duration',
|
||||
'header-border' => TRUE,
|
||||
'padding' => TRUE,
|
||||
);
|
||||
$box_args = ['title' => 'Duration',
|
||||
'header-border' => TRUE,
|
||||
'padding' => TRUE,
|
||||
];
|
||||
|
||||
$box_args['header-controls'] = array('controls' => array('perf' => array('text' => 'Performance Data',
|
||||
//'icon' => 'icon-trash',
|
||||
'anchor' => TRUE,
|
||||
'url' => generate_url(array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'perf')),
|
||||
)));
|
||||
$box_args['header-controls'] = ['controls' => ['perf' => ['text' => 'Performance Data',
|
||||
//'icon' => 'icon-trash',
|
||||
'anchor' => TRUE,
|
||||
'url' => generate_url(['page' => 'device', 'device' => $device['device_id'], 'tab' => 'perf']),
|
||||
]]];
|
||||
|
||||
echo generate_box_open($box_args);
|
||||
echo generate_box_open($box_args);
|
||||
|
||||
$ptime = array_values($device['state']['poller_history'])[0]; // note for self: PHP 5.4+
|
||||
$pstart = array_keys($device['state']['poller_history'])[0];
|
||||
$ptime = array_values($device['state']['poller_history'])[0]; // note for self: PHP 5.4+
|
||||
$pstart = array_keys($device['state']['poller_history'])[0];
|
||||
|
||||
echo "Last Polled: <b>" . format_unixtime($pstart) .'</b> (took '.$ptime.'s) - <a href="' . generate_url(array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'perf')) . '">Details</a>';
|
||||
echo "Last Polled: <b>" . format_unixtime($pstart) . '</b> (took ' . $ptime . 's) - <a href="' . generate_url(['page' => 'device', 'device' => $device['device_id'], 'tab' => 'perf']) . '">Details</a>';
|
||||
|
||||
$dtime = array_values($device['state']['discovery_history'])[0]; // note for self: PHP 5.4+
|
||||
$dstart = array_keys($device['state']['discovery_history'])[0];
|
||||
$dtime = array_values($device['state']['discovery_history'])[0]; // note for self: PHP 5.4+
|
||||
$dstart = array_keys($device['state']['discovery_history'])[0];
|
||||
|
||||
echo "<p>Last discovered: <b>" . format_unixtime($dstart) .'</b> (took '.$dtime.'s) - <a href="' . generate_url(array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'perf')) . '">Details</a></p>';
|
||||
echo "<p>Last discovered: <b>" . format_unixtime($dstart) . '</b> (took ' . $dtime . 's) - <a href="' . generate_url(['page' => 'device', 'device' => $device['device_id'], 'tab' => 'perf']) . '">Details</a></p>';
|
||||
|
||||
echo generate_box_close();
|
||||
echo generate_box_close();
|
||||
|
||||
$box_args = array('title' => 'RANCID',
|
||||
'header-border' => TRUE,
|
||||
'padding' => TRUE,
|
||||
);
|
||||
$box_args = ['title' => 'RANCID',
|
||||
'header-border' => TRUE,
|
||||
'padding' => TRUE,
|
||||
];
|
||||
|
||||
$box_args['header-controls'] = array('controls' => array('perf' => array('text' => 'Show Config',
|
||||
'anchor' => TRUE,
|
||||
'url' => generate_url(array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'showconfig')),
|
||||
)));
|
||||
$box_args['header-controls'] = ['controls' => ['perf' => ['text' => 'Show Config',
|
||||
'anchor' => TRUE,
|
||||
'url' => generate_url(['page' => 'device', 'device' => $device['device_id'], 'tab' => 'showconfig']),
|
||||
]]];
|
||||
|
||||
echo generate_box_open($box_args);
|
||||
echo generate_box_open($box_args);
|
||||
|
||||
if (safe_count($config['rancid_configs'])) {
|
||||
$device_config_file = get_rancid_filename($device['hostname'], 1);
|
||||
if (safe_count($config['rancid_configs'])) {
|
||||
$device_config_file = get_rancid_filename($device['hostname'], 1);
|
||||
|
||||
echo('<p />');
|
||||
echo('<p />');
|
||||
|
||||
if ($device_config_file) {
|
||||
print_success("Configuration file for device was found; will be displayed to users with level 7 or higher.");
|
||||
} elseif (!isset($config['os'][$device['os']]['rancid'])) {
|
||||
print_warning("Configuration file for device was not found.");
|
||||
} else {
|
||||
print_warning("Os not supported by RANCID.");
|
||||
}
|
||||
} else {
|
||||
print_warning("No RANCID directories configured.");
|
||||
}
|
||||
if ($device_config_file) {
|
||||
print_success("Configuration file for device was found; will be displayed to users with level 7 or higher.");
|
||||
} elseif (!isset($config['os'][$device['os']]['rancid'])) {
|
||||
print_warning("Configuration file for device was not found.");
|
||||
} else {
|
||||
print_warning("Os not supported by RANCID.");
|
||||
}
|
||||
} else {
|
||||
print_warning("No RANCID directories configured.");
|
||||
}
|
||||
|
||||
echo generate_box_close();
|
||||
echo generate_box_close();
|
||||
|
||||
$box_args = [
|
||||
'title' => 'UNIX Agent',
|
||||
'header-border' => TRUE,
|
||||
'padding' => TRUE,
|
||||
];
|
||||
// show for allowed module
|
||||
if (is_module_enabled($device, 'unix-agent', 'poller')) {
|
||||
$box_args['header-controls'] = [
|
||||
'controls' => [
|
||||
'perf' => [ 'text' => 'Show Applications', 'anchor' => TRUE,
|
||||
'url' => generate_url([ 'page' => 'device', 'device' => $device['device_id'], 'tab' => 'apps' ]) ]
|
||||
]
|
||||
];
|
||||
echo generate_box_open($box_args);
|
||||
echo '<pre>';
|
||||
if ($unixagent = get_dev_attrib($device, 'unixagent_raw')) {
|
||||
if ($tmp = str_decompress($unixagent)) {
|
||||
// New compressed format
|
||||
$unixagent = $tmp;
|
||||
unset($tmp);
|
||||
}
|
||||
echo escape_html($unixagent);
|
||||
}
|
||||
echo '</pre>';
|
||||
} else {
|
||||
echo generate_box_open($box_args);
|
||||
print_warning("Unix-agent disabled for os.");
|
||||
}
|
||||
echo generate_box_close();
|
||||
$box_args = [
|
||||
'title' => 'UNIX Agent',
|
||||
'header-border' => TRUE,
|
||||
'padding' => TRUE,
|
||||
];
|
||||
// show for allowed module
|
||||
if (is_module_enabled($device, 'unix-agent', 'poller')) {
|
||||
$box_args['header-controls'] = [
|
||||
'controls' => [
|
||||
'perf' => ['text' => 'Show Applications', 'anchor' => TRUE,
|
||||
'url' => generate_url(['page' => 'device', 'device' => $device['device_id'], 'tab' => 'apps'])]
|
||||
]
|
||||
];
|
||||
echo generate_box_open($box_args);
|
||||
echo '<pre>';
|
||||
if ($unixagent = get_dev_attrib($device, 'unixagent_raw')) {
|
||||
if ($tmp = str_decompress($unixagent)) {
|
||||
// New compressed format
|
||||
$unixagent = $tmp;
|
||||
unset($tmp);
|
||||
}
|
||||
echo escape_html($unixagent);
|
||||
}
|
||||
echo '</pre>';
|
||||
} else {
|
||||
echo generate_box_open($box_args);
|
||||
print_warning("Unix-agent disabled for os.");
|
||||
}
|
||||
echo generate_box_close();
|
||||
|
||||
$box_args = array('title' => 'Smokeping',
|
||||
'header-border' => TRUE,
|
||||
'padding' => TRUE,
|
||||
);
|
||||
$box_args = ['title' => 'Smokeping',
|
||||
'header-border' => TRUE,
|
||||
'padding' => TRUE,
|
||||
];
|
||||
|
||||
$box_args['header-controls'] = array('controls' => array('perf' => array('text' => 'Show Latency',
|
||||
'anchor' => TRUE,
|
||||
'url' => generate_url(array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'latency')),
|
||||
)));
|
||||
$box_args['header-controls'] = ['controls' => ['perf' => ['text' => 'Show Latency',
|
||||
'anchor' => TRUE,
|
||||
'url' => generate_url(['page' => 'device', 'device' => $device['device_id'], 'tab' => 'latency']),
|
||||
]]];
|
||||
|
||||
echo generate_box_open($box_args);
|
||||
echo generate_box_open($box_args);
|
||||
|
||||
if ($config['smokeping']['dir'] != '')
|
||||
{
|
||||
$smokeping_files = get_smokeping_files(1);
|
||||
if (isset($config['smokeping']['dir']) && is_dir($config['smokeping']['dir'])) {
|
||||
$smokeping_files = get_smokeping_files(1);
|
||||
|
||||
echo('<p />');
|
||||
echo('<p />');
|
||||
|
||||
if ($smokeping_files['incoming'][$device['hostname']])
|
||||
{
|
||||
print_success("RRD for incoming latency found.");
|
||||
} else {
|
||||
print_error("RRD for incoming latency not found.");
|
||||
}
|
||||
if ($smokeping_files['incoming'][$device['hostname']]) {
|
||||
print_success("RRD for incoming latency found.");
|
||||
} else {
|
||||
print_error("RRD for incoming latency not found.");
|
||||
}
|
||||
|
||||
if ($smokeping_files['outgoing'][$device['hostname']])
|
||||
{
|
||||
print_success("RRD for outgoing latency found.");
|
||||
} else {
|
||||
print_error("RRD for outgoing latency not found.");
|
||||
}
|
||||
} else {
|
||||
print_warning("No Smokeping directory configured.");
|
||||
}
|
||||
if ($smokeping_files['outgoing'][$device['hostname']]) {
|
||||
print_success("RRD for outgoing latency found.");
|
||||
} else {
|
||||
print_error("RRD for outgoing latency not found.");
|
||||
}
|
||||
} else {
|
||||
print_warning("No Smokeping directory configured.");
|
||||
}
|
||||
|
||||
echo generate_box_close();
|
||||
echo generate_box_close();
|
||||
|
||||
$box_args = array('title' => 'Device Graphs',
|
||||
'header-border' => TRUE,
|
||||
//'padding' => TRUE,
|
||||
);
|
||||
$box_args = ['title' => 'Device Graphs',
|
||||
'header-border' => TRUE,
|
||||
//'padding' => TRUE,
|
||||
];
|
||||
|
||||
$box_args['header-controls'] = array('controls' => array('perf' => array('text' => 'Show Graphs',
|
||||
'anchor' => TRUE,
|
||||
'url' => generate_url(array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'graphs')),
|
||||
)));
|
||||
$box_args['header-controls'] = ['controls' => ['perf' => ['text' => 'Show Graphs',
|
||||
'anchor' => TRUE,
|
||||
'url' => generate_url(['page' => 'device', 'device' => $device['device_id'], 'tab' => 'graphs']),
|
||||
]]];
|
||||
|
||||
echo generate_box_open($box_args);
|
||||
echo generate_box_open($box_args);
|
||||
|
||||
echo('<table class="' . OBS_CLASS_TABLE_STRIPED_MORE . '">');
|
||||
echo('<table class="' . OBS_CLASS_TABLE_STRIPED_MORE . '">');
|
||||
|
||||
?>
|
||||
<thead><tr>
|
||||
<th>Graph Type</th>
|
||||
<th style="width: 80px;">Has File</th>
|
||||
<th style="width: 80px;">Has Array</th>
|
||||
<th style="width: 80px;">Enabled</th>
|
||||
<th></th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ($device['graphs'] as $graph_entry)
|
||||
{
|
||||
echo('<tr><td>'.$graph_entry['graph'].'</td>');
|
||||
?>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Graph Type</th>
|
||||
<th style="width: 80px;">Has File</th>
|
||||
<th style="width: 80px;">Has Array</th>
|
||||
<th style="width: 80px;">Enabled</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ($device['graphs'] as $graph_entry) {
|
||||
echo('<tr><td>' . $graph_entry['graph'] . '</td>');
|
||||
|
||||
if (is_file('includes/graphs/device/'.$graph_entry['graph'].'.inc.php'))
|
||||
{ echo('<td><i class="icon-ok-sign green"></i></td>'); } else { echo('<td><i class="icon-remove-sign red"></i></td>'); }
|
||||
if (is_file('includes/graphs/device/' . $graph_entry['graph'] . '.inc.php')) {
|
||||
echo('<td><i class="icon-ok-sign green"></i></td>');
|
||||
} else {
|
||||
echo('<td><i class="icon-remove-sign red"></i></td>');
|
||||
}
|
||||
|
||||
if (is_array($config['graph_types']['device'][$graph_entry['graph']]))
|
||||
{ echo('<td><i class="icon-ok-sign green"></i></td>'); } else { echo('<td><i class="icon-remove-sign red"></i></td>'); }
|
||||
if (is_array($config['graph_types']['device'][$graph_entry['graph']])) {
|
||||
echo('<td><i class="icon-ok-sign green"></i></td>');
|
||||
} else {
|
||||
echo('<td><i class="icon-remove-sign red"></i></td>');
|
||||
}
|
||||
|
||||
if ($graph_entry['enabled'])
|
||||
{ echo('<td><i class="icon-ok-sign green"></i></td>'); } else { echo('<td><i class="icon-remove-sign red"></i></td>'); }
|
||||
if ($graph_entry['enabled']) {
|
||||
echo('<td><i class="icon-ok-sign green"></i></td>');
|
||||
} else {
|
||||
echo('<td><i class="icon-remove-sign red"></i></td>');
|
||||
}
|
||||
|
||||
echo('<td>'.print_r($config['graph_types']['device'][$graph_entry['graph']], TRUE).'</td>');
|
||||
echo('<td>' . print_r($config['graph_types']['device'][$graph_entry['graph']], TRUE) . '</td>');
|
||||
|
||||
echo('</tr>');
|
||||
}
|
||||
?>
|
||||
echo('</tr>');
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
<?php
|
||||
|
||||
echo generate_box_close();
|
||||
echo generate_box_close();
|
||||
|
||||
echo generate_box_open();
|
||||
print_vars($device);
|
||||
echo generate_box_close();
|
||||
?>
|
||||
</div>
|
||||
echo generate_box_open();
|
||||
print_vars($device);
|
||||
echo generate_box_close();
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
// EOF
|
||||
|
Reference in New Issue
Block a user