root/trunk/web/data/datamatgraph.php @ 140

Revision 140, 2.0 KB (checked in by andreu, 12 years ago)

Update web interface - BGP AS section -

Line 
1<?php
2
3include ('get_param.php');
4
5print "<div id=\"contenu\">\n";
6
7$CONFfinputRTR = fopen($router_list_file,'r');
8while (!feof ($CONFfinputRTR)) {
9  $CONFline = fgets($CONFfinputRTR, 512);
10  $CONFline_split = split(" ",$CONFline);
11  $CONFrouter_name[$CONFline_split[0]] =  $CONFline_split[1];
12 }
13fclose($CONFfinputRTR);
14
15$CONFfinputSUB = fopen($subnet_list_file,'r');
16$IDR_hash = NULL;
17while (!feof ($CONFfinputSUB)) {
18  $CONFline = fgets($CONFfinputSUB, 512);
19  $CONFline_split = split("\t",$CONFline);
20  $CONFline_split2 = split("-",$CONFline_split[0]);
21  $IDR_hash[$CONFline_split2[1]] = 1;
22 }
23fclose($CONFfinputSUB);
24$IDR_hash[55] = 1;
25
26$dir = $CONF_MATRIX_RRD_LOCATION;
27$i=1;
28if (is_dir($dir)) {
29    if ($dh = opendir($dir)) {
30        while (($file = readdir($dh)) !== false) {
31            if ( filetype($dir . $file) == "file" ) {
32                $files[] = $file;
33            }
34        }
35        sort($files);
36        foreach ($files as $name){
37      if (substr_count($name,".rrd")>0) {
38        $filename_split = split("\.",$name);
39        $pop_split = split("_",$filename_split[0]);
40        $POP1 = $pop_split[0];
41        $name1 = $CONFrouter_name[$pop_split[0]];
42        $POP2 = $pop_split[1];
43        $name2 = $CONFrouter_name[$pop_split[1]];
44        if ($IDR_hash[$POP1] == 1 && $IDR_hash[$POP2] == 1) {
45          $pngname = "img_monotoring/".$POP1."_".$POP2.".png";
46          $rrdname = "$dir/$name";
47          $samp = 10;
48##          echo "rrdtool graph $pngname -s -1D --title \"$Descr\" --vertical-label \"bits/s\" DEF:BytesG=$rrdname:Bytes:AVERAGE CDEF:input10=BytesG,8,*,5,/,60,/,$samp,* AREA:input10\#00FF00:\"b/s\\n\" COMMENT:\"\s\" COMMENT:\"\s\" COMMENT:\"$name1 to $name2\c\"";
49          $res = `rrdtool graph $pngname -s -1D --title "$name1 to $name2" --vertical-label "bits/s" -W "data source: RENETCOL" DEF:BytesG=$rrdname:Bytes:AVERAGE CDEF:input10=BytesG,8,*,5,/,60,/,$samp,* AREA:input10\#8FA3AD:"b/s\\n" COMMENT:"\s" COMMENT:"\s" COMMENT:"\c"`;
50          print "<p>$name1 to $name2 <br> <img width=\"497\" heigth=\"189\" src=\"$pngname\"> </p> ";
51        }
52      }
53        }
54    }
55 }
56
57print "</div>\n";
58
59?>
Note: See TracBrowser for help on using the browser.