Files

76 lines
1.7 KiB
PHP
Raw Permalink Normal View History

<?php
2020-09-21 15:40:17 +02:00
$ports = get_portactivity_ports($device['device_id']);
sort($ports);
2020-09-21 15:40:17 +02:00
$link_array = [
'page' => 'device',
'device' => $device['device_id'],
'tab' => 'apps',
'app' => 'portactivity',
2020-09-21 15:40:17 +02:00
];
print_optionbar_start();
echo 'Ports:';
2020-09-21 15:40:17 +02:00
$ports_int = 0;
while (isset($ports[$ports_int])) {
2020-09-21 15:40:17 +02:00
$port = $ports[$ports_int];
$label = $ports[$ports_int];
if ($vars['port'] == $port) {
2020-09-21 15:40:17 +02:00
$label = '>>' . $port . '<<';
}
$ports_int++;
2020-09-21 15:40:17 +02:00
$append = '';
if (isset($ports[$ports_int])) {
2020-09-21 15:40:17 +02:00
$append = ', ';
}
2020-09-21 15:40:17 +02:00
echo generate_link($label, $link_array, ['port'=>$port]) . $append;
}
print_optionbar_end();
2020-09-21 15:40:17 +02:00
if (! isset($vars['port'])) {
echo "Please select a port.\n";
2020-09-21 15:40:17 +02:00
$graphs = [
// No useful bits to display with out selecting anything.
];
} else {
2020-09-21 15:40:17 +02:00
$graphs = [
'portactivity_totals'=>'Total Connections',
'portactivity_total_details'=>'Total Connections Details',
'portactivity_to'=>'Connections To Server',
'portactivity_from'=>'Connections From Server',
2020-09-21 15:40:17 +02:00
];
}
foreach ($graphs as $key => $text) {
2020-09-21 15:40:17 +02:00
$graph_type = $key;
$graph_array['height'] = '100';
2020-09-21 15:40:17 +02:00
$graph_array['width'] = '215';
2019-06-23 00:29:12 -05:00
$graph_array['to'] = \LibreNMS\Config::get('time.now');
2020-09-21 15:40:17 +02:00
$graph_array['id'] = $app['app_id'];
$graph_array['type'] = 'application_' . $key;
if (isset($vars['port'])) {
2020-09-21 15:40:17 +02:00
$graph_array['port'] = $vars['port'];
}
echo '<div class="panel panel-default">
<div class="panel-heading">
2020-09-21 15:40:17 +02:00
<h3 class="panel-title">' . $text . '</h3>
</div>
<div class="panel-body">
<div class="row">';
2019-04-11 23:26:42 -05:00
include 'includes/html/print-graphrow.inc.php';
echo '</div>';
echo '</div>';
echo '</div>';
}