class_mem.inc 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. // $Id: class_mem.inc,v 1.4 2002/11/29 10:45:46 dijkstra Exp $
  3. require_once("class_graph.inc");
  4. class MEM_Graph extends Graph {
  5. function MEM_Graph() {
  6. // get all the sensible defaults from our parent class
  7. $this->init();
  8. }
  9. function execute($url) {
  10. $this->url2options($url);
  11. // and add a few private things
  12. $this->graphsettings["rawcmdline"] .=" -v 'mem' -b 1024 ";
  13. $this->shortcut = array_merge($this->shortcut, array(
  14. "mem" => array(
  15. "brief" => array(
  16. "dsdefinition" => array(
  17. "DEF:A=".$this->get("rrdfile").":real_active:AVERAGE",
  18. "DEF:B=".$this->get("rrdfile").":real_total:AVERAGE",
  19. "DEF:C=".$this->get("rrdfile").":free:AVERAGE",
  20. "DEF:D=".$this->get("rrdfile").":swap_used:AVERAGE",
  21. "DEF:E=".$this->get("rrdfile").":swap_total:AVERAGE"),
  22. "graphdefinition" => array(
  23. "AREA:B#008B8B:real",
  24. "GPRINT:B:AVERAGE:'%.0lf%s\g'",
  25. "STACK:C#3CB371:free",
  26. "GPRINT:C:AVERAGE:'%.0lf%s\g'",
  27. "LINE1:A#00FFFF:active",
  28. "GPRINT:A:AVERAGE:'%.0lf%s\g'",
  29. "LINE1:D#888C00:swap_used",
  30. "GPRINT:D:AVERAGE:'%.0lf%s\g'",
  31. "LINE2:E#FF8C00:swap_total",
  32. "GPRINT:E:AVERAGE:'%.0lf%s\g'")),
  33. "detailed" => array(
  34. "dsdefinition" => array(
  35. "DEF:A=".$this->get("rrdfile").":real_active:AVERAGE",
  36. "DEF:B=".$this->get("rrdfile").":real_total:AVERAGE",
  37. "DEF:C=".$this->get("rrdfile").":free:AVERAGE",
  38. "DEF:D=".$this->get("rrdfile").":swap_used:AVERAGE",
  39. "DEF:E=".$this->get("rrdfile").":swap_total:AVERAGE"),
  40. "graphdefinition" => array(
  41. 'COMMENT:" min avg max last\n"',
  42. 'AREA:B#008B8B:"real "',
  43. 'GPRINT:B:MIN:" %6.2lf %sb"',
  44. 'GPRINT:B:AVERAGE:"%6.2lf %sb"',
  45. 'GPRINT:B:MAX:"%6.2lf %sb"',
  46. 'GPRINT:B:LAST:"%6.2lf %sb\n"',
  47. 'STACK:C#3CB371:"free "',
  48. 'GPRINT:C:MIN:" %6.2lf %sb"',
  49. 'GPRINT:C:AVERAGE:"%6.2lf %sb"',
  50. 'GPRINT:C:MAX:"%6.2lf %sb"',
  51. 'GPRINT:C:LAST:"%6.2lf %sb\n"',
  52. 'LINE1:A#00FFFF:"active "',
  53. 'GPRINT:A:MIN:" %6.2lf %sb"',
  54. 'GPRINT:A:AVERAGE:"%6.2lf %sb"',
  55. 'GPRINT:A:MAX:"%6.2lf %sb"',
  56. 'GPRINT:A:LAST:"%6.2lf %sb\n"',
  57. 'LINE1:D#888C00:"swap used "',
  58. 'GPRINT:D:MIN:" %6.2lf %sb"',
  59. 'GPRINT:D:AVERAGE:"%6.2lf %sb"',
  60. 'GPRINT:D:MAX:"%6.2lf %sb"',
  61. 'GPRINT:D:LAST:"%6.2lf %sb\n"',
  62. 'LINE2:E#FF8C00:"swap total"',
  63. 'GPRINT:E:MIN:" %6.2lf %sb"',
  64. 'GPRINT:E:AVERAGE:"%6.2lf %sb"',
  65. 'GPRINT:E:MAX:"%6.2lf %sb"',
  66. 'GPRINT:E:LAST:"%6.2lf %sb\n"')))));
  67. $this->graphdefaults = array_merge($this->graphdefaults,
  68. $this->shortcut["mem"]["brief"]);
  69. $this->url2options($url);
  70. }
  71. }
  72. ?>