[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/phpsysinfo/includes/mb/ -> class.mbmon.inc.php (source)

   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  // This class was created by Z. Frombach ( zoltan at frombach dot com )
  21  
  22  // $Id: class.mbmon.inc.php 21228 2006-04-06 13:52:08Z ralfbecker $
  23  
  24  class mbinfo {
  25      var $lines;
  26  
  27    function temperature() {
  28      $results = array();
  29  
  30      if (!isset($this->lines) ) {
  31          $this->lines = explode("\n", execute_program('mbmon', '-c 1 -r'));
  32      }
  33  
  34      $i = 0;
  35      foreach($this->lines as $line) {
  36        if (preg_match('/^(TEMP\d*)\s*:\s*(.*)$/D', $line, $data)) {
  37          if ($data[2]<>'0') {
  38            $results[$i]['label'] = $data[1];
  39            $results[$i]['limit'] = '70.0';
  40        if($data[2] > 250) {
  41          $results[$i]['value'] = 0;
  42          $results[$i]['percent'] = 0;
  43        } else {
  44              $results[$i]['value'] = $data[2];
  45              $results[$i]['percent'] = $results[$i]['value'] * 100 / $results[$i]['limit'];
  46        }
  47            $i++;
  48          }
  49        }
  50      }
  51      return $results;
  52    }
  53  
  54    function fans() {
  55      $results = array();
  56  
  57      if (!isset($this->lines) ) {
  58          $this->lines = explode("\n", execute_program('mbmon', '-c 1 -r'));
  59      }
  60  
  61      $i = 0;
  62      foreach($this->lines as $line) {
  63        if (preg_match('/^(FAN\d*)\s*:\s*(.*)$/D', $line, $data)) {
  64          if ($data[2]<>'0') {
  65            $results[$i]['label'] = $data[1];
  66            $results[$i]['value'] = $data[2];
  67            $results[$i]['min'] = '3000';
  68            $results[$i]['div'] = '2';
  69            $i++;
  70          }
  71        }
  72      }
  73      return $results;
  74    }
  75  
  76    function voltage() {
  77      $results = array();
  78  
  79      if (!isset($this->lines) ) {
  80          $this->lines = explode("\n", execute_program('mbmon', '-c 1 -r'));
  81      }
  82  
  83      $i = 0;
  84      foreach($this->lines as $line) {
  85        if (preg_match('/^(V.*)\s*:\s*(.*)$/D', $line, $data)) {
  86          if ($data[2]<>'+0.00') {
  87            $results[$i]['label'] = $data[1];
  88            $results[$i]['value'] = $data[2];
  89            $results[$i]['min'] = '0.00';
  90            $results[$i]['max'] = '0.00';
  91            $i++;
  92          }
  93        }
  94      }
  95  
  96      return $results;
  97    }
  98  }
  99  
 100  ?>


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7