1 | <?php |
---|
2 | |
---|
3 | include ('get_param.php'); |
---|
4 | |
---|
5 | print "<div id=\"contenu\">\n"; |
---|
6 | |
---|
7 | print "<p> Choose a BGP AS: </p>\n"; |
---|
8 | |
---|
9 | $DIR = $CONF_BGPAS_RRD_LOCATION; |
---|
10 | $ind=0; |
---|
11 | $tabfile = NULL; |
---|
12 | $files = NULL; |
---|
13 | |
---|
14 | if (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 | |
---|
29 | print "<form action=\"index.php?section=databgpas\" method=\"POST\">\n"; |
---|
30 | print "BGP AS: <SELECT NAME=\"bgpas\">\n"; |
---|
31 | for ($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 | |
---|
41 | print "</SELECT>\n"; |
---|
42 | print "<INPUT TYPE=\"submit\" VALUE=\" go \">. <P>\n"; |
---|
43 | print "</FORM>\n"; |
---|
44 | |
---|
45 | if ($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 | |
---|
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 | |
---|
59 | $pngnameWeek = "img_monitoring/".$theAS."_w.png"; |
---|
60 | $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"`; |
---|
61 | |
---|
62 | print "<p> <img width=\"497\" heigth=\"189\" src=\"$pngnameWeek\"> </p> "; |
---|
63 | $pngnameMonth = "img_monitoring/".$theAS."_m.png"; |
---|
64 | $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"`; |
---|
65 | |
---|
66 | print "<p> <img width=\"497\" heigth=\"189\" src=\"$pngnameMonth\"> </p> "; |
---|
67 | $pngnameYear = "img_monitoring/".$theAS."_y.png"; |
---|
68 | $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"`; |
---|
69 | |
---|
70 | print "<p> <img width=\"497\" heigth=\"189\" src=\"$pngnameYear\"> </p> "; |
---|
71 | } |
---|
72 | print "\n"; |
---|
73 | print "\n"; |
---|
74 | print "\n"; |
---|
75 | print "\n"; |
---|
76 | |
---|
77 | print "</div>\n"; |
---|
78 | |
---|
79 | ?> |
---|