class_pf.inc 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <?php
  2. require_once("class_graph.inc");
  3. class PF_Graph extends Graph {
  4. function PF_Graph() {
  5. // get all the sensible defaults from our parent class
  6. $this->init();
  7. }
  8. function execute($url) {
  9. $this->url2options($url);
  10. // and add a few private things
  11. $this->shortcut = array_merge($this->shortcut, array(
  12. "pf" => array(
  13. "brief" => array(
  14. "dsdefinition" => array(
  15. "DEF:A=".$this->get("rrdfile").":bytes:AVERAGE "),
  16. "graphdefinition" => array(
  17. 'COMMENT:" min avg max last\n"',
  18. "AREA:A#00FF00:'bytes'",
  19. "GPRINT:A:MIN:'%6.2lf %sBps'",
  20. "GPRINT:A:AVERAGE:'%6.2lf %sBps'",
  21. "GPRINT:A:MAX:'%6.2lf %sBps'",
  22. "GPRINT:A:LAST:'%6.2lf %sBps'")),
  23. "all" => array(
  24. "dsdefinition" => array(
  25. "DEF:A=".$this->get("rrdfile").":bytes_v4_in:AVERAGE ",
  26. "DEF:B=".$this->get("rrdfile").":bytes_v4_out:AVERAGE ",
  27. "DEF:C=".$this->get("rrdfile").":bytes_v6_in:AVERAGE ",
  28. "DEF:D=".$this->get("rrdfile").":bytes_v6_out:AVERAGE ",
  29. "DEF:E=".$this->get("rrdfile").":packets_v4_in_pass:AVERAGE ",
  30. "DEF:F=".$this->get("rrdfile").":packets_v4_in_drop:AVERAGE ",
  31. "DEF:G=".$this->get("rrdfile").":packets_v4_out_pass:AVERAGE ",
  32. "DEF:H=".$this->get("rrdfile").":packets_v4_out_drop:AVERAGE ",
  33. "DEF:J=".$this->get("rrdfile").":packets_v6_in_pass:AVERAGE ",
  34. "DEF:K=".$this->get("rrdfile").":packets_v6_in_drop:AVERAGE ",
  35. "DEF:L=".$this->get("rrdfile").":packets_v6_out_pass:AVERAGE ",
  36. "DEF:M=".$this->get("rrdfile").":packets_v6_out_drop:AVERAGE ",
  37. "DEF:N=".$this->get("rrdfile").":states_entries:AVERAGE ",
  38. "DEF:O=".$this->get("rrdfile").":states_searches:AVERAGE ",
  39. "DEF:P=".$this->get("rrdfile").":states_inserts:AVERAGE ",
  40. "DEF:Q=".$this->get("rrdfile").":states_removals:AVERAGE ",
  41. "DEF:R=".$this->get("rrdfile").":counters_match:AVERAGE ",
  42. "DEF:S=".$this->get("rrdfile").":counters_badoffset:AVERAGE ",
  43. "DEF:T=".$this->get("rrdfile").":counters_fragment:AVERAGE ",
  44. "DEF:U=".$this->get("rrdfile").":counters_short:AVERAGE ",
  45. "DEF:V=".$this->get("rrdfile").":counters_normalize:AVERAGE ",
  46. "DEF:W=".$this->get("rrdfile").":counters_memory:AVERAGE "),
  47. "graphdefinition" => array(
  48. 'COMMENT:" min avg max last\n"',
  49. 'LINE1:A#000000:"bytes_v4_in"',
  50. "GPRINT:A:MIN:'%4.2lf %sBps'",
  51. "GPRINT:A:AVERAGE:'%4.2lf %sBps'",
  52. "GPRINT:A:MAX:'%4.2lf %sBps'",
  53. 'GPRINT:A:LAST:"%4.2lf %sBps\n"',
  54. 'LINE1:B#0B0B0B:"bytes_v4_out"',
  55. "GPRINT:B:MIN:'%4.2lf %sBps'",
  56. "GPRINT:B:AVERAGE:'%4.2lf %sBps'",
  57. "GPRINT:B:MAX:'%4.2lf %sBps'",
  58. 'GPRINT:B:LAST:"%4.2lf %sBps\n"',
  59. 'LINE1:C#161616:"bytes_v6_in"',
  60. "GPRINT:C:MIN:'%4.2lf %sBps'",
  61. "GPRINT:C:AVERAGE:'%4.2lf %sBps'",
  62. "GPRINT:C:MAX:'%4.2lf %sBps'",
  63. 'GPRINT:C:LAST:"%4.2lf %sBps\n"',
  64. 'LINE1:D#212121:"bytes_v6_out"',
  65. "GPRINT:D:MIN:'%4.2lf %sBps'",
  66. "GPRINT:D:AVERAGE:'%4.2lf %sBps'",
  67. "GPRINT:D:MAX:'%4.2lf %sBps'",
  68. 'GPRINT:D:LAST:"%4.2lf %sBps\n"',
  69. 'LINE1:E#2C2C2C:"packets_v4_in_pass"',
  70. "GPRINT:E:MIN:'%4.2lf '",
  71. "GPRINT:E:AVERAGE:'%4.2lf '",
  72. "GPRINT:E:MAX:'%4.2lf '",
  73. 'GPRINT:E:LAST:"%4.2lf\n"',
  74. 'LINE1:F#373737:"packets_v4_in_drop"',
  75. "GPRINT:F:MIN:'%4.2lf '",
  76. "GPRINT:F:AVERAGE:'%4.2lf '",
  77. "GPRINT:F:MAX:'%4.2lf '",
  78. 'GPRINT:F:LAST:"%4.2lf\n"',
  79. 'LINE1:G#424242:"packets_v4_out_pass"',
  80. "GPRINT:G:MIN:'%4.2lf '",
  81. "GPRINT:G:AVERAGE:'%4.2lf '",
  82. "GPRINT:G:MAX:'%4.2lf '",
  83. 'GPRINT:G:LAST:"%4.2lf\n"',
  84. 'LINE1:H#4D4D4D:"packets_v4_out_drop"',
  85. "GPRINT:H:MIN:'%4.2lf '",
  86. "GPRINT:H:AVERAGE:'%4.2lf '",
  87. "GPRINT:H:MAX:'%4.2lf '",
  88. 'GPRINT:H:LAST:"%4.2lf\n"',
  89. 'LINE1:J#585858:"packets_v6_in_pass"',
  90. "GPRINT:J:MIN:'%4.2lf '",
  91. "GPRINT:J:AVERAGE:'%4.2lf '",
  92. "GPRINT:J:MAX:'%4.2lf '",
  93. 'GPRINT:J:LAST:"%4.2lf\n"',
  94. 'LINE1:K#636363:"packets_v6_in_drop"',
  95. "GPRINT:K:MIN:'%4.2lf '",
  96. "GPRINT:K:AVERAGE:'%4.2lf '",
  97. "GPRINT:K:MAX:'%4.2lf '",
  98. 'GPRINT:K:LAST:"%4.2lf\n"',
  99. 'LINE1:L#6E6E6E:"packets_v6_out_pass"',
  100. "GPRINT:L:MIN:'%4.2lf '",
  101. "GPRINT:L:AVERAGE:'%4.2lf '",
  102. "GPRINT:L:MAX:'%4.2lf '",
  103. 'GPRINT:L:LAST:"%4.2lf\n"',
  104. 'LINE1:M#797979:"packets_v6_out_drop"',
  105. "GPRINT:M:MIN:'%4.2lf '",
  106. "GPRINT:M:AVERAGE:'%4.2lf '",
  107. "GPRINT:M:MAX:'%4.2lf '",
  108. 'GPRINT:M:LAST:"%4.2lf\n"',
  109. 'LINE1:N#848484:"states_entries"',
  110. "GPRINT:N:MIN:'%4.2lf '",
  111. "GPRINT:N:AVERAGE:'%4.2lf '",
  112. "GPRINT:N:MAX:'%4.2lf '",
  113. 'GPRINT:N:LAST:"%4.2lf\n"',
  114. 'LINE1:O#8F8F8F:"states_searches"',
  115. "GPRINT:O:MIN:'%4.2lf '",
  116. "GPRINT:O:AVERAGE:'%4.2lf '",
  117. "GPRINT:O:MAX:'%4.2lf '",
  118. 'GPRINT:O:LAST:"%4.2lf\n"',
  119. 'LINE1:P#9A9A9A:"states_inserts"',
  120. "GPRINT:P:MIN:'%4.2lf '",
  121. "GPRINT:P:AVERAGE:'%4.2lf '",
  122. "GPRINT:P:MAX:'%4.2lf '",
  123. 'GPRINT:P:LAST:"%4.2lf\n"',
  124. 'LINE1:Q#A5A5A5:"states_removals"',
  125. "GPRINT:Q:MIN:'%4.2lf '",
  126. "GPRINT:Q:AVERAGE:'%4.2lf '",
  127. "GPRINT:Q:MAX:'%4.2lf '",
  128. 'GPRINT:Q:LAST:"%4.2lf\n"',
  129. 'LINE1:R#B0B0B0:"counters_match"',
  130. "GPRINT:R:MIN:'%4.2lf '",
  131. "GPRINT:R:AVERAGE:'%4.2lf '",
  132. "GPRINT:R:MAX:'%4.2lf '",
  133. 'GPRINT:R:LAST:"%4.2lf\n"',
  134. 'LINE1:S#BBBBBB:"counters_badoffset"',
  135. "GPRINT:S:MIN:'%4.2lf '",
  136. "GPRINT:S:AVERAGE:'%4.2lf '",
  137. "GPRINT:S:MAX:'%4.2lf '",
  138. 'GPRINT:S:LAST:"%4.2lf\n"',
  139. 'LINE1:T#C6C6C6:"counters_fragment"',
  140. "GPRINT:T:MIN:'%4.2lf '",
  141. "GPRINT:T:AVERAGE:'%4.2lf '",
  142. "GPRINT:T:MAX:'%4.2lf '",
  143. 'GPRINT:T:LAST:"%4.2lf\n"',
  144. 'LINE1:U#D1D1D1:"counters_short"',
  145. "GPRINT:U:MIN:'%4.2lf '",
  146. "GPRINT:U:AVERAGE:'%4.2lf '",
  147. "GPRINT:U:MAX:'%4.2lf '",
  148. 'GPRINT:U:LAST:"%4.2lf\n"',
  149. 'LINE1:V#DCDCDC:"counters_normalize"',
  150. "GPRINT:V:MIN:'%4.2lf '",
  151. "GPRINT:V:AVERAGE:'%4.2lf '",
  152. "GPRINT:V:MAX:'%4.2lf '",
  153. 'GPRINT:V:LAST:"%4.2lf\n"',
  154. 'LINE1:W#E7E7E7:"counters_memory "',
  155. "GPRINT:W:MIN:'%4.2lf '",
  156. "GPRINT:W:AVERAGE:'%4.2lf '",
  157. "GPRINT:W:MAX:'%4.2lf '",
  158. 'GPRINT:W:LAST:"%4.2lf\n"')))));
  159. $this->graphsettings["rawcmdline"] .=" -v 'pf'";
  160. $this->graphdefaults = array_merge($this->graphdefaults,
  161. $this->shortcut["pf"]["all"]);
  162. $this->url2options($url);
  163. }
  164. }
  165. ?>