- Option to stack IPv4 and IPv6 together

- defaults update
This commit is contained in:
Raf 2018-05-10 13:19:25 +02:00
parent 5b1f2af37a
commit 852cc43567
5 changed files with 53 additions and 16 deletions

View File

@ -2,23 +2,23 @@
/* changes these values to suit your local configuration */ /* changes these values to suit your local configuration */
$rrdpath = "/data/as-stats/rrd"; $rrdpath = "/var/cache/as-stats/rrd";
$daystatsfile = "/data/as-stats/asstats_day.txt"; $daystatsfile = "/var/cache/as-stats/asstats_day.sqlite";
$rrdtool = "/usr/bin/rrdtool"; $rrdtool = "/usr/bin/rrdtool";
$daypeerstatsfile = "/data/as-stats/peerasstats_day.txt"; $daypeerstatsfile = "/var/cache/as-stats/peerasstats_day.txt";
$showpeeras = false; $showpeeras = false;
$asinfofile = "asinfo.txt"; $asinfofile = "asinfo.txt";
$knownlinksfile = "/data/as-stats/conf/knownlinks"; $knownlinksfile = "/opt/AS-Stats/conf/knownlinks";
$outispositive = true; $outispositive = false;
$show95th = true; $show95th = true;
$ntop = 20; $ntop = 100;
$showv6 = true; $showv6 = true;
$showtitledetail = true; $showtitledetail = true;
$vertical_label = true; # vertical IN/OUT label in graph $vertical_label = true; # vertical IN/OUT label in graph
$brighten_negative = true; # brighten the "negative" part of graphs $brighten_negative = false; # brighten the "negative" part of graphs
$whois = "/usr/bin/whois"; $whois = "/usr/bin/whois";
$assetpath = "asset"; $assetpath = "asset";
@ -45,12 +45,13 @@ $top_intervals[] = array(
'statsfile' => '/data/as-stats/asstats_week.txt', 'statsfile' => '/data/as-stats/asstats_week.txt',
'label' => '1 week' 'label' => '1 week'
); );
*/
$top_intervals[] = array( $top_intervals[] = array(
'hours' => 30*24, 'hours' => 30*24,
'statsfile' => '/data/as-stats/asstats_month.txt', 'statsfile' => '/var/cache/as-stats/asstats_month.sqlite',
'label' => '30 days' 'label' => '30 days'
); );
*/ /**/
/* END - no closing php tag needed here (prevents problems with stray whitespace) */ /* END - no closing php tag needed here (prevents problems with stray whitespace) */

View File

@ -8,11 +8,11 @@ $default_graph_height = 360;
/* Size of graphs on top N AS page */ /* Size of graphs on top N AS page */
$top_graph_width = 600; $top_graph_width = 600;
$top_graph_height = 220; $top_graph_height = 250;
/* Size of graphs on AS-Set page */ /* Size of graphs on AS-Set page */
$asset_graph_width = 600; $asset_graph_width = 600;
$asset_graph_height = 200; $asset_graph_height = 250;
/* Defaults for other settings, introduced in recent versions */ /* Defaults for other settings, introduced in recent versions */
$vertical_label = true; # vertical IN/OUT label in graph $vertical_label = true; # vertical IN/OUT label in graph

View File

