1 |
root |
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.healthd.inc.php,v 1.6 2007/02/18 19:11:31 bigmichi1 Exp $
|
|
|
21 |
|
|
|
22 |
class mbinfo {
|
|
|
23 |
var $lines;
|
|
|
24 |
|
|
|
25 |
function temperature() {
|
|
|
26 |
$ar_buf = array();
|
|
|
27 |
$results = array();
|
|
|
28 |
|
|
|
29 |
if (!isset($this->lines)) {
|
|
|
30 |
$this->lines = execute_program('healthdc', '-t');
|
|
|
31 |
}
|
|
|
32 |
|
|
|
33 |
$ar_buf = preg_split("/\t+/", $this->lines);
|
|
|
34 |
|
|
|
35 |
$results[0]['label'] = 'temp1';
|
|
|
36 |
$results[0]['value'] = $ar_buf[1];
|
|
|
37 |
$results[0]['limit'] = '70.0';
|
|
|
38 |
$results[0]['percent'] = $results[0]['value'] * 100 / $results[0]['limit'];
|
|
|
39 |
$results[1]['label'] = 'temp2';
|
|
|
40 |
$results[1]['value'] = $ar_buf[2];
|
|
|
41 |
$results[1]['limit'] = '70.0';
|
|
|
42 |
$results[1]['percent'] = $results[1]['value'] * 100 / $results[1]['limit'];
|
|
|
43 |
$results[2]['label'] = 'temp3';
|
|
|
44 |
$results[2]['value'] = $ar_buf[3];
|
|
|
45 |
$results[2]['limit'] = '70.0';
|
|
|
46 |
$results[2]['percent'] = $results[2]['value'] * 100 / $results[2]['limit'];
|
|
|
47 |
return $results;
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
function fans() {
|
|
|
51 |
$ar_buf = array();
|
|
|
52 |
$results = array();
|
|
|
53 |
|
|
|
54 |
if (!isset($this->lines)) {
|
|
|
55 |
$this->lines = execute_program('healthdc', '-t');
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
$ar_buf = preg_split("/\t+/", $this->lines);
|
|
|
59 |
|
|
|
60 |
$results[0]['label'] = 'fan1';
|
|
|
61 |
$results[0]['value'] = $ar_buf[4];
|
|
|
62 |
$results[0]['min'] = '3000';
|
|
|
63 |
$results[1]['label'] = 'fan2';
|
|
|
64 |
$results[1]['value'] = $ar_buf[5];
|
|
|
65 |
$results[1]['min'] = '3000';
|
|
|
66 |
$results[2]['label'] = 'fan3';
|
|
|
67 |
$results[2]['value'] = $ar_buf[6];
|
|
|
68 |
$results[2]['min'] = '3000';
|
|
|
69 |
|
|
|
70 |
return $results;
|
|
|
71 |
}
|
|
|
72 |
|
|
|
73 |
function voltage() {
|
|
|
74 |
$ar_buf = array();
|
|
|
75 |
$results = array();
|
|
|
76 |
|
|
|
77 |
if (!isset($this->lines)) {
|
|
|
78 |
$this->lines = execute_program('healthdc', '-t');
|
|
|
79 |
}
|
|
|
80 |
|
|
|
81 |
$ar_buf = preg_split("/\t+/", $this->lines);
|
|
|
82 |
|
|
|
83 |
$results[0]['label'] = 'Vcore1';
|
|
|
84 |
$results[0]['value'] = $ar_buf[7];
|
|
|
85 |
$results[0]['min'] = '0.00';
|
|
|
86 |
$results[0]['max'] = '0.00';
|
|
|
87 |
$results[1]['label'] = 'Vcore2';
|
|
|
88 |
$results[1]['value'] = $ar_buf[8];
|
|
|
89 |
$results[1]['min'] = '0.00';
|
|
|
90 |
$results[1]['max'] = '0.00';
|
|
|
91 |
$results[2]['label'] = '3volt';
|
|
|
92 |
$results[2]['value'] = $ar_buf[9];
|
|
|
93 |
$results[2]['min'] = '0.00';
|
|
|
94 |
$results[2]['max'] = '0.00';
|
|
|
95 |
$results[3]['label'] = '+5Volt';
|
|
|
96 |
$results[3]['value'] = $ar_buf[10];
|
|
|
97 |
$results[3]['min'] = '0.00';
|
|
|
98 |
$results[3]['max'] = '0.00';
|
|
|
99 |
$results[4]['label'] = '+12Volt';
|
|
|
100 |
$results[4]['value'] = $ar_buf[11];
|
|
|
101 |
$results[4]['min'] = '0.00';
|
|
|
102 |
$results[4]['max'] = '0.00';
|
|
|
103 |
$results[5]['label'] = '-12Volt';
|
|
|
104 |
$results[5]['value'] = $ar_buf[12];
|
|
|
105 |
$results[5]['min'] = '0.00';
|
|
|
106 |
$results[5]['max'] = '0.00';
|
|
|
107 |
$results[6]['label'] = '-5Volt';
|
|
|
108 |
$results[6]['value'] = $ar_buf[13];
|
|
|
109 |
$results[6]['min'] = '0.00';
|
|
|
110 |
$results[6]['max'] = '0.00';
|
|
|
111 |
|
|
|
112 |
return $results;
|
|
|
113 |
}
|
|
|
114 |
}
|
|
|
115 |
|
|
|
116 |
?>
|