Drop unused files

Signed-off-by: jack <jack@k-net.pro>
This commit is contained in:
jack 2017-02-25 23:51:16 +01:00
parent 903dd3b36f
commit 152ea16ced
No known key found for this signature in database
GPG Key ID: 1C625C4E15F0CF99
2 changed files with 0 additions and 209 deletions

View File

@ -1,146 +0,0 @@
<?php
/*
* $Id$
*
* written by Manuel Kasper <mk@neon1.net> for Monzoon Networks AG
*/
require_once('func.inc');
$numtop = 10;
$ascolors = array("A6CEE3", "1F78B4", "B2DF8A", "33A02C", "FB9A99", "E31A1C", "FDBF6F", "FF7F00", "CAB2D6", "6A3D9A");
$link = $_GET['link'];
if (!preg_match("/^[0-9a-zA-Z][0-9a-zA-Z\-_]+$/", $link))
die("Invalid link");
if (@$_GET['v'] == 6)
$link .= "_v6";
$hours = 24;
if (@$_GET['numhours'])
$hours = (int)$_GET['numhours'];
/* first step: walk the data for all ASes to determine the top 5 for the given link */
$statsfile = statsFileForHours($hours);
$fd = fopen($statsfile, "r");
$cols = explode("\t", trim(fgets($fd)));
$asstats = array();
/* figure out which columns contain data for the links were's interested in */
$incol = array_search("{$link}_in", $cols);
$outcol = array_search("{$link}_out", $cols);
if (!$incol || !$outcol)
die("Couldn't find columns");
/* read in all AS stats */
while (!feof($fd)) {
$line = trim(fgets($fd));
if (!$line)
continue;
$els = explode("\t", $line);
/* first element is the AS */
$asstats[$els[0]] = $els[$incol] + $els[$outcol];
}
fclose($fd);
/* now sort the AS stats to find the top $numtop */
arsort($asstats, SORT_NUMERIC);
/* extract first $numtop and consolidate the rest */
$topas = array_slice($asstats, 0, $numtop, true);
for ($i = 0; $i < $numtop; $i++)
array_shift($asstats);
$restdata = 0;
foreach ($asstats as $as => $totaldata) {
$restdata += $totaldata;
}
/* now make a beautiful graph :) */
header("Content-Type: image/png");
$width = $default_graph_width;
$height = $default_graph_height;
if (@$_GET['width'])
$width = (int)$_GET['width'];
if (@$_GET['height'])
$height = (int)$_GET['height'];
$knownlinks = getknownlinks();
if ($compat_rrdtool12) {
/* cannot use full-size-mode - must estimate height/width */
$height -= 205;
$width -= 81;
}
$start = time() - $hours*3600;
$end = time();
$cmd = "$rrdtool graph - " .
"--slope-mode --alt-autoscale -u 0 -l 0 --imgformat=PNG --base=1000 --height=$height --width=$width " .
"--color BACK#ffffff00 --color SHADEA#ffffff00 --color SHADEB#ffffff00 " .
"--start " . $start . " --end " . $end . " ";
if (!$compat_rrdtool12)
$cmd .= "--full-size-mode ";
if($showtitledetail && @$_GET['dname'] != "")
$cmd .= "--title " . escapeshellarg($_GET['dname']) . " ";
else
if (isset($_GET['v']) && is_numeric($_GET['v']))
$cmd .= "--title IPv" . $_GET['v'] . " ";
/* geneate RRD DEFs */
foreach ($topas as $as => $traffic) {
$rrdfile = getRRDFileForAS($as);
$cmd .= "DEF:as{$as}_in=\"$rrdfile\":{$link}_in:AVERAGE ";
$cmd .= "DEF:as{$as}_out=\"$rrdfile\":{$link}_out:AVERAGE ";
}
/* generate a CDEF for each DEF to multiply by 8 (bytes to bits), and reverse for outbound */
foreach ($topas as $as => $traffic) {
if ($outispositive) {
$cmd .= "CDEF:as{$as}_in_bits=as{$as}_in,-8,* ";
$cmd .= "CDEF:as{$as}_out_bits=as{$as}_out,8,* ";
} else {
$cmd .= "CDEF:as{$as}_in_bits=as{$as}_in,8,* ";
$cmd .= "CDEF:as{$as}_out_bits=as{$as}_out,-8,* ";
}
}
/* generate graph area/stack for inbound */
$i = 0;
foreach ($topas as $as => $traffic) {
$asinfo = getASInfo($as);
$descr = str_replace(":", "\\:", utf8_decode($asinfo['descr']));
$cmd .= "AREA:as{$as}_in_bits#{$ascolors[$i]}:\"AS{$as} ({$descr})\\n\"";
if ($i > 0)
$cmd .= ":STACK";
$cmd .= " ";
$i++;
}
/* generate graph area/stack for outbound */
$i = 0;
foreach ($topas as $as => $traffic) {
$cmd .= "AREA:as{$as}_out_bits#{$ascolors[$i]}:";
if ($i > 0)
$cmd .= ":STACK";
$cmd .= " ";
$i++;
}
# zero line
$cmd .= "HRULE:0#00000080";
passthru($cmd);
exit;
?>

