Subversion Repositories ALCASAR

Rev

Rev 2770 | Go to most recent revision | Details | Last modification | View Log

Rev Author Line No. Line
325 richard 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.hwsensors.inc.php,v 1.4 2006/05/20 17:01:07 bigmichi1 Exp $
21
 
22
class mbinfo {
23
    var $lines;
24
 
25
    function mbinfo() {
26
        $this->lines = execute_program('sysctl', '-w hw.sensors');
27
	$this->lines = explode("\n", $this->lines);
28
    }
29
 
30
    function temperature() {
31
	$ar_buf = array();
32
	$results = array();
33
 
34
        foreach( $this->lines as $line ) {
35
    	    $ar_buf = preg_split("/[\s,]+/", $line);
36
	    if( isset( $ar_buf[3] ) && $ar_buf[2] == 'temp') {
37
    		$results[$j]['label'] = $ar_buf[1];
38
    		$results[$j]['value'] = $ar_buf[3];
39
    		$results[$j]['limit'] = '70.0';
40
    		$results[$j]['percent'] = $results[$j]['value'] * 100 / $results[$j]['limit'];
41
    		$j++;
42
	    }
43
	}
44
	return $results;
45
    }
46
 
47
    function fans() {
48
	$ar_buf = array();
49
	$results = array();
50
 
51
	foreach( $this->lines as $line ) {
52
	    $ar_buf = preg_split("/[\s,]+/", $line );
53
	    if( isset( $ar_buf[3] ) && $ar_buf[2] == 'fanrpm') {
54
    		$results[$j]['label'] = $ar_buf[1];
55
    		$results[$j]['value'] = $ar_buf[3];
56
    		$j++;
57
    	    }
58
	}
59
	return $results;
60
    }
61
 
62
    function voltage() {
63
	$ar_buf = array();
64
	$results = array();
65
 
66
	foreach( $this->lines as $line ) {
67
	    $ar_buf = preg_split("/[\s,]+/", $line );
68
    	    if ( isset( $ar_buf[3] ) && $ar_buf[2] == 'volts_dc') {
69
    		$results[$j]['label'] = $ar_buf[1];
70
    		$results[$j]['value'] = $ar_buf[3];
71
		$results[$j]['min'] = '0.00';
72
    		$results[$j]['max'] = '0.00';
73
    		$j++;
74
    	    }
75
	}
76
	return $results;
77
    }
78
}
79
 
80
?>