mirror of
https://github.com/manuelkasper/AS-Stats.git
synced 2025-02-20 11:44:12 +08:00
add peeras to functions
This commit is contained in:
parent
4d7a908fd9
commit
e3a1174d5d
27
www/func.inc
27
www/func.inc
@ -95,11 +95,17 @@ function getknownlinks() {
|
|||||||
return $knownlinks;
|
return $knownlinks;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getasstats_top($ntop) {
|
function getasstats_top($ntop, $peer = 0) {
|
||||||
global $daystatsfile;
|
if($peer == 0){
|
||||||
|
global $daystatsfile;
|
||||||
|
$statfile = $daystatsfile;
|
||||||
|
}else{
|
||||||
|
global $daypeerstatsfile;
|
||||||
|
$statfile = $daypeerstatsfile;
|
||||||
|
}
|
||||||
|
|
||||||
/* first step: walk the data for all ASes to determine the top 5 for the given link */
|
/* first step: walk the data for all ASes to determine the top 5 for the given link */
|
||||||
$fd = fopen($daystatsfile, "r");
|
$fd = fopen($statfile, "r");
|
||||||
if (!$fd)
|
if (!$fd)
|
||||||
return array();
|
return array();
|
||||||
$cols = explode("\t", trim(fgets($fd)));
|
$cols = explode("\t", trim(fgets($fd)));
|
||||||
@ -152,9 +158,10 @@ function format_bytes($bytes) {
|
|||||||
return "$bytes bytes";
|
return "$bytes bytes";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRRDFileForAS($as) {
|
function getRRDFileForAS($as, $peer = 0) {
|
||||||
global $rrdpath;
|
global $rrdpath;
|
||||||
return "$rrdpath/" . sprintf("%02x", $as % 256) . "/$as.rrd";
|
$prefix = ($peer == 1) ? "$rrdpath/peeras" : "$rrdpath";
|
||||||
|
return "$prefix/" . sprintf("%02x", $as % 256) . "/$as.rrd";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getASSET($asset) {
|
function getASSET($asset) {
|
||||||
@ -221,20 +228,20 @@ function clearCacheFileASSET($asset) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# return the html used in top.php : <a href=blabla><img src=blabla/></url>
|
# return the html used in top.php : <a href=blabla><img src=blabla/></url>
|
||||||
function getHTMLUrl($as, $ipversion, $desc, $start, $end){
|
function getHTMLUrl($as, $ipversion, $desc, $start, $end, $peerusage){
|
||||||
$img = getHTMLImg($as, $ipversion, $desc, $start, $end, '', '', false);
|
$img = getHTMLImg($as, $ipversion, $desc, $start, $end, $peerusage, '', '', false);
|
||||||
$result = "<a href='history.php?as=$as&v=$ipversion' target='_blank'>$img</a>";
|
$result = "<a href='history.php?as=$as&peerusage=$peerusage&v=$ipversion' target='_blank'>$img</a>";
|
||||||
return($result);
|
return($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
# return the html used in history.php (for example) : <img src=blabla/>
|
# return the html used in history.php (for example) : <img src=blabla/>
|
||||||
function getHTMLImg($as, $ipversion, $desc, $start, $end, $alt, $class, $history = false){
|
function getHTMLImg($as, $ipversion, $desc, $start, $end, $peerusage, $alt, $class, $history = false){
|
||||||
global $top_graph_width;
|
global $top_graph_width;
|
||||||
global $top_graph_height;
|
global $top_graph_height;
|
||||||
|
|
||||||
$dname = rawurlencode("AS$as - $desc - IPV$ipversion");
|
$dname = rawurlencode("AS$as - $desc - IPV$ipversion");
|
||||||
|
|
||||||
$result = "<img alt='$alt' class='$class' src='gengraph.php?v=$ipversion&as=$as&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)
|
||||||
$result .= "&width=$top_graph_width&height=$top_graph_height&nolegend=1";
|
$result .= "&width=$top_graph_width&height=$top_graph_height&nolegend=1";
|
||||||
$result .= "'";
|
$result .= "'";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user