* update to 1.32

This commit is contained in:
Manuel Kasper 2010-08-02 11:23:42 +00:00
parent 06cafdafc0
commit 28f0c03bad
7 changed files with 33 additions and 26 deletions

7
README
View File

@ -1,12 +1,15 @@
AS-Stats v1.31 (2010-05-06)
AS-Stats v1.32 (2010-08-02)
a simple tool to generate per-AS traffic graphs from NetFlow/sFlow records
by Manuel Kasper, Monzoon Networks AG <mkasper@monzoon.net>
--------------------------------------------------------------------
Changes
-------
v1.xx Fix add_ds.sh to support new directory structure
v1.32 Fix add_ds.sh to support new directory structure
(contributed by Sergei Veltistov)
Fix PHP warnings and move $ntop to config.inc
(contributed by Michal Buchtik)
v1.31 Set memory_limit to 256 MB in PHP pages (suggested by Steve Colam
<steve@colam.co.uk>).

View File

@ -10,4 +10,6 @@ $asinfofile = "asinfo.txt";
$knownlinksfile = "/data/knownlinks";
$outispositive = true;
$ntop = 20;
?>

View File

@ -21,14 +21,14 @@ function getASInfo($asnum) {
if ($asinfodb[$asnum])
return $asinfodb[$asnum];
else
return array(name => "AS$asnum", descr => "AS $asnum");
return array('name' => "AS$asnum", 'descr' => "AS $asnum");
/*$row = mysql_fetch_array(mysql_query("select * from asnums where asn='" . addslashes($asnum) . "'"));
if ($row) {
return array(name => $row['asname'], descr => $row['descr'], country => $row['country']);
return array('name' => $row['asname'], 'descr' => $row['descr'], 'country' => $row['country']);
} else {
return array(name => "AS$asnum", descr => "AS $asnum");
return array('name' => "AS$asnum", 'descr' => "AS $asnum");
}*/
}
@ -45,12 +45,16 @@ function readasinfodb() {
if (preg_match("/(^\\s*#)|(^\\s*$)/", $line))
continue; /* empty line or comment */
list($asn,$asname,$descr,$country) = explode("\t", $line);
$asnarr = explode("\t", $line);
$asn = $asnarr[0];
$asname = $asnarr[1];
$descr = $asnarr[2];
if (isset($asnarr[3])) $country = $asnarr[3];
$asinfodb[$asn] = array(
name => $asname,
descr => $descr,
country => $country
'name' => $asname,
'descr' => $descr,
'country' => $country
);
}
fclose($fd);
@ -60,7 +64,7 @@ function readasinfodb() {
function getknownlinks() {
global $knownlinksfile;
$fd = fopen($knownlinksfile, "r");
$knownlinks = array();
while (!feof($fd)) {
@ -71,11 +75,11 @@ function getknownlinks() {
list($routerip,$ifindex,$tag,$descr,$color) = preg_split("/\\t+/", $line);
$knownlinks[] = array(
routerip => $routerip,
ifindex => $ifindex,
tag => $tag,
descr => $descr,
color => $color
'routerip' => $routerip,
'ifindex' => $ifindex,
'tag' => $tag,
'descr' => $descr,
'color' => $color
);
}
fclose($fd);

View File

@ -15,9 +15,9 @@ header("Content-Type: image/png");
$width = 500;
$height = 300;
if ($_GET['width'])
if (isset($_GET['width']))
$width = (int)$_GET['width'];
if ($_GET['height'])
if (isset($_GET['height']))
$height = (int)$_GET['height'];
$knownlinks = getknownlinks();
@ -27,13 +27,13 @@ $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 ";
if ($_GET['nolegend'])
if (isset($_GET['nolegend']))
$cmd .= "--no-legend ";
if ($_GET['start'] && is_numeric($_GET['start']))
if (isset($_GET['start']) && is_numeric($_GET['start']))
$cmd .= "--start " . $_GET['start'] . " ";
if ($_GET['end'] && is_numeric($_GET['end']))
if (isset($_GET['end']) && is_numeric($_GET['end']))
$cmd .= "--end " . $_GET['end'] . " ";
/* geneate RRD DEFs */

View File

@ -59,7 +59,7 @@ AS: <input type="text" name="as" size="6" />
<?php endif; ?>
<div id="footer">
AS-Stats v1.31 written by Manuel Kasper, Monzoon Networks AG.<br/>
AS-Stats v1.32 written by Manuel Kasper, Monzoon Networks AG.<br/>
<?php if ($outispositive): ?>
Outbound traffic: positive / Inbound traffic: negative
<?php else: ?>

View File

@ -45,7 +45,7 @@ $class = (($i % 2) == 0) ? "even" : "odd";
</table>
<div id="footer">
AS-Stats v1.31 written by Manuel Kasper, Monzoon Networks AG.<br/>
AS-Stats v1.32 written by Manuel Kasper, Monzoon Networks AG.<br/>
<?php if ($outispositive): ?>
Outbound traffic: positive / Inbound traffic: negative
<?php else: ?>

View File

@ -7,9 +7,7 @@
require_once('func.inc');
$ntop = 20;
if ($_GET['n'])
if (isset($_GET['n']))
$ntop = (int)$_GET['n'];
if ($ntop > 200)
$ntop = 200;
@ -90,7 +88,7 @@ foreach ($knownlinks as $link) {
</div>
<div id="footer">
AS-Stats v1.31 written by Manuel Kasper, Monzoon Networks AG.<br/>
AS-Stats v1.32 written by Manuel Kasper, Monzoon Networks AG.<br/>
<?php if ($outispositive): ?>
Outbound traffic: positive / Inbound traffic: negative
<?php else: ?>