Subversion Repositories ALCASAR

Rev

Rev 325 | Rev 2976 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log

Rev 325 Rev 2770
Line 1... Line 1...
1
<?php 
1
<?php
2
 
2
/**
3
// phpSysInfo - A PHP System Information Script
3
 * lmsensor sensor class, getting information from lmsensor
-
 
4
 *
4
// http://phpsysinfo.sourceforge.net/
5
 * PHP version 5
5
 
6
 *
-
 
7
 * @category  PHP
-
 
8
 * @package   PSI_Sensor
6
// This program is free software; you can redistribute it and/or
9
 * @author    Michael Cramer <BigMichi1@users.sourceforge.net>
-
 
10
 * @copyright 2009 phpSysInfo
7
// modify it under the terms of the GNU General Public License
11
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
-
 
12
 * @version   Release: 3.0
8
// as published by the Free Software Foundation; either version 2
13
 * @link      http://phpsysinfo.sourceforge.net
-
 
14
 */
9
// of the License, or (at your option) any later version.
15
class LMSensors extends Sensors
10
 
16
{
-
 
17
    /**
11
// This program is distributed in the hope that it will be useful,
18
     * content to parse
-
 
19
     *
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
20
     * @var array
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
     */
14
// GNU General Public License for more details.
22
    private $_lines = array();
15
 
23
 
-
 
24
    /**
16
// You should have received a copy of the GNU General Public License
25
     * fill the private content var through command or data access
-
 
26
     */
17
// along with this program; if not, write to the Free Software
27
    public function __construct()
-
 
28
    {
-
 
29
        parent::__construct();
-
 
30
        $lines = "";
18
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
31
        switch (defined('PSI_SENSOR_LMSENSORS_ACCESS')?strtolower(PSI_SENSOR_LMSENSORS_ACCESS):'command') {
19
 
-
 
-
 
32
        case 'command':
20
// $Id: class.lmsensors.inc.php,v 1.19 2007/02/18 19:11:31 bigmichi1 Exp $
33
            CommonFunctions::executeProgram("sensors", "", $lines);
-
 
34
            break;
21
if (!defined('IN_PHPSYSINFO')) {
35
        case 'data':
-
 
36
            CommonFunctions::rfts(PSI_APP_ROOT.'/data/lmsensors.txt', $lines);
-
 
37
            break;
-
 
38
        default:
-
 
39
            $this->error->addConfigError('__construct()', '[sensor_lmsensors] ACCESS');
22
    die("No Hacking");
40
            break;
23
}
41
        }
24
 
42
 
25
require_once(APP_ROOT . "/includes/common_functions.php");
-
 
26
 
-
 
27
class mbinfo {
-
 
28
  var $lines;
-
 
29
 
-
 
30
  function mbinfo() {
-
 
31
   $lines = execute_program("sensors", "");
43
        if (trim($lines) !== "") {
32
   // Martijn Stolk: Dirty fix for misinterpreted output of sensors, 
-
 
33
   // where info could come on next line when the label is too long.
-
 
34
   $lines = str_replace(":\n", ":", $lines);
44
            $lines = str_replace(":\n", ":", $lines);
35
   $lines = str_replace("\n\n", "\n", $lines);
45
            $lines = str_replace("\n\n", "\n", $lines);
36
   $this->lines = explode("\n", $lines);
46
            $this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
-
 
47
        }
37
  }
48
    }
38
  
49
 
-
 
50
    /**
39
  function temperature() {
51
     * get temperature information
40
    $ar_buf = array();
52
     *
41
    $results = array();
53
     * @return void
42
 
54
     */
43
    $sensors_value = $this->lines;
55
    private function _temperature()
44
 
56
    {
45
    foreach($sensors_value as $line) {
57
        $applesmc = false;
46
      $data = array();
58
        $sname = '';
47
      if (ereg("(.*):(.*)\((.*)=(.*),(.*)=(.*)\)(.*)", $line, $data)) ;
59
        foreach ($this->_lines as $line) {
48
      elseif (ereg("(.*):(.*)\((.*)=(.*)\)(.*)", $line, $data)) ;
60
            if ((trim($line) !== "") && (strpos($line, ':') === false)) {
49
      else (ereg("(.*):(.*)", $line, $data));
61
                //$applesmc = preg_match("/^applesmc-/", $line);
50
      if (count($data) > 1) {
62
                $sname = trim($line);
51
        $temp = substr(trim($data[2]), -1);
63
                $applesmc =  ($sname === "applesmc-isa-0300");
52
        switch ($temp) {
64
                if (preg_match('/^([^-]+)-/', $sname, $snamebuf)) {
53
          case "C";
65
                    $sname = ' ('.$snamebuf[1].')';
54
          case "F":
66
                } else {
55
            array_push($ar_buf, $line);
67
                    $sname = '';
56
            break;
-
 
57
        }
68
                }
58
      }
69
            }
-
 
70
            $data = array();
-
 
71
            if (preg_match("/^(.+):(.+).C\s*\((.+)=(.+).C,(.+)=(.+).C\)(.*)\)/", $line, $data)) {
-
 
72
                ;
-
 
73
            } elseif (preg_match("/^(.+):(.+).C\s*\((.+)=(.+).C,(.+)=(.+).C\)(.*)/", $line, $data)) {
-
 
74
                ;
-
 
75
            } elseif (preg_match("/^(.+):(.+).C\s*\((.+)=(.+).C\)(.*)/", $line, $data)) {
-
 
76
                ;
-
 
77
            } elseif (preg_match("/^(.+):(.+).C\s*\(/", $line, $data)) {
-
 
78
                ;
-
 
79
            } else {
-
 
80
                preg_match("/^(.+):(.+).C$/", $line, $data);
59
    }
81
            }
60
 
-
 
61
    $i = 0;
-
 
62
    foreach($ar_buf as $line) {
-
 
63
      unset($data);
82
            if (count($data)>2) {
64
      if (ereg("(.*):(.*).C[ ]*\((.*)=(.*).C,(.*)=(.*).C\)(.*)\)", $line, $data)) ;
-
 
65
      elseif (ereg("(.*):(.*).C[ ]*\((.*)=(.*).C,(.*)=(.*).C\)(.*)", $line, $data)) ;
-
 
66
      elseif (ereg("(.*):(.*).C[ ]*\((.*)=(.*).C\)(.*)", $line, $data)) ;
-
 
67
      else (ereg("(.*):(.*).C", $line, $data));
83
                foreach ($data as $key=>$value) {
68
 
-
 
69
      $results[$i]['label'] = $data[1];
-
 
70
      $results[$i]['value'] = trim($data[2]);
84
                    if (preg_match("/^\+?(-?[0-9\.]+).?$/", trim($value), $newvalue)) {
71
      if ( isset( $data[6] ) && trim( $data[2] ) > trim( $data[6] ) ) {
85
                        $data[$key] = 0+trim($newvalue[1]);
72
        $results[$i]['limit'] = "+75";
-
 
73
        $results[$i]['perce'] = "+75";
-
 
74
      } else {
86
                    } else {
75
        $results[$i]['limit'] = isset($data[4]) ? trim($data[4]) : "+75";
-
 
76
        $results[$i]['perce'] = isset($data[6]) ? trim($data[6]) : "+75";
87
                        $data[$key] = trim($value);
77
      }
88
                    }
78
      if ($results[$i]['limit'] < $results[$i]['perce']) {	 	
-
 
79
         $results[$i]['limit'] = $results[$i]['perce'];	 	
-
 
80
       }      
89
                }
-
 
90
                if ($applesmc && (strlen($data[1]) == 4)) {
-
 
91
                    if ($data[1][0] == "T") {
-
 
92
                        if ($data[1][1] == "A") {
-
 
93
                            $data[1] = $data[1] . " Ambient";
-
 
94
                        } elseif ($data[1][1] == "B") {
-
 
95
                            $data[1] = $data[1] . " Battery";
-
 
96
                        } elseif ($data[1][1] == "C") {
-
 
97
                            $data[1] = $data[1] . " CPU";
-
 
98
                        } elseif ($data[1][1] == "G") {
-
 
99
                            $data[1] = $data[1] . " GPU";
-
 
100
                        } elseif ($data[1][1] == "H") {
-
 
101
                            $data[1] = $data[1] . " Harddisk Bay";
-
 
102
                        } elseif ($data[1][1] == "h") {
-
 
103
                            $data[1] = $data[1] . " Heatpipe";
-
 
104
                        } elseif ($data[1][1] == "L") {
-
 
105
                            $data[1] = $data[1] . " LCD";
-
 
106
                        } elseif ($data[1][1] == "M") {
-
 
107
                            $data[1] = $data[1] . " Memory";
-
 
108
                        } elseif ($data[1][1] == "m") {
-
 
109
                            $data[1] = $data[1] . " Memory Contr.";
-
 
110
                        } elseif ($data[1][1] == "N") {
-
 
111
                            $data[1] = $data[1] . " Northbridge";
-
 
112
                        } elseif ($data[1][1] == "O") {
-
 
113
                            $data[1] = $data[1] . " Optical Drive";
-
 
114
                        } elseif ($data[1][1] == "p") {
-
 
115
                            $data[1] = $data[1] . " Power supply";
-
 
116
                        } elseif ($data[1][1] == "S") {
-
 
117
                            $data[1] = $data[1] . " Slot";
-
 
118
                        } elseif ($data[1][1] == "s") {
-
 
119
                            $data[1] = $data[1] . " Slot";
-
 
120
                        } elseif ($data[1][1] == "W") {
-
 
121
                            $data[1] = $data[1] . " Airport";
-
 
122
                        }
-
 
123
 
-
 
124
                        if ($data[1][3] == "H") {
-
 
125
                            $data[1] = $data[1] . " Heatsink";
-
 
126
                        } elseif ($data[1][3] == "P") {
-
 
127
                            $data[1] = $data[1] . " Proximity";
-
 
128
                        } elseif ($data[1][3] == "D") {
-
 
129
                            $data[1] = $data[1] . " Die";
-
 
130
                        }
-
 
131
                    }
-
 
132
                }
-
 
133
 
-
 
134
                $dev = new SensorDevice();
-
 
135
                $dev->setName($data[1].$sname);
-
 
136
                $dev->setValue($data[2]);
-
 
137
                if (isset($data[6]) && $data[2] <= $data[6]) {
-
 
138
                    $dev->setMax(max($data[4], $data[6]));
-
 
139
                } elseif (isset($data[4]) && $data[2] <= $data[4]) {
-
 
140
                    $dev->setMax($data[4]);
-
 
141
                }
-
 
142
                if (preg_match("/\sALARM\s*$/", $line) || preg_match("/\sALARM\s+sensor\s+=/", $line)) {
-
 
143
                    $dev->setEvent("Alarm");
-
 
144
                }
-
 
145
                $this->mbinfo->setMbTemp($dev);
-
 
146
            }
81
      $i++;
147
        }
-
 
148
    }
-
 
149
 
-
 
150
    /**
-
 
151
     * get fan information
-
 
152
     *
-
 
153
     * @return void
-
 
154
     */
-
 
155
    private function _fans()
-
 
156
    {
-
 
157
        $sname = '';
-
 
158
        foreach ($this->_lines as $line) {
-
 
159
            if ((trim($line) !== "") && (strpos($line, ':') === false)) {
-
 
160
                $sname = trim($line);
-
 
161
                if (preg_match('/^([^-]+)-/', $sname, $snamebuf)) {
-
 
162
                    $sname = ' ('.$snamebuf[1].')';
-
 
163
                } else {
-
 
164
                    $sname = '';
-
 
165
                }
-
 
166
            }
-
 
167
            $data = array();
-
 
168
            if (preg_match("/^(.+):(.+) RPM\s*\((.+)=(.+) RPM,(.+)=(.+)\)(.*)\)/", $line, $data)) {
-
 
169
                ;
-
 
170
            } elseif (preg_match("/^(.+):(.+) RPM\s*\((.+)=(.+) RPM,(.+)=(.+)\)(.*)/", $line, $data)) {
-
 
171
                ;
-
 
172
            } elseif (preg_match("/^(.+):(.+) RPM\s*\((.+)=(.+) RPM\)(.*)/", $line, $data)) {
-
 
173
                ;
-
 
174
            } elseif (preg_match("/^(.+):(.+) RPM\s*\(/", $line, $data)) {
-
 
175
                ;
-
 
176
            } else {
-
 
177
                preg_match("/^(.+):(.+) RPM$/", $line, $data);
-
 
178
            }
-
 
179
            if (count($data)>2) {
-
 
180
                 foreach ($data as $key=>$value) {
-
 
181
                    if (preg_match("/^\+?(-?[0-9\.]+).?$/", trim($value), $newvalue)) {
-
 
182
                        $data[$key] = 0+trim($newvalue[1]);
-
 
183
                    } else {
-
 
184
                        $data[$key] = trim($value);
-
 
185
                    }
-
 
186
                }
-
 
187
                $dev = new SensorDevice();
-
 
188
                $dev->setName($data[1].$sname);
-
 
189
                $dev->setValue(trim($data[2]));
-
 
190
                if (isset($data[4])) {
-
 
191
                    $dev->setMin(trim($data[4]));
-
 
192
                }
-
 
193
                if (preg_match("/\sALARM\s*$/", $line)) {
-
 
194
                    $dev->setEvent("Alarm");
-
 
195
                }
-
 
196
                $this->mbinfo->setMbFan($dev);
-
 
197
            }
82
    }
198
        }
83
 
-
 
84
    asort($results);
-
 
85
    return array_values($results);
-
 
86
  }
199
    }
87
 
200
 
-
 
201
    /**
-
 
202
     * get voltage information
-
 
203
     *
-
 
204
     * @return void
-
 
205
     */
88
  function fans() {
206
    private function _voltage()
-
 
207
    {
-
 
208
        $sname = '';
-
 
209
        foreach ($this->_lines as $line) {
-
 
210
            if ((trim($line) !== "") && (strpos($line, ':') === false)) {
-
 
211
                $sname = trim($line);
-
 
212
                if (preg_match('/^([^-]+)-/', $sname, $snamebuf)) {
-
 
213
                    $sname = ' ('.$snamebuf[1].')';
89
    $ar_buf = array();
214
                } else {
-
 
215
                    $sname = '';
-
 
216
                }
-
 
217
            }
90
    $results = array();
218
            $data = array();
-
 
219
            if (preg_match("/^(.+):(.+) V\s*\((.+)=(.+) V,(.+)=(.+) V\)(.*)\)/", $line, $data)) {
-
 
220
                ;
-
 
221
            } elseif (preg_match("/^(.+):(.+) V\s*\((.+)=(.+) V,(.+)=(.+) V\)(.*)/", $line, $data)) {
-
 
222
                ;
-
 
223
            } elseif (preg_match("/^(.+):(.+) V\s*\(/", $line, $data)) {
-
 
224
                ;
-
 
225
            } else {
-
 
226
                preg_match("/^(.+):(.+) V$/", $line, $data);
-
 
227
            }
91
 
228
 
-
 
229
            if (count($data)>2) {
-
 
230
                foreach ($data as $key=>$value) {
-
 
231
                    if (preg_match("/^\+?(-?[0-9\.]+)$/", trim($value), $newvalue)) {
-
 
232
                        $data[$key] = 0+trim($newvalue[1]);
-
 
233
                    } else {
-
 
234
                        $data[$key] = trim($value);
-
 
235
                    }
-
 
236
                }
92
    $sensors_value = $this->lines;
237
                $dev = new SensorDevice();
-
 
238
                $dev->setName($data[1].$sname);
-
 
239
                $dev->setValue($data[2]);
-
 
240
                if (isset($data[4])) {
-
 
241
                    $dev->setMin($data[4]);
-
 
242
                }
-
 
243
                if (isset($data[6])) {
-
 
244
                    $dev->setMax($data[6]);
-
 
245
                }
-
 
246
                if (preg_match("/\sALARM\s*$/", $line)) {
-
 
247
                    $dev->setEvent("Alarm");
-
 
248
                }
-
 
249
                $this->mbinfo->setMbVolt($dev);
-
 
250
            }
-
 
251
        }
-
 
252
    }
93
 
253
 
-
 
254
    /**
-
 
255
     * get power information
-
 
256
     *
-
 
257
     * @return void
-
 
258
     */
-
 
259
    private function _power()
-
 
260
    {
-
 
261
        $sname = '';
94
    foreach($sensors_value as $line) {
262
        foreach ($this->_lines as $line) {
-
 
263
            if ((trim($line) !== "") && (strpos($line, ':') === false)) {
-
 
264
                $sname = trim($line);
-
 
265
                if (preg_match('/^([^-]+)-/', $sname, $snamebuf)) {
-
 
266
                    $sname = ' ('.$snamebuf[1].')';
-
 
267
                } else {
-
 
268
                    $sname = '';
-
 
269
                }
-
 
270
            }
95
      $data = array();
271
            $data = array();
-
 
272
/* not tested yet
96
      if (ereg("(.*):(.*)\((.*)=(.*),(.*)=(.*)\)(.*)", $line, $data));
273
            if (preg_match("/^(.+):(.+) W\s*\((.+)=(.+) W,(.+)=(.+) W\)(.*)\)/", $line, $data)) {
-
 
274
                ;
97
      elseif (ereg("(.*):(.*)\((.*)=(.*)\)(.*)", $line, $data));
275
            } elseif (preg_match("/^(.+):(.+) W\s*\((.+)=(.+) W,(.+)=(.+) W\)(.*)/", $line, $data)) {
-
 
276
                ;
98
      else ereg("(.*):(.*)", $line, $data);
277
            } else
99
 
278
*/
-
 
279
            if (preg_match("/^(.+):(.+) W\s*\((.+)=(.+) W\)(.*)/", $line, $data)) {
100
      if (count($data) > 1) {
280
                ;
101
        $temp = explode(" ", trim($data[2]));
281
            } elseif (preg_match("/^(.+):(.+) W\s*\(/", $line, $data)) {
-
 
282
                ;
102
        if (count($temp) == 1)
283
            } else {
103
          $temp = explode("\xb0", trim($data[2]));
284
                preg_match("/^(.+):(.+) W$/", $line, $data);
104
	if(isset($temp[1])) {
285
            }
105
          switch ($temp[1]) {
286
            if (count($data)>2) {
106
            case "RPM":
287
                foreach ($data as $key=>$value) {
-
 
288
                    if (preg_match("/^\+?(-?[0-9\.]+).?$/", trim($value), $newvalue)) {
107
              array_push($ar_buf, $line);
289
                        $data[$key] = 0+trim($newvalue[1]);
108
              break;
290
                    } else {
-
 
291
                        $data[$key] = trim($value);
109
          }
292
                    }
110
	}
293
                }
-
 
294
                $dev = new SensorDevice();
-
 
295
                $dev->setName($data[1].$sname);
-
 
296
                $dev->setValue($data[2]);
-
 
297
 
-
 
298
/* not tested yet
-
 
299
                if (isset($data[6]) && $data[2] <= $data[6]) {
-
 
300
                    $dev->setMax(max($data[4], $data[6]));
-
 
301
                } else
-
 
302
*/
-
 
303
                if (isset($data[4]) && $data[2] <= $data[4]) {
-
 
304
                    $dev->setMax($data[4]);
-
 
305
                }
-
 
306
                if (preg_match("/\sALARM\s*$/", $line)) {
-
 
307
                    $dev->setEvent("Alarm");
-
 
308
                }
-
 
309
                $this->mbinfo->setMbPower($dev);
-
 
310
            }
111
      }
311
        }
112
    }
312
    }
113
 
313
 
114
    $i = 0;
314
    /**
115
    foreach($ar_buf as $line) {
-
 
116
      unset($data);
315
     * get current information
117
      if (ereg("(.*):(.*) RPM  \((.*)=(.*) RPM,(.*)=(.*)\)(.*)\)", $line, $data));
-
 
118
      elseif (ereg("(.*):(.*) RPM  \((.*)=(.*) RPM,(.*)=(.*)\)(.*)", $line, $data));
-
 
119
      elseif (ereg("(.*):(.*) RPM  \((.*)=(.*) RPM\)(.*)", $line, $data));
-
 
120
      else ereg("(.*):(.*) RPM", $line, $data);
-
 
121
 
-
 
122
      $results[$i]['label'] = trim($data[1]);
-
 
123
      $results[$i]['value'] = trim($data[2]);
-
 
124
      $results[$i]['min'] = isset($data[4]) ? trim($data[4]) : 0;
-
 
125
      $i++;
-
 
126
    }
316
     *
127
 
-
 
128
    asort($results);
317
     * @return void
129
    return array_values($results);
-
 
130
  }
318
     */
131
 
-
 
132
  function voltage() {
-
 
133
    $ar_buf = array();
-
 
134
    $results = array();
319
    private function _current()
135
 
-
 
136
    $sensors_value = $this->lines;
-
 
137
 
-
 
138
    foreach($sensors_value as $line) {
-
 
139
      $data = array();
-
 
140
      if (ereg("(.*):(.*)\((.*)=(.*),(.*)=(.*)\)(.*)", $line, $data));
-
 
141
      else ereg("(.*):(.*)", $line, $data);
-
 
142
      
320
    {
143
      if (count($data) > 1) {
321
        $sname = '';
144
        $temp = explode(" ", trim($data[2]));
322
        foreach ($this->_lines as $line) {
145
        if (count($temp) == 1)
323
            if ((trim($line) !== "") && (strpos($line, ':') === false)) {
146
          $temp = explode("\xb0", trim($data[2]));
324
                $sname = trim($line);
147
        if (isset($temp[1])) {
325
                if (preg_match('/^([^-]+)-/', $sname, $snamebuf)) {
148
          switch ($temp[1]) {
326
                    $sname = ' ('.$snamebuf[1].')';
149
            case "V":
327
                } else {
150
              array_push($ar_buf, $line);
-
 
151
              break;
328
                    $sname = '';
152
	  }
329
                }
153
        }
330
            }
-
 
331
            $data = array();
-
 
332
            if (preg_match("/^(.+):(.+) A\s*\((.+)=(.+) A,(.+)=(.+) A\)(.*)\)/", $line, $data)) {
-
 
333
                ;
-
 
334
            } elseif (preg_match("/^(.+):(.+) A\s*\((.+)=(.+) A,(.+)=(.+) A\)(.*)/", $line, $data)) {
-
 
335
                ;
-
 
336
            } elseif (preg_match("/^(.+):(.+) A\s*\(/", $line, $data)) {
-
 
337
                ;
-
 
338
            } else {
-
 
339
                preg_match("/^(.+):(.+) A$/", $line, $data);
-
 
340
            }
-
 
341
            if (count($data)>2) {
-
 
342
                foreach ($data as $key=>$value) {
-
 
343
                    if (preg_match("/^\+?([0-9\.]+).?$/", trim($value), $newvalue)) {
-
 
344
                        $data[$key] = trim($newvalue[1]);
-
 
345
                    } else {
-
 
346
                        $data[$key] = trim($value);
-
 
347
                    }
-
 
348
                }
-
 
349
                $dev = new SensorDevice();
-
 
350
                $dev->setName($data[1].$sname);
-
 
351
                $dev->setValue($data[2]);
-
 
352
                if (isset($data[4])) {
-
 
353
                    $dev->setMin($data[4]);
-
 
354
                }
-
 
355
                if (isset($data[6])) {
-
 
356
                    $dev->setMax($data[6]);
-
 
357
                }
-
 
358
                if (preg_match("/\sALARM\s*$/", $line)) {
-
 
359
                    $dev->setEvent("Alarm");
-
 
360
                }
-
 
361
                $this->mbinfo->setMbCurrent($dev);
-
 
362
            }
154
      }
363
        }
155
    }
364
    }
156
 
365
 
157
    $i = 0;
366
    /**
158
    foreach($ar_buf as $line) {
367
     * get other information
-
 
368
     *
159
      unset($data);
369
     * @return void
-
 
370
     */
160
      if (ereg("(.*):(.*) V  \((.*)=(.*) V,(.*)=(.*) V\)(.*)\)", $line, $data));
371
    private function _other()
161
      elseif (ereg("(.*):(.*) V  \((.*)=(.*) V,(.*)=(.*) V\)(.*)", $line, $data));
-
 
-
 
372
    {
162
      else ereg("(.*):(.*) V$", $line, $data);
373
        $sname = '';
163
      if(isset($data[1])) {
374
        foreach ($this->_lines as $line) {
164
        $results[$i]['label'] = trim($data[1]);
375
            if ((trim($line) !== "") && (strpos($line, ':') === false)) {
165
        $results[$i]['value'] = trim($data[2]);
376
                $sname = trim($line);
166
        $results[$i]['min'] = isset($data[4]) ? trim($data[4]) : 0;
377
                if (preg_match('/^([^-]+)-/', $sname, $snamebuf)) {
167
        $results[$i]['max'] = isset($data[6]) ? trim($data[6]) : 0;
378
                    $sname = ' ('.$snamebuf[1].')';
168
        $i++;
379
                } else {
-
 
380
                    $sname = '';
169
      }
381
                }
170
    }
382
            }
-
 
383
            $data = array();
-
 
384
            preg_match("/^(.+):\s*([^\-\+\d\s].+)$/", $line, $data);
-
 
385
            if ((count($data)>2) && ($data[1]!=="Adapter")) {
-
 
386
                $dev = new SensorDevice();
-
 
387
                $dev->setName($data[1].$sname);
-
 
388
                if (preg_match("/(.*\s*)ALARM\s*$/", $data[2], $aldata)) {
-
 
389
                    $dev->setEvent("Alarm");
-
 
390
                    if ((count($aldata)>1) && trim($aldata[1]!=="")) {
-
 
391
                        $dev->setValue(trim($aldata[1]));
-
 
392
                    } else {
-
 
393
                        $dev->setValue($data[2]);
171
    return $results;
394
                    }
-
 
395
                } else {
-
 
396
                    $dev->setValue($data[2]);
-
 
397
                }
-
 
398
                $this->mbinfo->setMbOther($dev);
-
 
399
            }
172
  }
400
        }
173
}
401
    }
174
 
402
 
-
 
403
    /**
-
 
404
     * get the information
-
 
405
     *
-
 
406
     * @see PSI_Interface_Sensor::build()
-
 
407
     *
-
 
408
     * @return Void
-
 
409
     */
-
 
410
    public function build()
-
 
411
    {
-
 
412
        $this->_temperature();
-
 
413
        $this->_voltage();
-
 
414
        $this->_fans();
-
 
415
        $this->_power();
-
 
416
        $this->_current();
-
 
417
        $this->_other();
-
 
418
    }
175
?>
419
}