PageRenderTime 70ms CodeModel.GetById 36ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/System/includes/mb/class.mbm5.inc.php

https://bitbucket.org/yousef_fadila/vtiger
PHP | 127 lines | 91 code | 12 blank | 24 comment | 6 complexity | 82155c57621a8e8928978b84fae9308e MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0
  1. <?php
  2. //
  3. // phpSysInfo - A PHP System Information Script
  4. // http://phpsysinfo.sourceforge.net/
  5. //
  6. // This program is free software; you can redistribute it and/or
  7. // modify it under the terms of the GNU General Public License
  8. // as published by the Free Software Foundation; either version 2
  9. // of the License, or (at your option) any later version.
  10. //
  11. // This program is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. // GNU General Public License for more details.
  15. //
  16. // You should have received a copy of the GNU General Public License
  17. // along with this program; if not, write to the Free Software
  18. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19. //
  20. // $Id: class.mbm5.inc.php 5728 2006-05-03 21:19:46Z allanbush $
  21. //
  22. // Note: Make sure you set MBM5 Interval Logging to csv and to the root of PHPSysInfo.
  23. // Also make sure MBM5 doesn't at symbols to the values. Did is a Quick MBM5 log parser,
  24. // need more csv logs to make it better.
  25. //
  26. class mbinfo {
  27. var $buf_label;
  28. var $buf_value;
  29. function temperature() {
  30. $results = array();
  31. if (!isset($this->buf_label)) {
  32. if ($fp = fopen('MBM5.csv', 'r')) {
  33. $this->buf_label = split(';', fgets($fp));
  34. $this->buf_value = split(';', fgets($fp));
  35. fclose($fp);
  36. }
  37. }
  38. $results[0]['label'] = $this->buf_label[3];
  39. $results[0]['value'] = $this->buf_value[3];
  40. $results[0]['limit'] = '70.0';
  41. $results[0]['percent'] = $results[0]['value'] * 100 / $results[0]['limit'];
  42. $results[1]['label'] = $this->buf_label[4];
  43. $results[1]['value'] = $this->buf_value[4];
  44. $results[1]['limit'] = '70.0';
  45. $results[1]['percent'] = $results[1]['value'] * 100 / $results[1]['limit'];
  46. $results[2]['label'] = $this->buf_label[5];
  47. $results[2]['value'] = $this->buf_value[5];
  48. $results[2]['limit'] = '70.0';
  49. $results[2]['percent'] = $results[2]['value'] * 100 / $results[2]['limit'];
  50. return $results;
  51. }
  52. function fans() {
  53. $results = array();
  54. if (!isset($this->buf_label)) {
  55. if ($fp = fopen('MBM5.csv', 'r')) {
  56. $this->buf_label = split(';', fgets($fp));
  57. $this->buf_value = split(';', fgets($fp));
  58. fclose($fp);
  59. }
  60. }
  61. $results[0]['label'] = $this->buf_label[13];
  62. $results[0]['value'] = $this->buf_value[13];
  63. $results[0]['min'] = '3000';
  64. $results[0]['div'] = '2';
  65. $results[1]['label'] = $this->buf_label[14];
  66. $results[1]['value'] = $this->buf_value[14];
  67. $results[1]['min'] = '3000';
  68. $results[1]['div'] = '2';
  69. $results[2]['label'] = $this->buf_label[15];
  70. $results[2]['value'] = $this->buf_value[15];
  71. $results[2]['min'] = '3000';
  72. $results[2]['div'] = '2';
  73. return $results;
  74. }
  75. function voltage() {
  76. $results = array();
  77. if (!isset($this->buf_label)) {
  78. if ($fp = fopen('MBM5.csv', 'r')) {
  79. $this->buf_label = split(';', fgets($fp));
  80. $this->buf_value = split(';', fgets($fp));
  81. fclose($fp);
  82. }
  83. }
  84. $results[0]['label'] = $this->buf_label[6];
  85. $results[0]['value'] = $this->buf_value[6];
  86. $results[0]['min'] = '0.00';
  87. $results[0]['max'] = '0.00';
  88. $results[1]['label'] = $this->buf_label[7];
  89. $results[1]['value'] = $this->buf_value[7];
  90. $results[1]['min'] = '0.00';
  91. $results[1]['max'] = '0.00';
  92. $results[2]['label'] = $this->buf_label[8];
  93. $results[2]['value'] = $this->buf_value[8];
  94. $results[2]['min'] = '0.00';
  95. $results[2]['max'] = '0.00';
  96. $results[3]['label'] = $this->buf_label[9];
  97. $results[3]['value'] = $this->buf_value[9];
  98. $results[3]['min'] = '0.00';
  99. $results[3]['max'] = '0.00';
  100. $results[4]['label'] = $this->buf_label[10];
  101. $results[4]['value'] = $this->buf_value[10];
  102. $results[4]['min'] = '0.00';
  103. $results[4]['max'] = '0.00';
  104. $results[5]['label'] = $this->buf_label[11];
  105. $results[5]['value'] = $this->buf_value[11];
  106. $results[5]['min'] = '0.00';
  107. $results[5]['max'] = '0.00';
  108. $results[6]['label'] = $this->buf_label[12];
  109. $results[6]['value'] = $this->buf_value[12];
  110. $results[6]['min'] = '0.00';
  111. $results[6]['max'] = '0.00';
  112. return $results;
  113. }
  114. }
  115. ?>