Giter Site home page Giter Site logo

as-stats-gui's Introduction

AS-Stats WebGUI

New WebGUI for tool AS-Stats writted by Manuel Kasper [email protected] for Monzoon Networks AG.

See AS-Stats Repository for more details.

This WebUI is based on AdminLTE.

Screenshot

AS-Stats Screenshot 1 AS-Stats Screenshot 2 AS-Stats Screenshot 3

How to

Replace 'www' directory from AS-Stats by this Repository.

config file are same from AS-Stats Repository.

Since release v0.2

In the configuration file, there is an additional option "$my_asn".

If you put your AS number, the 'View IX Stats' page display the list of your IXs on which you are present.

This allows you to display the stats of all members of your IX.

!!! You must have your data up-to-date on the peeringdb.com database.

as-stats-gui's People

Contributors

exagone313 avatar fjbf avatar huguesdelamure avatar nidebr avatar zlobar avatar zxyz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

as-stats-gui's Issues

View IX-Stats error

When clicking on "View IX Stats", you receive the error in your log file:

PHP Fatal error: Uncaught Error: [] operator not supported for strings in /var/www/html/as-stats/lib/class/peeringdb.php:87\nStack trace:\n#0 /var/www/html/as-stats/ix.php(119): PeeringDB->GetIXASN(<IX ASN>)\n#1 {main}\n thrown in /var/www/html/as-stats/lib/class/peeringdb.php on line 87

I traced the error back to lib/class/peeringdb.php line 82.
Replacing

$return = "";

With

$return = [];

Resolved the issues for me.

SQLite3 error no such table

Hi!
I have a problem starting the web server. In the errors logs apache2 shows:
[Sat Sep 11 00: 09: 49.700320 2021] [php7: warn] [pid 3002099] [client 10.10.10.4:41349] PHP Warning: SQLite3 :: query (): Unable to prepare statement: 1, no such table: stats in /opt/asstats/www/func.inc on line 125

[Sat Sep 11 00: 09: 49.700386 2021] [php7: error] [pid 3002099] [client 10.10.10.4:41349] PHP Fatal error: Uncaught Error: Call to a member function fetchArray () on bool in / opt / asstats /www/func.inc:127\nStack trace: \ n # 0 /opt/asstats/www/index.php(25): getasstats_top () \ n # 1 {main} \ n thrown in / opt / asstats / www /func.inc on line 127

Installed php7.4 and package php7.4-sqlite3

What could be the problem?
Thanks.

asstats_day.txt Issue ?

Hi

i want test your gui, but if i pout the good path of:
$daystatsfile = "/var/www/as-stats/asstats_day.txt";
in config.inc, i have a blank screen and in logs:

PHP Warning: SQLite3::query(): Unable to prepare statement: 26, file is encrypted or is not a database in /var/www/as-stats/www/func.inc on line 101

PHP Fatal error: Call to a member function fetchArray() on a non-object in /var/www/as-stats/www/func.inc on line 103

do you know this errors ?

regards

sqlite error after cloning

Hi
We used all the time the original as-stats GUI from Kaspar. now i cloned yours.
But got the error, after opening the index.php page:
The file sqlite3.php could not be found.
I could not find any refering code to this file. Do i need something special packet?
we use ubuntu Server 16.04

Traffic IPv6 0 bytes / Link Usage Tab

Hi,
First I would like to praise the project, which is very well built and documented.
I have a problem with the information in the graph, ipv4 traffic is ok, it shows information corresponding to the graph, now ipv6 appears consumption in the graph but in the information it displays 0bytes.

I would like to better understand the Link Usage tab, it would represent the top 10 traffic per link, correct? In mine it presents completely different information, where in one link the top 10 ASN really appears, but in the other links they present ASN that did not even have traffic.

Thanks.

size and format of graphs

I believe this is a feature request too.

It would be nice to be able to adjust number of graphs per row and possible their relative size. Some of my efforts can be found here

