root/trunk/web/perf/tpl.php @ 120

Revision 120, 5.8 KB (checked in by andreu, 13 years ago)

first monitoring web site

Line 
1<?php
2
3include('fields_list.php');
4
5##$finputTPL = fopen($TPL_DEF,'r');
6
7print "<div id=\"contenu\">\n";
8/*
9 while (!feof ($finputTPL)) {
10 $line = fgets($finputTPL, 512);
11 $line_split = split(" ",$line);
12 if ($line_split[0] == "router") {
13 $tmp = $line_split[1];
14 print "routeur ($line_split[1])\n";
15 } else {
16 print "<p class=\"mycode\">";
17 print "$line<br>\n";
18 print " </p>";
19 }
20 }
21 
22 
23 fclose($finputTPL);
24*/
25
26if ( $tplkey == "" ) {
27  /* no tpl choiced */
28  print " <h2> List of Routers by Engine & Template number</h2> \n";
29  print "<p> An engine (aka sourceID) represents an exporter and we can have few templates by engine (function of interfaces numbers and/or services). Template definition can be found in vertical menu. For more detail on engine and template see <a href=\"https://www.cisco.com/en/US/technologies/tk648/tk362/technologies_white_paper09186a00800a3db9.html\"> the CISCO Documentation</a>. </p>\n";
30  print "<h3> Routers with 6 engines or more </h3>\n";
31  print "<table class=\"fields\">\n";
32  print " <tr> <th> Router Name </th> <th> Engine Number </th> <th> Template Number </th> </tr>\n";
33  for ($k=0;$k<sizeof($RTR);$k++) {
34    $kname = $RTR_Name[$RTR[$k]];
35  ##  $kname = $RouterEngineNB[$k];
36    $knbeng = $RouterEngineNB[$RTR[$k]];
37    $knbtpl = 0;
38    if ($RouterEngineTPID[$RTR[$k]]) {
39      foreach($RouterEngineTPID[$RTR[$k]] as $kkey => $kvalue){
40    $knbtpl += sizeof($kvalue);
41      }
42    } else {
43      $knbeng = 0;
44    }
45    if ($bgc == "#D1D1D1") {
46      $bgc = "#b3b3b3";
47    } else {
48      $bgc = "#D1D1D1";
49    }
50    if ($knbeng >=6) {
51      print " <tr> <td background-color=$bgc> $kname </td> <td background-color=$bgc> $knbeng </td> <td background-color=$bgc> $knbtpl </td> </tr> ";
52    }
53  }
54  print "</table>\n";
55
56  print "<h3> Routers with # engines between 4 and 5 </h3>\n";
57  print "<table class=\"fields\">\n";
58  print " <tr> <th> Router Name </th> <th> Engine Number </th> <th> Template Number </th> </tr>\n";
59  for ($k=0;$k<sizeof($RTR);$k++) {
60    $kname = $RTR_Name[$RTR[$k]];
61##    $kname = $RouterEngineNB[$k];
62    $knbeng = $RouterEngineNB[$RTR[$k]];
63    $knbtpl = 0;
64    if ($RouterEngineTPID[$RTR[$k]]) {
65      foreach($RouterEngineTPID[$RTR[$k]] as $kkey => $kvalue){
66    $knbtpl += sizeof($kvalue);
67      }
68    } else {
69      $knbeng = 0;
70    }
71    if ($bgc == "#D1D1D1") {
72      $bgc = "#b3b3b3";
73    } else {
74      $bgc = "#D1D1D1";
75    }
76    if ($knbeng >=4 and $knbeng <= 5 ) {
77      print " <tr> <td background-color=$bgc> $kname </td> <td background-color=$bgc> $knbeng </td> <td background-color=$bgc> $knbtpl </td> </tr> ";
78    }
79  }
80  print "</table>\n";
81
82  print "<h3> Routers with # engines between 1 and 3 </h3>\n";
83  print "<table class=\"fields\">\n";
84  print " <tr> <th> Router Name </th> <th> Engine Number </th> <th> Template Number </th> </tr>\n";
85  for ($k=0;$k<sizeof($RTR);$k++) {
86    $kname = $RTR_Name[$RTR[$k]];
87##    $kname = $RouterEngineNB[$k];
88    $knbeng = $RouterEngineNB[$RTR[$k]];
89    $knbtpl = 0;
90    if ($RouterEngineTPID[$RTR[$k]]) {
91      foreach($RouterEngineTPID[$RTR[$k]] as $kkey => $kvalue){
92    $knbtpl += sizeof($kvalue);
93      }
94    } else {
95      $knbeng = 0;
96    }
97    if ($bgc == "#D1D1D1") {
98      $bgc = "#b3b3b3";
99    } else {
100      $bgc = "#D1D1D1";
101    }
102    if ($knbeng >=1 and $knbeng <= 3 ) {
103      print " <tr> <td background-color=$bgc> $kname </td> <td background-color=$bgc> $knbeng </td> <td background-color=$bgc> $knbtpl </td> </tr> ";
104    }
105  }
106  print "</table>\n";
107
108  print "<h3> Routers with no engine defined </h3>\n";
109  print "<p> A router with 0 engine defined on this collector means that no NetFlow Data Export are received. The principals reasons are :\n";
110
111  print " <li> wrong configuration on the router : check IP address of the collector, port destination and NDE version.</li>\n";
112  print " <li> wrong configuration on the collector : check IP address of the router in your configuration file and check your security rules (IPFilters...).</li>\n";
113  print " </p>\n";
114  print "<table class=\"fields\">\n";
115  print " <tr> <th> Router Name </th> <th> Engine Number</th> <th> Template Number</th> </tr>\n";
116  for ($k=0;$k<sizeof($RTR);$k++) {
117    $kname = $RTR_Name[$RTR[$k]];
118##    $kname = $RouterEngineNB[$k];
119    $knbeng = $RouterEngineNB[$RTR[$k]];
120    $knbtpl = 0;
121    if ($RouterEngineTPID[$RTR[$k]]) {
122      foreach($RouterEngineTPID[$RTR[$k]] as $kkey => $kvalue){
123    $knbtpl += sizeof($kvalue);
124      }
125    } else {
126      $knbeng = 0;
127    }
128    if ($bgc == "#D1D1D1") {
129      $bgc = "#b3b3b3";
130    } else {
131      $bgc = "#D1D1D1";
132    }
133    if ($knbeng == 0 ) {
134      print " <tr> <td background-color=$bgc> $kname </td> <td background-color=$bgc> $knbeng </td> <td background-color=$bgc> $knbtpl </td> </tr> ";
135    }
136  }
137  print "</table>\n";
138
139 } else {
140  /* tpl choosed */
141  print "<p> \n";
142  /*  print " $tplkey <br>  \n "; /*DEBUG*/
143  $tplkeysplit = split("_",$tplkey);
144  $ipadd2 = $tplkeysplit[0].".".$tplkeysplit[1].".".$tplkeysplit[2].".".$tplkeysplit[3];
145  $sid2 = $tplkeysplit[4];
146  $tid3 = $tplkeysplit[5];
147  print "<br>\n";
148  print "Router name : $RTR_Name[$ipadd2]<br>\n";
149  print "IP Address Exporter : $ipadd2 <br>\n";
150  print "Engine ID : $sid2 <br>\n";
151  print "Template ID : $tid3 <br>\n";
152  print "Template : <br>\n";
153  print "<table class=\"fields\">\n";
154  print " <tr> <th> Field ID </th> <th> Field </th> <th> Size (in bytes) </th> </tr>\n";
155  for ($it=0;$it<sizeof($RouterEngineTPDEF[$ipadd2][$sid2][$tid3])-1;$it++) {
156    $tmp = $RouterEngineTPDEF[$ipadd2][$sid2][$tid3][$it];
157    $split_res = split(';',$tmp);
158    $fs $split_res[0];
159    if ($bgc == "#D1D1D1") {
160      $bgc = "#b3b3b3";
161    } else {
162      $bgc = "#D1D1D1";
163    }
164    print " <tr> <td background-color=$bgc> $split_res[0] </td> <td background-color=$bgc> $fields[$fs] </td> <td background-color=$bgc> $split_res[1] </td> </tr> ";
165  }
166  print "</table>\n";
167  print " <br> "; /* DEBUG */
168  print "</p> \n";
169 }
170
171print "    </div>\n";
172
173?>
Note: See TracBrowser for help on using the browser.