View File

@ -1,63 +0,0 @@
<?php
/*
* $Id$
*
* written by Manuel Kasper <mk@neon1.net> for Monzoon Networks AG
*/
require_once('func.inc');
$knownlinks = getknownlinks();
$hours = 24;
if (@$_GET['numhours'])
$hours = (int)$_GET['numhours'];
$label = statsLabelForHours($hours);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Refresh" content="300" />
<title>Link usage (<?php echo $label ?>)</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="nav"><?php include('headermenu.inc'); ?></div>
<div class="pgtitle">Link usage - top 10 AS per link (<?php echo $label ?>)</div>
<table class="astable">
<?php $i = 0; foreach ($knownlinks as $link):
$class = (($i % 2) == 0) ? "even" : "odd";
?>
<tr class="<?php echo $class; ?>">
<?php if (($showtitledetail && !$hidelinkusagename) || (!$showtitledetail)): ?>
<th style="width: 15em">
<div class="title">
<?php echo $link['descr']; ?>
</div>
</th>
<?php endif; ?>
<td>
<?php if ($showv6): ?>
<img alt="link graph" src="linkgraph.php?link=<?php echo $link['tag']; ?>&amp;numhours=<?php echo $hours ?>&amp;width=<?php echo $linkusage_graph_width ?>&amp;height=<?php echo $linkusage_graph_height ?>&amp;v=4&amp;dname=<?php echo rawurlencode($link['descr'] . " - IPV4"); ?>" width="<?php echo $linkusage_graph_width ?>" height="<?php echo $linkusage_graph_height ?>" border="0" />
<img alt="link graph" src="linkgraph.php?link=<?php echo $link['tag']; ?>&amp;numhours=<?php echo $hours ?>width=<?php echo $linkusage_graph_width ?>&amp;height=<?php echo $linkusage_graph_height ?>&amp;v=6&amp;dname=<?php echo rawurlencode($link['descr'] . " - IPV6"); ?>" width="<?php echo $linkusage_graph_width ?>" height="<?php echo $linkusage_graph_height ?>" border="0" />
<?php else: ?>
<img alt="link graph" src="linkgraph.php?link=<?php echo $link['tag']; ?>&amp;numhours=<?php echo $hours ?>width=<?php echo $linkusage_graph_width ?>&amp;height=<?php echo $linkusage_graph_height ?>&amp;dname=<?php echo rawurlencode($link['descr'] . ""); ?>" width="<?php echo $linkusage_graph_width ?>" height="<?php echo $linkusage_graph_height ?>" border="0" />
<?php endif; ?>
</td>
</tr>
<?php $i++; endforeach; ?>
</table>
<?php include('footer.inc'); ?>
</body>
</html>