Edit: size of the graphs can be adjusted on config_defaults.inc

disable IPv6

Greetings,

This is mainly a feature request.

Having an option to disable IPv6 would be handy for some IPv4 only setups.

Thank you for offering as-stats-gui to the open-source community.

as-info updated ?

Hello,

I have downloaded the last asinfo.txt
Do you have any mechanism to update this file with the real AS Name ?

IPv4 and IPv6 Totals

Modified func.php and linkgraph.php to obtain different graphs for IPv4 and IPv6 on Link Usage Tab:

diff --git a/func.inc b/func.inc
index 67e4cdc..489fc12 100644
--- a/func.inc
+++ b/func.inc
@@ -89,7 +89,7 @@ function getknownlinks() {
return $knownlinks;
}

-function getasstats_top($ntop, $statfile, $selected_links, $list_asn = NULL) {
+function getasstats_top($ntop, $statfile, $selected_links, $list_asn = NULL, $v = 4) {
try{
$db = new SQLite3($statfile);
}catch(Exception $e){
@@ -104,9 +104,17 @@ function getasstats_top($ntop, $statfile, $selected_links, $list_asn = NULL) {
$query_total = '0';
$query_links = '';
foreach($selected_links as $tag){

  •           $query_links .= "${tag}_in, ${tag}_out, ${tag}_v6_in, ${tag}_v6_out, ";
    
  •           if ($v == 4) {
    
  •                   $query_links .= "${tag}_in, ${tag}_out, ";
    
  •           } else {
    
  •                   $query_links .= "${tag}_v6_in, ${tag}_v6_out, ";
    
  •           }
              $nlinks += 4;
    
  •           $query_total .= " + ${tag}_in + ${tag}_out + ${tag}_v6_in + ${tag}_v6_out";
    
  •           if ($v == 4) {
    
  •                   $query_total .= " + ${tag}_in + ${tag}_out";
    
  •           } else {
    
  •                   $query_total .= " + ${tag}_v6_in + ${tag}_v6_out";
    
  •           }
      }
    
    if ( $list_asn ) {
    $where = implode(",", $list_asn);

diff --git a/linkgraph.php b/linkgraph.php
index 3e9692d..a8900f6 100644
--- a/linkgraph.php
+++ b/linkgraph.php
@@ -23,7 +23,11 @@ if (@$_GET['numhours'])
$hours = (int)$_GET['numhours'];

$statsfile = statsFileForHours($hours);
-$topas = getasstats_top($numtop, $statsfile, array($_GET['link']));
+if (@$_GET['v'] == 6) {

  •   $topas = getasstats_top($numtop, $statsfile, array($_GET['link']), $list_asn = NULL, $v=6);
    

+}else {

  •   $topas = getasstats_top($numtop, $statsfile, array($_GET['link']));
    

+}

/* now make a beautiful graph :) */
header("Content-Type: image/png");

asstats_week.txt & asstats_month.txt

hi,
please tell me. what are these structures responsible for "config.inc". I didn't find any such paths in the" www" folder

$top_intervals[] = array(
'hours' => 724,
'statsfile' => '/data/as-stats/asstats_week.txt',
'label' => '1 week'
);
$top_intervals[] = array(
'hours' => 30
24,
'statsfile' => '/data/as-stats/asstats_month.txt',
'label' => '30 days'
);

data gathered, top20 counters changing, but graphs "blank" (the image not generated)

Hi! Maybe you could share tips - where to look further, if you have the time. Thank you!
The Picture links are empty, like the "url' is not resolved/timed out in "Home" view, and in History (if clicked one of the "empty graph links").

Is it OK if I import only V4 data? (v4 data has some counters, v6 data is 0)
example:

In the last 24 hours
IPv4: ~ 230.17 GB in / 314.36 GB
IPv6: ~ 0 bytes in / 0 bytes

Maybe you could suggest what to double check? Nginx isn't giving any errors in error.log, but the graphs stay empty.
Data is being processed as the top20 kept changing and ASN is showing some data In/Out.
Only the graphs are not generated.
If I open the gengraph directly: gengraph.php (without Post prameters) -> returns message that "Invalid ASN".

from the "installAS-Stats.sh" script, I hope (i really tried to check everything that I got it correctly from the list):
yum install -y httpd httpd-devel php php-gd phpimap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mcrypt curl curl-devel perl-libwwwperl libxml2 php-mbstring rrdtool perl-rrdtool
My install is on debian, I searched for alternatives on Debian, instead of httpd (apache), I have nginx on that server.
(from php info file I believe I have the packages)

nginx.access logs entry (one of several):
10.159.55.22 - - [03/Dec/2020:20:05:40 +0200] "GET /gengraph.php?v=6&as=20446&peerusage=0&dname=AS20446%20-%20Highwinds%20Network%20Group%2C%20Inc.%2CUS%20-%20IPV6&start=1606932339&end=1607018739&width=600&height=220&nolegend=1 HTTP/1.1" 200 5 "http://10.253.0.1:81/index.php" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"

I've set the memory limit to 512M. (verified in phpinfo)

Don't know where to look for debug more. :(

Thanks to anybody if you have ideas!

Dirty code

Hi,

The whole code is dirty, I easily found XSS vulnerabilities (see #6).
To make the code properly maintainable, the least is to have layout (HTML, templates) separated from computation, but each kind of "component" should be clearly separated (abstraction). Also, code is written with weird PHP practices (like @$var, == instead of === when inappropriate, etc...).

If someone is willing to rewrite everything, users would surely appreciate.

Missing argument when menu() function is called from history.php

PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function menu(), 0 passed in /opt/as-stats-gui/history.php on line 72 and exactly 1 expected in /opt/as-stats-gui/func.inc:256 Stack trace:
#0 /opt/as-stats-gui/history.php(72): menu() #1 {main} thrown in /opt/as-stats-gui/func.inc on line 256

It will be the same story for asset.php, linkusage.php and sample-blank.php

Small patch included as an attachment. Tested with the latest GIT version.
as-stats-gui_patch.txt

.

Combine all traffic that traverses an AS

Is it possible somehow to combine all traffic that traverses over an AS. Basically where this ASN is in the path. For instance a Tier 1 ISP like Arelion AS1299, if we enter 1299, it will only show direct traffic towards AS1299. It would be great to have an option to find all traffic that passes through AS1299 aswell, to see how much traffic we actually have with AS1299.

Any way thats possible to do?

SQLite errors

[16-Sep-2020 09:46:32 UTC] PHP Warning: SQLite3::query(): Unable to prepare statement: 1, no such column: deg_in in /opt/as-stats/www/func.inc on line 125
[16-Sep-2020 09:46:32 UTC] PHP Fatal error: Uncaught Error: Call to a member function fetchArray() on boolean in /opt/as-stats/www/func.inc:127
Stack trace:
#0 /opt/as-stats/www/index.php(25): getasstats_top(20, '/opt/as-stats/a...', Array)
#1 {main}
thrown in /opt/as-stats/www/func.inc on line 127

Seeing this in my php errors - any ideas?

Check for valid knownlinks in gengraph too restrictive, missing _

Hi,

We have knownlinks that have a tag like :

Abcd_EFGH567
Mnop_QRST123

Since the latest commits, a new check in gengraph appeared :

-       foreach(explode(',', $_GET['selected_links']) as $tag){
+    foreach(explode(',', $_GET['selected_links']) as $tag){
+        if (preg_match('/[^a-zA-Z0-9]/', $tag))
+            continue;

This regular expression does not match our knownlinks tags due to the '_' character, and hence breaks the graphs.

The latest AS-stats master states :

"max. length for tag is 12 characters; allowed characters: a-z A-Z 0-9 _"

So '_' should be added to the regular expression as well :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.