root/trunk/web/perf/menulive.php @ 125

Revision 125, 3.9 KB (checked in by andreu, 12 years ago)

syslog output parameters modification - new web page for monitoring site (log, introduction)

Line 
1<?php
2
3print "        <div id=\"menuV\"> \n";
4print "         <ul class=\"n1\"> \n";
5print "          <li class=\"withsub\"><a href=\"index.php?section=perf\">Perf</a> \n";
6print "           <ul class=\"n2\"> \n";
7print "            <li><a href=\"index.php?section=perfcol\">Collector</a> </li> \n";
8print "            <li><a href=\"index.php?section=perfsys\">System</a> </li> \n";
9print "           </ul> \n";
10print "          </li> \n";
11print "          <li><a href=\"index.php?section=log\">Log</a></li> \n";
12print "          <li><a href=\"index.php?section=out\">Output</a></li> \n";
13print "          <li class=\"withsub\"><a href=\"index.php?section=tpl\">Templates</a>\n";
14print "           <ul class=\"n2\"> \n";
15/* ici recuperer les noms des routeurs dans fichier de conf et créer le menu en fonction */
16$finputRTR= fopen($ROUTERS_FILE,'r');
17$i=0;
18while (!feof ($finputRTR)) {
19  $line = fgets($finputRTR, 512);
20  $line_split = split(" ",$line);
21  if (sizeof($line_split) > 1) {
22    $RTR[$i] = $line_split[2];
23    $RTR_Name[$line_split[2]] = $line_split[1];
24    $RTRwoDot[$i] = str_replace(".","_",$line_split[2]);
25    $i++;
26  }
27 }
28fclose($finputRTR);
29$nb_rtr = $i;
30asort($RTR_Name,SORT_STRING);
31/* trois tableau : nb d'engine par routeurs, nb de template par Engine, nb de optional tpl par routeur */
32$i=0;
33$find = 0;
34$RouterEngineID = array();
35$finputTPL = fopen($TPL_DEF,'r');
36while (!feof ($finputTPL)) {
37  $line = fgets($finputTPL, 512);
38  $line_split = split(" ",$line);
39  if ( $line_split[1] == "TId" ) {
40    $rtr_tmp = $line_split[0];
41    if ($RouterEngineID) {
42      foreach ($RouterEngineID as $k => $engines) {
43    if ($rtr_tmp == $k) {
44      foreach ($engines as $key => $value) {
45        if ( $value == $line_split[3]) {
46          $find = 1;
47        }
48      }
49    }
50      }
51    }
52    if ($find == 0) {
53      $RouterEngineNB[$rtr_tmp] += 1;
54      $indexE = $RouterEngineNB[$rtr_tmp];
55      $RouterEngineID[$rtr_tmp][$indexE] = $line_split[3];
56    }
57    $eng_tmp = $line_split[0]."_".$line_split[3];
58    $EngineTplNB[$eng_tmp] += 1;
59    $indexT = $EngineTplNB[$eng_tmp];
60    $sid = $line_split[3];
61    $RouterEngineTPID[$rtr_tmp][$sid][$indexT] = $line_split[2];
62    $tid = $line_split[2];
63    for ($it=0;$it<sizeof($line_split)-4;$it++) {
64      $RouterEngineTPDEF[$rtr_tmp][$sid][$tid][$it] = $line_split[$it+4];
65    }
66    $find = 0;
67  }
68 }
69fclose($finputTPL);
70
71/* onglets routeurs */
72foreach ($RTR_Name as $ipadd => $router_name) {
73  print "            <li class=\"withsub\"><a href=\"index.php?section=tpl&rtr=$RTRwoDot\">$router_name</a> \n";
74  print "             <ul class=\"n3\"> \n";
75  /*  print "$ipadd";  /* DEBUG */
76  $nb_engine = $RouterEngineNB[$ipadd];
77  for ($eng=1;$eng<=$nb_engine;$eng++){
78    $sourceID = $RouterEngineID[$ipadd][$eng];
79    print "              <li class=\"withsub\"><a href=\"index.php?section=tpl\">Engine ID $sourceID </a> \n";
80    print "               <ul class=\"n4\"> \n";
81    $mykey = $ipadd."_".$sourceID;
82    $TplNB $EngineTplNB[$mykey];
83    /*    print "tplNB $TplNB";  /* DEBUG */
84    for ($t=1;$t<=$TplNB;$t++) {
85      $tid2 = $RouterEngineTPID[$ipadd][$sourceID][$t];
86      $tkey = str_replace(".","_",$ipadd)."_".$sourceID."_".$tid2;
87      print "            <li><a href=\"index.php?section=tpl&tplkey=$tkey\">Tpl $tid2</a> </li> \n";
88      /*       for ($it=0;$it<sizeof($RouterEngineTPDEF[$ipadd][$sourceID][$tid2])-1;$it++) { /*   DEBUG */
89      /*    $tmp = $RouterEngineTPDEF[$ipadd][$sourceID][$tid2][$it]; /*  DEBUG */
90      /*    print " ($tmp) "; /*  DEBUG */
91      /*      } /* DEBUG */
92      /*      print " <br> "; /* DEBUG */
93    }
94    print "               </ul> \n";
95    print "              </li> \n";
96  }
97  print "             </ul> \n";
98  print "            </li> \n";
99}
100print "           </ul> \n";
101print "          </li> \n";
102print "          <li><a href=\"index.php?section=filters\">Filters</a></li> \n";
103print "         </ul> \n";
104print "        </div> \n";
105
106$res = `cat $TPL_DEF | grep " TId " | wc -l | awk '{print $1}'`;
107
108if
109
110?>
Note: See TracBrowser for help on using the browser.