Files

130 lines
3.7 KiB
PHP
Raw Permalink Normal View History

2011-09-30 19:15:58 +00:00
<?php
2011-09-30 19:46:32 +00:00
print_optionbar_start();
echo "<span style='font-weight: bold;'>Latency</span> &#187; ";
2012-04-06 13:56:23 +00:00
if (count($smokeping_files['in'][$device['hostname']])) {
$menu_options['incoming'] = 'Incoming';
}
2012-04-06 13:56:23 +00:00
if (count($smokeping_files['out'][$device['hostname']])) {
$menu_options['outgoing'] = 'Outgoing';
}
2012-04-06 13:56:23 +00:00
$sep = '';
foreach ($menu_options as $option => $text) {
if (!$vars['view']) {
$vars['view'] = $option;
}
2011-10-28 18:29:22 +00:00
echo $sep;
if ($vars['view'] == $option) {
echo "<span class='pagemenu-selected'>";
2011-09-30 19:15:58 +00:00
}
echo generate_link($text, $vars, array('view' => $option));
if ($vars['view'] == $option) {
echo '</span>';
}
2011-09-30 19:15:58 +00:00
$sep = ' | ';
}
2011-09-30 19:15:58 +00:00
unset($sep);
2012-04-06 13:56:23 +00:00
print_optionbar_end();
2012-04-06 13:56:23 +00:00
echo '<table>';
2011-10-28 18:29:22 +00:00
if ($vars['view'] == 'incoming') {
if (count($smokeping_files['in'][$device['hostname']])) {
$graph_array['type'] = 'device_smokeping_in_all_avg';
$graph_array['device'] = $device['device_id'];
echo '<tr><td>';
echo '<h3>Average</h3>';
2011-10-28 18:29:22 +00:00
include 'includes/print-graphrow.inc.php';
2012-04-06 13:56:23 +00:00
echo '</td></tr>';
2012-04-06 13:56:23 +00:00
$graph_array['type'] = 'device_smokeping_in_all';
2016-03-07 11:40:47 +00:00
$graph_array['device'] = $device['device_id'];
$graph_array['legend'] = no;
echo '<tr><td>';
echo '<h3>Aggregate</h3>';
2011-10-28 18:29:22 +00:00
include 'includes/print-graphrow.inc.php';
2011-09-30 19:15:58 +00:00
echo '</td></tr>';
2011-09-30 19:15:58 +00:00
unset($graph_array['legend']);
2011-09-30 19:15:58 +00:00
ksort($smokeping_files['in'][$device['hostname']]);
foreach ($smokeping_files['in'][$device['hostname']] as $src => $host) {
$hostname = str_replace('.rrd', '', $host);
$host = device_by_name($src);
2015-07-15 20:46:04 +01:00
if ($config['smokeping']['integration'] === true) {
2016-08-18 20:28:22 -05:00
$dest = device_by_name(str_replace("_", ".", $hostname));
} else {
2015-07-15 20:46:04 +01:00
$dest = $host;
}
if (is_numeric($host['device_id'])) {
echo '<tr><td>';
2015-07-16 16:01:51 +01:00
echo '<h3>'.generate_device_link($dest).'</h3>';
$graph_array['type'] = 'smokeping_in';
$graph_array['device'] = $device['device_id'];
$graph_array['src'] = $host['device_id'];
2012-04-06 13:56:23 +00:00
include 'includes/print-graphrow.inc.php';
2012-04-06 13:56:23 +00:00
echo '</td></tr>';
}
}
}//end if
2016-08-18 20:28:22 -05:00
} elseif ($vars['view'] == 'outgoing') {
if (count($smokeping_files['out'][$device['hostname']])) {
$graph_array['type'] = 'device_smokeping_out_all_avg';
$graph_array['device'] = $device['device_id'];
echo '<tr><td>';
echo '<h3>Aggregate</h3>';
2011-09-30 19:15:58 +00:00
include 'includes/print-graphrow.inc.php';
2012-04-06 13:56:23 +00:00
echo '</td></tr>';
2011-09-30 19:15:58 +00:00
$graph_array['type'] = 'device_smokeping_out_all';
$graph_array['legend'] = no;
echo '<tr><td>';
echo '<h3>Aggregate</h3>';
include 'includes/print-graphrow.inc.php';
echo '</td></tr>';
2012-04-06 13:56:23 +00:00
unset($graph_array['legend']);
2012-04-06 13:56:23 +00:00
asort($smokeping_files['out'][$device['hostname']]);
foreach ($smokeping_files['out'][$device['hostname']] as $host) {
$hostname = str_replace('.rrd', '', $host);
list($hostname) = explode('~', $hostname);
$host = device_by_name($hostname);
if (is_numeric($host['device_id'])) {
echo '<tr><td>';
echo '<h3>'.generate_device_link($host).'</h3>';
$graph_array['type'] = 'smokeping_out';
$graph_array['device'] = $device['device_id'];
$graph_array['dest'] = $host['device_id'];
include 'includes/print-graphrow.inc.php';
2011-09-30 19:15:58 +00:00
echo '</td></tr>';
}
}
}//end if
}//end if
2011-10-28 18:29:22 +00:00
echo '</table>';
$pagetitle[] = 'Latency';