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

Revision 126, 6.0 KB (checked in by andreu, 12 years ago)

New PHP script used in crontab to generate graphics posted on the self-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>";
30  print " 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>.<br>\n";
31  print " RENETCOL runs with $TPLNumberTotal Templates and $OTPLNumberTotal Optional Templates definitions.\n";
32  print "</p>";
33  print "<h3> Routers with 6 engines or more </h3>\n";
34  print "<table class=\"fields\">\n";
35  print " <tr> <th> Router Name </th> <th> Engine Number </th> <th> Template Number </th> </tr>\n";
36  for ($k=0;$k<sizeof($RTR);$k++) {
37    $kname = $RTR_Name[$RTR[$k]];
38  ##  $kname = $RouterEngineNB[$k];
39    $knbeng = $RouterEngineNB[$RTR[$k]];
40    $knbtpl = 0;
41    if ($RouterEngineTPID[$RTR[$k]]) {
42      foreach($RouterEngineTPID[$RTR[$k]] as $kkey => $kvalue){
43    $knbtpl += sizeof($kvalue);
44      }
45    } else {
46      $knbeng = 0;
47    }
48    if ($bgc == "#D1D1D1") {
49      $bgc = "#b3b3b3";
50    } else {
51      $bgc = "#D1D1D1";
52    }
53    if ($knbeng >=6) {
54      print " <tr> <td background-color=$bgc> $kname </td> <td background-color=$bgc> $knbeng </td> <td background-color=$bgc> $knbtpl </td> </tr> ";
55    }
56  }
57  print "</table>\n";
58
59  print "<h3> Routers with # engines between 4 and 5 </h3>\n";
60  print "<table class=\"fields\">\n";
61  print " <tr> <th> Router Name </th> <th> Engine Number </th> <th> Template Number </th> </tr>\n";
62  for ($k=0;$k<sizeof($RTR);$k++) {
63    $kname = $RTR_Name[$RTR[$k]];
64##    $kname = $RouterEngineNB[$k];
65    $knbeng = $RouterEngineNB[$RTR[$k]];
66    $knbtpl = 0;
67    if ($RouterEngineTPID[$RTR[$k]]) {
68      foreach($RouterEngineTPID[$RTR[$k]] as $kkey => $kvalue){
69    $knbtpl += sizeof($kvalue);
70      }
71    } else {
72      $knbeng = 0;
73    }
74    if ($bgc == "#D1D1D1") {
75      $bgc = "#b3b3b3";
76    } else {
77      $bgc = "#D1D1D1";
78    }
79    if ($knbeng >=4 and $knbeng <= 5 ) {
80      print " <tr> <td background-color=$bgc> $kname </td> <td background-color=$bgc> $knbeng </td> <td background-color=$bgc> $knbtpl </td> </tr> ";
81    }
82  }
83  print "</table>\n";
84
85  print "<h3> Routers with # engines between 1 and 3 </h3>\n";
86  print "<table class=\"fields\">\n";
87  print " <tr> <th> Router Name </th> <th> Engine Number </th> <th> Template Number </th> </tr>\n";
88  for ($k=0;$k<sizeof($RTR);$k++) {
89    $kname = $RTR_Name[$RTR[$k]];
90##    $kname = $RouterEngineNB[$k];
91    $knbeng = $RouterEngineNB[$RTR[$k]];
92    $knbtpl = 0;
93    if ($RouterEngineTPID[$RTR[$k]]) {
94      foreach($RouterEngineTPID[$RTR[$k]] as $kkey => $kvalue){
95    $knbtpl += sizeof($kvalue);
96      }
97    } else {
98      $knbeng = 0;
99    }
100    if ($bgc == "#D1D1D1") {
101      $bgc = "#b3b3b3";
102    } else {
103      $bgc = "#D1D1D1";
104    }
105    if ($knbeng >=1 and $knbeng <= 3 ) {
106      print " <tr> <td background-color=$bgc> $kname </td> <td background-color=$bgc> $knbeng </td> <td background-color=$bgc> $knbtpl </td> </tr> ";
107    }
108  }
109  print "</table>\n";
110
111  print "<h3> Routers with no engine defined </h3>\n";
112  print "<p> A router with 0 engine defined on this collector means that no NetFlow Data Export are received. The principals reasons are :\n";
113
114  print " <li> wrong configuration on the router : check IP address of the collector, port destination and NDE version.</li>\n";
115  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";
116  print " </p>\n";
117  print "<table class=\"fields\">\n";
118  print " <tr> <th> Router Name </th> <th> Engine Number</th> <th> Template Number</th> </tr>\n";
119  for ($k=0;$k<sizeof($RTR);$k++) {
120    $kname = $RTR_Name[$RTR[$k]];
121##    $kname = $RouterEngineNB[$k];
122    $knbeng = $RouterEngineNB[$RTR[$k]];
123    $knbtpl = 0;
124    if ($RouterEngineTPID[$RTR[$k]]) {
125      foreach($RouterEngineTPID[$RTR[$k]] as $kkey => $kvalue){
126    $knbtpl += sizeof($kvalue);
127      }
128    } else {
129      $knbeng = 0;
130    }
131    if ($bgc == "#D1D1D1") {
132      $bgc = "#b3b3b3";
133    } else {
134      $bgc = "#D1D1D1";
135    }
136    if ($knbeng == 0 ) {
137      print " <tr> <td background-color=$bgc> $kname </td> <td background-color=$bgc> $knbeng </td> <td background-color=$bgc> $knbtpl </td> </tr> ";
138    }
139  }
140  print "</table>\n";
141
142 } else {
143  /* tpl choosed */
144  print "<p> \n";
145  /*  print " $tplkey <br>  \n "; /*DEBUG*/
146  $tplkeysplit = split("_",$tplkey);
147  $ipadd2 = $tplkeysplit[0].".".$tplkeysplit[1].".".$tplkeysplit[2].".".$tplkeysplit[3];
148  $sid2 = $tplkeysplit[4];
149  $tid3 = $tplkeysplit[5];
150  print "<br>\n";
151  print "Router name : $RTR_Name[$ipadd2]<br>\n";
152  print "IP Address Exporter : $ipadd2 <br>\n";
153  print "Engine ID : $sid2 <br>\n";
154  print "Template ID : $tid3 <br>\n";
155  print "Template : <br>\n";
156  print "<table class=\"fields\">\n";
157  print " <tr> <th> Field ID </th> <th> Field </th> <th> Size (in bytes) </th> </tr>\n";
158  for ($it=0;$it<sizeof($RouterEngineTPDEF[$ipadd2][$sid2][$tid3])-1;$it++) {
159    $tmp = $RouterEngineTPDEF[$ipadd2][$sid2][$tid3][$it];
160    $split_res = split(';',$tmp);
161    $fs $split_res[0];
162    if ($bgc == "#D1D1D1") {
163      $bgc = "#b3b3b3";
164    } else {
165      $bgc = "#D1D1D1";
166    }
167    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> ";
168  }
169  print "</table>\n";
170  print " <br> "; /* DEBUG */
171  print "</p> \n";
172 }
173
174print "    </div>\n";
175
176?>
Note: See TracBrowser for help on using the browser.