root/trunk/web/data/databgpas.php

Revision 142, 5.1 KB (checked in by andreu, 12 years ago)

add packet graphic

Line 
1<?php
2
3include ('get_param.php');
4
5print "<div id=\"contenu\">\n";
6
7print "<p> Choose a BGP AS: </p>\n";
8
9$DIR = $CONF_BGPAS_RRD_LOCATION;
10$ind=0;
11$tabfile = NULL;
12$files = NULL;
13
14if (is_dir($DIR)){
15  if ($do = opendir($DIR)) {
16    while (($file = readdir($do)) !== false) {
17      if ( filetype($DIR . $file) == "file" and strpos($file,".rrd") != FALSE ){
18    $files[] = $file;
19      }
20    }
21    sort($files);
22  } else {
23    print "Error when opening the directory defined in your renetcolParam.h file!! Please check the path and right for variable \"AS_RRD_LOCATION\".\n";
24  }
25 }else{
26  print "Error, the directory defined in your renetcolParam.h file doesn't exist!! Please check the variable \"AS_RRD_LOCATION\".\n";
27 }
28
29print "<form action=\"index.php?section=databgpas\" method=\"POST\">\n";
30print "BGP AS: <SELECT NAME=\"bgpas\">\n";
31for ($p=0; $p < sizeof($files); $p++ ) {
32  $completefile = split("_",$files[$p]);
33  $theAS = $completefile[0];
34  if ( $indice == $p ) {
35    print "<OPTION SELECTED VALUE=\"$files[$p]\">$theAS\n";
36  } else {
37    print "<OPTION VALUE=\"$files[$p]\">$theAS\n";
38  }
39 }
40
41print "</SELECT>\n";
42print "<INPUT TYPE=\"submit\" VALUE=\" go \">. <P>\n";
43print "</FORM>\n";
44
45if ($bgpas != "") {
46  $completefile = split("_",$bgpas);
47  $theAS = $completefile[0];
48
49  print "You have choose the BGP AS $theAS.<br>\n";
50
51  $tmp = split("\.",$completefile[1]);
52  $samp = $tmp[0];
53  $rrdname = "$DIR/$bgpas";
54  $pngname = "img_monitoring/".$theAS.".png";
55## echo " rrdtool graph $pngname -s -1D --title \"AS $theAS\" --vertical-label \"bits/s\" -W \"data source: RENETCOL\" DEF:InBytesG=$rrdname:inBytes:AVERAGE DEF:OutBytesG=$rrdname:outBytes:AVERAGE CDEF:input10=InBytesG,8,*,5,/,60,/,$samp,* CDEF:output10=OutBytesG,8,*,5,/,60,/,$samp,* AREA:input10\#8FA3AD:\"b/s\\n\" LINE1:output10\#D1D1D1:\"b/s\\n\"  ";
56  $res = `rrdtool graph $pngname -s -1D --title "AS $theAS" --vertical-label "bits/s" -W "data source: RENETCOL" DEF:InBytesG=$rrdname:inBytes:AVERAGE DEF:OutBytesG=$rrdname:outBytes:AVERAGE CDEF:input10=InBytesG,8,*,5,/,60,/,$samp,* CDEF:output10=OutBytesG,8,*,5,/,60,/,$samp,* AREA:input10\#8FA3AD:"From your network to AS $theAS\\n" LINE1:output10\#FF5B2B:"From AS $theAS to your network\\n" COMMENT:"\s" COMMENT:"\s" COMMENT:"\c"`;
57  print "<p> <img width=\"497\" heigth=\"189\" src=\"$pngname\"> </p> ";
58  $pngnameWeek = "img_monitoring/".$theAS."_w.png";
59  $res = `rrdtool graph $pngnameWeek -s -7D --title "AS $theAS" --vertical-label "bits/s" -W "data source: RENETCOL" DEF:InBytesG=$rrdname:inBytes:AVERAGE DEF:OutBytesG=$rrdname:outBytes:AVERAGE CDEF:input10=InBytesG,8,*,5,/,60,/,$samp,* CDEF:output10=OutBytesG,8,*,5,/,60,/,$samp,* AREA:input10\#8FA3AD:"From your network to AS $theAS\\n" LINE1:output10\#FF5B2B:"From AS $theAS to your network\\n" COMMENT:"\s" COMMENT:"\s" COMMENT:"\c"`;
60  print "<p> <img width=\"497\" heigth=\"189\" src=\"$pngnameWeek\"> </p> ";
61  $pngnameMonth = "img_monitoring/".$theAS."_m.png";
62  $res = `rrdtool graph $pngnameMonth -s -31D --title "AS $theAS" --vertical-label "bits/s" -W "data source: RENETCOL" DEF:InBytesG=$rrdname:inBytes:AVERAGE DEF:OutBytesG=$rrdname:outBytes:AVERAGE CDEF:input10=InBytesG,8,*,5,/,60,/,$samp,* CDEF:output10=OutBytesG,8,*,5,/,60,/,$samp,* AREA:input10\#8FA3AD:"From your network to AS $theAS\\n" LINE1:output10\#FF5B2B:"From AS $theAS to your network\\n" COMMENT:"\s" COMMENT:"\s" COMMENT:"\c"`;
63  print "<p> <img width=\"497\" heigth=\"189\" src=\"$pngnameMonth\"> </p> ";
64  $pngnameYear = "img_monitoring/".$theAS."_y.png";
65  $res = `rrdtool graph $pngnameYear -s -365D --title "AS $theAS" --vertical-label "bits/s" -W "data source: RENETCOL" DEF:InBytesG=$rrdname:inBytes:AVERAGE DEF:OutBytesG=$rrdname:outBytes:AVERAGE CDEF:input10=InBytesG,8,*,5,/,60,/,$samp,* CDEF:output10=OutBytesG,8,*,5,/,60,/,$samp,* AREA:input10\#8FA3AD:"From your network to AS $theAS\\n" LINE1:output10\#FF5B2B:"From AS $theAS to your network\\n" COMMENT:"\s" COMMENT:"\s" COMMENT:"\c"`;
66    print "<p> <img width=\"497\" heigth=\"189\" src=\"$pngnameYear\"> </p> ";
67  $pngnamepkts = "img_monitoring/".$theAS."pkts.png";
68##  echo "rrdtool graph $pngnamepkts -s -1D --title \"AS $theAS\" --vertical-label \"packets per seconde\" -W \"data source: RENETCOL\" DEF:InPktsG=$rrdname:inPkts:AVERAGE DEF:OutPktsG=$rrdname:outPkts:AVERAGE CDEF:Pinput10=InPktsG,5,/,60,/,$samp,* CDEF:Poutput10=OutPktsG,5,/,60,/,$samp,* AREA:input10\#8FA3AD:\"From your network to AS $theAS\\n\" LINE1:output10\#FF5B2B:\"From AS $theAS to your network\\n\" COMMENT:\"\s\" COMMENT:\"\s\" COMMENT:\"\c\"  ";
69  $res = `rrdtool graph $pngnamepkts -s -1D --title "AS $theAS" --vertical-label "packets per seconde" -W "data source: RENETCOL" --color CANVAS#E8E8E8 --color BACK#5A5A5A --color FONT#FFFFFF DEF:InPktsG=$rrdname:inPkts:AVERAGE DEF:OutPktsG=$rrdname:outPkts:AVERAGE CDEF:Pinput10=InPktsG,5,/,60,/,$samp,* CDEF:Poutput10=OutPktsG,5,/,60,/,$samp,* AREA:Pinput10\#8FA3AD:"From your network to AS $theAS\\n" LINE1:Poutput10\#FF5B2B:"From AS $theAS to your network\\n" COMMENT:"\s" COMMENT:"\s" COMMENT:"\c"`;
70  print "<p> <img width=\"497\" heigth=\"189\" src=\"$pngnamepkts\"> </p> ";
71
72 }
73print "\n";
74print "\n";
75print "\n";
76print "\n";
77
78print "</div>\n";
79
80?>
Note: See TracBrowser for help on using the browser.