@ -238,7 +238,11 @@ function getHTMLImg($as, $ipversion, $desc, $start, $end, $peerusage, $alt, $cla
global $top_graph_width; global $top_graph_width;
global $top_graph_height; global $top_graph_height;
$dname = rawurlencode("AS$as - $desc - IPV$ipversion"); $ipvstring = "$ipversion";
if($ipversion == 0 || $ipversion == 46 || $ipversion == 64)
$ipvstring = "4+IPv6";
$dname = rawurlencode("AS$as - $desc - IPv$ipvstring");
$result = "<img alt='$alt' class='$class' src='gengraph.php?v=$ipversion&as=$as&peerusage=$peerusage&dname=$dname&start=$start&end=$end"; $result = "<img alt='$alt' class='$class' src='gengraph.php?v=$ipversion&as=$as&peerusage=$peerusage&dname=$dname&start=$start&end=$end";
if(!$history) if(!$history)

View File

@ -22,7 +22,12 @@ if (isset($_GET['height']))
$v6_el = ""; $v6_el = "";
if (@$_GET['v'] == 6) if (@$_GET['v'] == 6)
$v6_el = "v6_"; $v6_el = "v6_";
$mixv4v6 = false;
$versionstring = @$_GET['v'];
if (@$_GET['v'] == 0 || @$_GET['v'] == 10 || @$_GET['v'] == 46 || @$_GET['v'] == 64) {
$mixv4v6 = true;
$versionstring = '4 + IPv6';
}
if(isset($_GET['peerusage']) && $_GET['peerusage'] == '1') if(isset($_GET['peerusage']) && $_GET['peerusage'] == '1')
$peerusage = 1; $peerusage = 1;
else else
@ -46,6 +51,18 @@ if(isset($_GET['selected_links'])){
$knownlinks = $links; $knownlinks = $links;
} }
if ($mixv4v6) {
$v6links = array();
foreach ($knownlinks as $v4link) {
$tag6 = $v4link['tag']."_v6";
$link = array('tag' => $tag6,
'color' => $v4link['color'],
'descr' => $v4link['descr']);
$v6links[] = $link;
}
$knownlinks = array_merge($knownlinks, $v6links);
}
$rrdfile = getRRDFileForAS($as, $peerusage); $rrdfile = getRRDFileForAS($as, $peerusage);
if ($compat_rrdtool12) { if ($compat_rrdtool12) {
@ -74,7 +91,7 @@ if($showtitledetail && @$_GET['dname'] != "")
$cmd .= "--title " . escapeshellarg($_GET['dname']) . " "; $cmd .= "--title " . escapeshellarg($_GET['dname']) . " ";
else else
if (isset($_GET['v']) && is_numeric($_GET['v'])) if (isset($_GET['v']) && is_numeric($_GET['v']))
$cmd .= "--title IPv" . $_GET['v'] . " "; $cmd .= "--title IPv" . $versionstring . " ";
if (isset($_GET['nolegend'])) if (isset($_GET['nolegend']))
$cmd .= "--no-legend "; $cmd .= "--no-legend ";

View File

@ -19,6 +19,12 @@ $hours = 24;
if (@$_GET['numhours']) if (@$_GET['numhours'])
$hours = (int)$_GET['numhours']; $hours = (int)$_GET['numhours'];
$mixv4v6 = false;
if (isset($_GET['mixv4v6'])) {
$mixv4v6 = $_GET['mixv4v6'];
$showv6 = false;
}
if ($peerusage) if ($peerusage)
$statsfile = $daypeerstatsfile; $statsfile = $daypeerstatsfile;
else { else {
@ -82,10 +88,14 @@ $class = (($i % 2) == 0) ? "even" : "odd";
</div> </div>
<div class="small">IPv4: ~ <?php echo format_bytes($nbytes[0]); ?> in / <div class="small">IPv4: ~ <?php echo format_bytes($nbytes[0]); ?> in /
<?php echo format_bytes($nbytes[1]); ?> out in the last <?php echo $label?></div> <?php echo format_bytes($nbytes[1]); ?> out in the last <?php echo $label?></div>
<?php if ($showv6): ?> <?php if ($showv6 || $mixv4v6): ?>
<div class="small">IPv6: ~ <?php echo format_bytes($nbytes[2]); ?> in / <div class="small">IPv6: ~ <?php echo format_bytes($nbytes[2]); ?> in /
<?php echo format_bytes($nbytes[3]); ?> out in the last <?php echo $label?></div> <?php echo format_bytes($nbytes[3]); ?> out in the last <?php echo $label?></div>
<?php endif; ?> <?php endif; ?>
<?php if ($mixv4v6): ?>
<div class="small">Total: ~ <?php echo format_bytes($nbytes[0]+$nbytes[2]); ?> in /
<?php echo format_bytes($nbytes[1]+$nbytes[3]); ?> out in the last <?php echo $label?></div>
<?php endif; ?>
<?php if (!empty($customlinks)): ?> <?php if (!empty($customlinks)): ?>
<div class="customlinks"> <div class="customlinks">
@ -106,7 +116,11 @@ echo join(" | ", $htmllinks);
</th> </th>
<td> <td>
<?php <?php
echo getHTMLUrl($as, 4, $asinfo['descr'], $start, $end, $peerusage, $selected_links); if ($mixv4v6) {
echo getHTMLUrl($as, 0, $asinfo['descr'], $start, $end, $peerusage, $selected_links);
} else {
echo getHTMLUrl($as, 4, $asinfo['descr'], $start, $end, $peerusage, $selected_links);
}
if ($showv6) if ($showv6)
echo getHTMLUrl($as, 6, $asinfo['descr'], $start, $end, $peerusage, $selected_links); echo getHTMLUrl($as, 6, $asinfo['descr'], $start, $end, $peerusage, $selected_links);
?> ?>
@ -120,6 +134,7 @@ echo join(" | ", $htmllinks);
<form method='get'> <form method='get'>
<input type='hidden' name='numhours' value='<?php echo $hours; ?>'/> <input type='hidden' name='numhours' value='<?php echo $hours; ?>'/>
<input type='hidden' name='n' value='<?php echo $ntop; ?>'/> <input type='hidden' name='n' value='<?php echo $ntop; ?>'/>
<input type="checkbox" name="mixv4v6" value="true" <?php if($mixv4v6) echo 'checked'; ?>>Add v4+v6</input>
<table> <table>
<?php <?php
$knownlinks = getknownlinks(); $knownlinks = getknownlinks();