class_mem.inc 2.5 KB

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