root/trunk/web/data/datamatrix.php @ 123

Revision 123, 2.6 KB (checked in by andreu, 12 years ago)

add TIPs in matrix

Line 
1<?php
2
3include ('get_param.php');
4
5print "<div id=\"contenu\">\n";
6
7print "<p> In this data mining section, you will find the matrix of traffic between the POP number defined in the following configuration files: </p>\n";
8print "<li>$subnet_list_file</li>\n";
9print "<li>$ROUTERS_FILE</li>\n";
10
11$CONFfinputSUB = fopen($subnet_list_file,'r');
12$IDR_hash = NULL;
13while (!feof ($CONFfinputSUB)) {
14  $CONFline = fgets($CONFfinputSUB, 512);
15  $CONFline_split = split("\t",$CONFline);
16  $CONFline_split2 = split("-",$CONFline_split[0]);
17  $IDR_hash[$CONFline_split2[1]] = 1;
18 }
19fclose($CONFfinputSUB);
20$IDR_hash[55] = 1;
21
22$CONFfinputRTR = fopen($router_list_file,'r');
23while (!feof ($CONFfinputRTR)) {
24  $CONFline = fgets($CONFfinputRTR, 512);
25  $CONFline_split = split(" ",$CONFline);
26  $CONFrouter_name[$CONFline_split[0]] =  $CONFline_split[1];
27 }
28fclose($CONFfinputRTR);
29
30print "<p> List of POPs included in the matrix: </p>";
31foreach ($IDR_hash as $keyIDR => $valueIDR) {
32  if ($keyIDR) {
33    $tmp = $CONFrouter_name[$keyIDR];
34    print "<li> $keyIDR ($tmp) </li>\n";
35  }
36}
37
38print "<p> The matrix: <br>";
39print "Debit (in Mb/s) in the last 5 minutes. </p>\n";
40$MATRIX_TABLE_INBUILT = "";
41$MATRIX_TABLE_INBUILT.= "<table class=\"fields\">\n";
42$MATRIX_TABLE_INBUILT.= "<tr> <th> </th>\n";
43foreach ($IDR_hash as $keyIDR => $valueIDR) {
44  if ($keyIDR) {
45    $MATRIX_TABLE_INBUILT.= " <th>_$keyIDR _</th>\n";
46  }
47}
48$MATRIX_TABLE_INBUILT.= "</tr>\n";
49
50$IDR_hash2 = $IDR_hash;
51foreach ($IDR_hash as $keyIDR => $valueIDR) {
52  if ($keyIDR) {
53    $MATRIX_TABLE_INBUILT.= " <tr>  <th>_$keyIDR _</th> ";
54    foreach ($IDR_hash2 as $keyIDR2 => $valueIDR2) {
55      ## get rrd file value
56      if ($keyIDR2) {
57      $rrdfilename = $rrdmatrixpath.$CONF_MATRIX_RRD_LOCATION.$keyIDR."_".$keyIDR2.".rrd";
58      $res = `rrdtool fetch $rrdfilename -s -600 AVERAGE | grep -v nan | grep ":" `;
59      $ressplit = split(" ", $res);
60      ## FIXME *10
61      $bytes = number_format($ressplit[2]*10*8/300/1000000,0," "," ");
62      $MATRIX_TABLE_INBUILT.= " <td> ";
63    if ($keyIDR2 == $keyIDR) {
64      $MATRIX_TABLE_INBUILT.= " - ";
65    } else {
66      $MATRIX_TABLE_INBUILT.= "  <div id=\"tipbox\"> \n";
67      $MATRIX_TABLE_INBUILT.= "<a href=\"\"> $bytes </a>\n";
68      $MATRIX_TABLE_INBUILT.= "<div>\n";
69      $tmp2 = $CONFrouter_name[$keyIDR];
70      $tmp3 = $CONFrouter_name[$keyIDR2];
71      $MATRIX_TABLE_INBUILT.= " $tmp2 -> $tmp3 ";
72      $MATRIX_TABLE_INBUILT.= "</div>\n";
73      $MATRIX_TABLE_INBUILT.= "</div>\n";
74    }
75      $MATRIX_TABLE_INBUILT.= "</td> ";
76      }
77    }
78    $MATRIX_TABLE_INBUILT.= " </tr> \n";
79  }
80}
81$MATRIX_TABLE_INBUILT.= "</table>\n";
82
83print "$MATRIX_TABLE_INBUILT";
84
85print "</div>\n";
86
87?>
Note: See TracBrowser for help on using the browser.