* 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 a simple tool to generate per-AS traffic graphs from NetFlow/sFlow records
by Manuel Kasper, Monzoon Networks AG <mkasper@monzoon.net> by Manuel Kasper, Monzoon Networks AG <mkasper@monzoon.net>
-------------------------------------------------------------------- --------------------------------------------------------------------
Changes 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) (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 v1.31 Set memory_limit to 256 MB in PHP pages (suggested by Steve Colam
<steve@colam.co.uk>). <steve@colam.co.uk>).

View File

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

View File

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

View File

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

View File

@ -59,7 +59,7 @@ AS: <input type="text" name="as" size="6" />
<?php endif; ?> <?php endif; ?>
<div id="footer"> <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): ?> <?php if ($outispositive): ?>
Outbound traffic: positive / Inbound traffic: negative Outbound traffic: positive / Inbound traffic: negative
<?php else: ?> <?php else: ?>

View File

@ -45,7 +45,7 @@ $class = (($i % 2) == 0) ? "even" : "odd";
</table> </table>
<div id="footer"> <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): ?> <?php if ($outispositive): ?>
Outbound traffic: positive / Inbound traffic: negative Outbound traffic: positive / Inbound traffic: negative
<?php else: ?> <?php else: ?>

View File

@ -7,9 +7,7 @@
require_once('func.inc'); require_once('func.inc');
$ntop = 20; if (isset($_GET['n']))
if ($_GET['n'])
$ntop = (int)$_GET['n']; $ntop = (int)$_GET['n'];
if ($ntop > 200) if ($ntop > 200)
$ntop = 200; $ntop = 200;
@ -90,7 +88,7 @@ foreach ($knownlinks as $link) {
</div> </div>
<div id="footer"> <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): ?> <?php if ($outispositive): ?>
Outbound traffic: positive / Inbound traffic: negative Outbound traffic: positive / Inbound traffic: negative
<?php else: ?> <?php else: ?>