/web/acc/phpsysinfo/includes/mb/class.coretemp.inc.php |
---|
File deleted |
/web/acc/phpsysinfo/includes/mb/class.cpumem.inc.php |
---|
0,0 → 1,96 |
<?php |
/** |
* cpumem sensor class, getting hardware sensors information of CPU and memory |
* |
* PHP version 5 |
* |
* @category PHP |
* @package PSI_Sensor |
* @author Michael Cramer <BigMichi1@users.sourceforge.net> |
* @author William Johansson <radar@radhuset.org> |
* @copyright 2009 phpSysInfo |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version |
* @version Release: 3.0 |
* @link http://phpsysinfo.sourceforge.net |
*/ |
class CpuMem extends Hwmon |
{ |
/** |
* get the information |
* |
* @see PSI_Interface_Sensor::build() |
* |
* @return void |
*/ |
public function build() |
{ |
if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) { |
$hwpaths = CommonFunctions::findglob("/sys/devices/platform/coretemp.*/", GLOB_NOSORT); |
if (is_array($hwpaths) && (count($hwpaths) > 0)) { |
$hwpaths2 = CommonFunctions::findglob("/sys/devices/platform/coretemp.*/hwmon/hwmon*/", GLOB_NOSORT); |
if (is_array($hwpaths2) && (count($hwpaths2) > 0)) { |
$hwpaths = array_merge($hwpaths, $hwpaths2); |
} |
$totalh = count($hwpaths); |
for ($h = 0; $h < $totalh; $h++) { |
$this->_temperature($hwpaths[$h]); |
} |
} |
} elseif (PSI_OS == 'FreeBSD') { |
$smp = 1; |
CommonFunctions::executeProgram('sysctl', '-n kern.smp.cpus', $smp); |
for ($i = 0; $i < $smp; $i++) { |
$temp = 0; |
if (CommonFunctions::executeProgram('sysctl', '-n dev.cpu.'.$i.'.temperature', $temp)) { |
$temp = preg_replace('/,/', '.', preg_replace('/C/', '', $temp)); |
$dev = new SensorDevice(); |
$dev->setName("CPU ".($i + 1)); |
$dev->setValue($temp); |
// $dev->setMax(70); |
$this->mbinfo->setMbTemp($dev); |
} |
} |
} elseif ((PSI_OS == 'WINNT') || defined('PSI_EMU_HOSTNAME')) { |
$allCpus = WINNT::_get_Win32_Processor(); |
foreach ($allCpus as $oneCpu) if (isset($oneCpu['CurrentVoltage']) && ($oneCpu['CurrentVoltage'] > 0)) { |
$dev = new SensorDevice(); |
$dev->setName($oneCpu['DeviceID']); |
$dev->setValue($oneCpu['CurrentVoltage']/10); |
$this->mbinfo->setMbVolt($dev); |
} |
$allMems = WINNT::_get_Win32_PhysicalMemory(); |
$counter = 0; |
foreach ($allMems as $oneMem) if (isset($oneMem['ConfiguredVoltage']) && ($oneMem['ConfiguredVoltage'] > 0)) { |
$dev = new SensorDevice(); |
$dev->setName('Mem'.($counter++)); |
$dev->setValue($oneMem['ConfiguredVoltage']/1000); |
if (isset($oneMem['MaxVoltage']) && ($oneMem['MaxVoltage'] > 0)) { |
$dev->setMax($oneMem['MaxVoltage']/1000); |
} |
if (isset($oneMem['MinVoltage']) && ($oneMem['MinVoltage'] > 0)) { |
$dev->setMin($oneMem['MinVoltage']/1000); |
} |
$this->mbinfo->setMbVolt($dev); |
} |
} |
if ((PSI_OS != 'WINNT') && !defined('PSI_EMU_HOSTNAME')) { |
$dmimd = CommonFunctions::readdmimemdata(); |
$counter = 0; |
foreach ($dmimd as $mem) { |
if (isset($mem['Size']) && preg_match('/^(\d+)\s(M|G)B$/', $mem['Size'], $size) && ($size[1] > 0) |
&& isset($mem['Configured Voltage']) && preg_match('/^([\d\.]+)\sV$/', $mem['Configured Voltage'], $voltage) && ($voltage[1] > 0)) { |
$dev = new SensorDevice(); |
$dev->setName('Mem'.($counter++)); |
$dev->setValue($voltage[1]); |
if (isset($mem['Minimum Voltage']) && preg_match('/^([\d\.]+)\sV$/', $mem['Minimum Voltage'], $minv) && ($minv[1] > 0)) { |
$dev->setMin($minv[1]); |
} |
if (isset($mem['Maximum Voltage']) && preg_match('/^([\d\.]+)\sV$/', $mem['Maximum Voltage'], $maxv) && ($maxv[1] > 0)) { |
$dev->setMax($maxv[1]); |
} |
$this->mbinfo->setMbVolt($dev); |
} |
} |
} |
} |
} |
/web/acc/phpsysinfo/includes/mb/class.freeipmi.inc.php |
---|
33,13 → 33,12 |
$this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
break; |
case 'data': |
if (CommonFunctions::rfts(PSI_APP_ROOT.'/data/freeipmi.txt', $lines)) { |
if (CommonFunctions::rftsdata('freeipmi.tmp', $lines)) { |
$this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
} |
break; |
default: |
$this->error->addConfigError('__construct()', '[sensor_freeipmi] ACCESS'); |
break; |
} |
} |
173,7 → 172,7 |
* |
* @see PSI_Interface_Sensor::build() |
* |
* @return Void |
* @return void |
*/ |
public function build() |
{ |
/web/acc/phpsysinfo/includes/mb/class.hddtemp.inc.php |
---|
90,7 → 90,6 |
break; |
default: |
$this->error->addConfigError("temperature()", "[sensor_hddtemp] ACCESS"); |
break; |
} |
// Timo van Roermund: parse the info from the hddtemp daemon. |
foreach ($ar_buf as $line) { |
115,7 → 114,7 |
* |
* @see PSI_Interface_Sensor::build() |
* |
* @return Void |
* @return void |
*/ |
public function build() |
{ |
/web/acc/phpsysinfo/includes/mb/class.healthd.inc.php |
---|
37,7 → 37,7 |
} |
break; |
case 'data': |
if (CommonFunctions::rfts(PSI_APP_ROOT.'/data/healthd.txt', $lines)) { |
if (CommonFunctions::rftsdata('healthd.tmp', $lines)) { |
$lines0 = preg_split("/\n/", $lines, 1, PREG_SPLIT_NO_EMPTY); |
if (count($lines0) == 1) { |
$this->_values = preg_split("/\t+/", $lines0[0]); |
46,7 → 46,6 |
break; |
default: |
$this->error->addConfigError('__construct()', '[sensor_healthd] ACCESS'); |
break; |
} |
} |
146,7 → 145,7 |
* |
* @see PSI_Interface_Sensor::build() |
* |
* @return Void |
* @return void |
*/ |
public function build() |
{ |
/web/acc/phpsysinfo/includes/mb/class.hwmon.inc.php |
---|
22,7 → 22,7 |
*/ |
protected function _temperature($hwpath) |
{ |
$sensor = glob($hwpath."temp*_input", GLOB_NOSORT); |
$sensor = CommonFunctions::findglob($hwpath."temp*_input", GLOB_NOSORT); |
if (is_array($sensor) && (($total = count($sensor)) > 0)) { |
$buf = ""; |
for ($i = 0; $i < $total; $i++) if (($buf = CommonFunctions::rolv($sensor[$i]))!==null) { |
71,7 → 71,7 |
*/ |
private function _voltage($hwpath) |
{ |
$sensor = glob($hwpath."in*_input", GLOB_NOSORT); |
$sensor = CommonFunctions::findglob($hwpath."in*_input", GLOB_NOSORT); |
if (is_array($sensor) && (($total = count($sensor)) > 0)) { |
$buf = ""; |
for ($i = 0; $i < $total; $i++) if (($buf = CommonFunctions::rolv($sensor[$i]))!==null) { |
114,7 → 114,7 |
*/ |
protected function _fans($hwpath) |
{ |
$sensor = glob($hwpath."fan*_input", GLOB_NOSORT); |
$sensor = CommonFunctions::findglob($hwpath."fan*_input", GLOB_NOSORT); |
if (is_array($sensor) && (($total = count($sensor)) > 0)) { |
$buf = ""; |
for ($i = 0; $i < $total; $i++) if (($buf = CommonFunctions::rolv($sensor[$i]))!==null) { |
159,7 → 159,7 |
*/ |
private function _power($hwpath) |
{ |
$sensor = glob($hwpath."power*_input", GLOB_NOSORT); |
$sensor = CommonFunctions::findglob($hwpath."power*_input", GLOB_NOSORT); |
if (is_array($sensor) && (($total = count($sensor)) > 0)) { |
$buf = ""; |
for ($i = 0; $i < $total; $i++) if (($buf = CommonFunctions::rolv($sensor[$i]))!==null) { |
202,7 → 202,7 |
*/ |
private function _current($hwpath) |
{ |
$sensor = glob($hwpath."curr*_input", GLOB_NOSORT); |
$sensor = CommonFunctions::findglob($hwpath."curr*_input", GLOB_NOSORT); |
if (is_array($sensor) && (($total = count($sensor)) > 0)) { |
$buf = ""; |
for ($i = 0; $i < $total; $i++) if (($buf = CommonFunctions::rolv($sensor[$i]))!==null) { |
242,14 → 242,14 |
* |
* @see PSI_Interface_Sensor::build() |
* |
* @return Void |
* @return void |
*/ |
public function build() |
{ |
if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) { |
$hwpaths = glob("/sys/class/hwmon/hwmon*/", GLOB_NOSORT); |
$hwpaths = CommonFunctions::findglob("/sys/class/hwmon/hwmon*/", GLOB_NOSORT); |
if (is_array($hwpaths) && (count($hwpaths) > 0)) { |
$hwpaths2 = glob("/sys/class/hwmon/hwmon*/device/", GLOB_NOSORT); |
$hwpaths2 = CommonFunctions::findglob("/sys/class/hwmon/hwmon*/device/", GLOB_NOSORT); |
if (is_array($hwpaths2) && (count($hwpaths2) > 0)) { |
$hwpaths = array_merge($hwpaths, $hwpaths2); |
} |
/web/acc/phpsysinfo/includes/mb/class.hwsensors.inc.php |
---|
136,7 → 136,7 |
* |
* @see PSI_Interface_Sensor::build() |
* |
* @return Void |
* @return void |
*/ |
public function build() |
{ |
/web/acc/phpsysinfo/includes/mb/class.ipmicfg.inc.php |
---|
40,13 → 40,12 |
$this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
break; |
case 'data': |
if (CommonFunctions::rfts(PSI_APP_ROOT.'/data/ipmicfg.txt', $lines)) { |
if (CommonFunctions::rftsdata('ipmicfg.tmp', $lines)) { |
$this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
} |
break; |
default: |
$this->error->addConfigError('__construct()', '[sensor_ipmicfg] ACCESS'); |
break; |
} |
} |
60,15 → 59,15 |
foreach ($this->_lines as $line) { |
$buffer = preg_split("/\s*\|\s*/", $line); |
if ((!defined('PSI_SENSOR_IPMICFG_PSFRUINFO') || (strtolower(PSI_SENSOR_IPMICFG_PSFRUINFO)!=="only")) && |
(count($buffer)==6) && preg_match("/^\s*\(\d+\)\s(.*)\s*$/", $buffer[1], $namebuff) && preg_match("/^\s*([-\d]+)C\/[-\d]+F\s*$/",$buffer[2], $valbuff)) { |
(count($buffer)==6) && preg_match("/^\s*\(\d+\)\s(.*)\s*$/", $buffer[1], $namebuff) && preg_match("/^\s*([-\d]+)C\/[-\d]+F\s*$/", $buffer[2], $valbuff)) { |
$dev = new SensorDevice(); |
$dev->setName($namebuff[1]); |
if ($valbuff[1]<-128) $valbuff[1]+=256; //+256 correction |
$dev->setValue($valbuff[1]); |
if (preg_match("/^\s*([-\d]+)C\/[-\d]+F\s*$/",$buffer[3], $valbuffmin)) { |
if (preg_match("/^\s*([-\d]+)C\/[-\d]+F\s*$/", $buffer[3], $valbuffmin)) { |
if ($valbuffmin[1]<-128) $valbuffmin[1]+=256; //+256 correction |
} |
if (preg_match("/^\s*([-\d]+)C\/[-\d]+F\s*$/",$buffer[4], $valbuffmax)) { |
if (preg_match("/^\s*([-\d]+)C\/[-\d]+F\s*$/", $buffer[4], $valbuffmax)) { |
if ($valbuffmax[1]<-128) $valbuffmax[1]+=256; //+256 correction |
$dev->setMax($valbuffmax[1]); |
} |
96,14 → 95,14 |
foreach ($this->_lines as $line) { |
$buffer = preg_split("/\s*\|\s*/", $line); |
if ((!defined('PSI_SENSOR_IPMICFG_PSFRUINFO') || (strtolower(PSI_SENSOR_IPMICFG_PSFRUINFO)!=="only")) && |
(count($buffer)==6) && preg_match("/^\s*\(\d+\)\s(.*)\s*$/", $buffer[1], $namebuff) && preg_match("/^\s*([\d\.]+)\sV\s*$/",$buffer[2], $valbuff)) { |
(count($buffer)==6) && preg_match("/^\s*\(\d+\)\s(.*)\s*$/", $buffer[1], $namebuff) && preg_match("/^\s*([\d\.]+)\sV\s*$/", $buffer[2], $valbuff)) { |
$dev = new SensorDevice(); |
$dev->setName($namebuff[1]); |
$dev->setValue($valbuff[1]); |
if (preg_match("/^\s*([\d\.].+)\sV\s*$/",$buffer[3], $valbuffmin)) { |
if (preg_match("/^\s*([\d\.].+)\sV\s*$/", $buffer[3], $valbuffmin)) { |
$dev->setMin($valbuffmin[1]); |
} |
if (preg_match("/^\s*([\d\.].+)\sV\s*$/",$buffer[4], $valbuffmax)) { |
if (preg_match("/^\s*([\d\.].+)\sV\s*$/", $buffer[4], $valbuffmax)) { |
$dev->setMax($valbuffmax[1]); |
} |
if (trim($buffer[0]) != "OK") $dev->setEvent(trim($buffer[0])); |
122,11 → 121,11 |
foreach ($this->_lines as $line) { |
$buffer = preg_split("/\s*\|\s*/", $line); |
if ((!defined('PSI_SENSOR_IPMICFG_PSFRUINFO') || (strtolower(PSI_SENSOR_IPMICFG_PSFRUINFO)!=="only")) && |
(count($buffer)==6) && preg_match("/^\s*\(\d+\)\s(.*)\s*$/", $buffer[1], $namebuff) && preg_match("/^\s*(\d+)\sRPM\s*$/",$buffer[2], $valbuff)) { |
(count($buffer)==6) && preg_match("/^\s*\(\d+\)\s(.*)\s*$/", $buffer[1], $namebuff) && preg_match("/^\s*(\d+)\sRPM\s*$/", $buffer[2], $valbuff)) { |
$dev = new SensorDevice(); |
$dev->setName($namebuff[1]); |
$dev->setValue($valbuff[1]); |
if (preg_match("/^\s*(\d+)\sRPM\s*$/",$buffer[3], $valbuffmin)) { |
if (preg_match("/^\s*(\d+)\sRPM\s*$/", $buffer[3], $valbuffmin)) { |
$dev->setMin($valbuffmin[1]); |
} |
if ((trim($buffer[0]) != "OK") && isset($valbuffmin[1])) { |
153,11 → 152,11 |
foreach ($this->_lines as $line) { |
$buffer = preg_split("/\s*\|\s*/", $line); |
if ((!defined('PSI_SENSOR_IPMICFG_PSFRUINFO') || (strtolower(PSI_SENSOR_IPMICFG_PSFRUINFO)!=="only")) && |
(count($buffer)==6) && preg_match("/^\s*\(\d+\)\s(.*)\s*$/", $buffer[1], $namebuff) && preg_match("/^\s*(\d+)\sWatts\s*$/",$buffer[2], $valbuff)) { |
(count($buffer)==6) && preg_match("/^\s*\(\d+\)\s(.*)\s*$/", $buffer[1], $namebuff) && preg_match("/^\s*(\d+)\sWatts\s*$/", $buffer[2], $valbuff)) { |
$dev = new SensorDevice(); |
$dev->setName($namebuff[1]); |
$dev->setValue($valbuff[1]); |
if (preg_match("/^\s*(\d+)\sWatts\s*$/",$buffer[4], $valbuffmax)) { |
if (preg_match("/^\s*(\d+)\sWatts\s*$/", $buffer[4], $valbuffmax)) { |
$dev->setMax($valbuffmax[1]); |
} |
if (trim($buffer[0]) != "OK") $dev->setEvent(trim($buffer[0])); |
176,14 → 175,14 |
foreach ($this->_lines as $line) { |
$buffer = preg_split("/\s*\|\s*/", $line); |
if ((!defined('PSI_SENSOR_IPMICFG_PSFRUINFO') || (strtolower(PSI_SENSOR_IPMICFG_PSFRUINFO)!=="only")) && |
(count($buffer)==6) && preg_match("/^\s*\(\d+\)\s(.*)\s*$/", $buffer[1], $namebuff) && preg_match("/^\s*([\d\.]+)\sAmps\s*$/",$buffer[2], $valbuff)) { |
(count($buffer)==6) && preg_match("/^\s*\(\d+\)\s(.*)\s*$/", $buffer[1], $namebuff) && preg_match("/^\s*([\d\.]+)\sAmps\s*$/", $buffer[2], $valbuff)) { |
$dev = new SensorDevice(); |
$dev->setName($namebuff[1]); |
$dev->setValue($valbuff[1]); |
if (preg_match("/^\s*([\d\.].+)\sAmps\s*$/",$buffer[3], $valbuffmin)) { |
if (preg_match("/^\s*([\d\.].+)\sAmps\s*$/", $buffer[3], $valbuffmin)) { |
$dev->setMin($valbuffmin[1]); |
} |
if (preg_match("/^\s*([\d\.].+)\sAmps\s*$/",$buffer[4], $valbuffmax)) { |
if (preg_match("/^\s*([\d\.].+)\sAmps\s*$/", $buffer[4], $valbuffmax)) { |
$dev->setMax($valbuffmax[1]); |
} |
if (trim($buffer[0]) != "OK") $dev->setEvent(trim($buffer[0])); |
225,7 → 224,7 |
* |
* @see PSI_Interface_Sensor::build() |
* |
* @return Void |
* @return void |
*/ |
public function build() |
{ |
/web/acc/phpsysinfo/includes/mb/class.ipmitool.inc.php |
---|
33,11 → 33,10 |
CommonFunctions::executeProgram('ipmitool', 'sensor -v', $lines); |
break; |
case 'data': |
CommonFunctions::rfts(PSI_APP_ROOT.'/data/ipmitool.txt', $lines); |
CommonFunctions::rftsdata('ipmitool.tmp', $lines); |
break; |
default: |
$this->error->addConfigError('__construct()', '[sensor_ipmitool] ACCESS'); |
break; |
} |
if (trim($lines) !== "") { |
if (preg_match("/^Sensor ID\s+/", $lines)) { //new data format ('ipmitool sensor -v') |
126,7 → 125,6 |
$sens['Sensor Type (Discrete)'] = ''; |
$sens['State'] = $buffer[1]; |
} |
break; |
} |
$this->_buf[] = $sens; |
} |
306,7 → 304,7 |
* |
* @see PSI_Interface_Sensor::build() |
* |
* @return Void |
* @return void |
*/ |
public function build() |
{ |
/web/acc/phpsysinfo/includes/mb/class.ipmiutil.inc.php |
---|
33,13 → 33,12 |
$this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
break; |
case 'data': |
if (CommonFunctions::rfts(PSI_APP_ROOT.'/data/ipmiutil.txt', $lines)) { |
if (CommonFunctions::rftsdata('ipmiutil.tmp', $lines)) { |
$this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
} |
break; |
default: |
$this->error->addConfigError('__construct()', '[sensor_ipmiutil] ACCESS'); |
break; |
} |
} |
230,11 → 229,15 |
$buffer5s = preg_split("/\s+/", $buffer5 = $buffer[5]); |
if (isset($buffer5s[1])) { |
$value = hexdec($buffer5s[0]) & 0xff; |
if ($buffer5s[1] === 'DiscreteEvt') { |
$dev->setValue('0x'.dechex($value)); |
} elseif (($buffer5s[1] === 'DiscreteUnit') && ($value > 0)) { |
$dev->setValue('0x'.dechex($value - 1)); |
if (preg_match('/^[0-9A-Fa-f]+$/', $buffer5s[0])) { |
$value = hexdec($buffer5s[0]) & 0xff; |
if ($buffer5s[1] === 'DiscreteEvt') { |
$dev->setValue('0x'.dechex($value)); |
} elseif (($buffer5s[1] === 'DiscreteUnit') && ($value > 0)) { |
$dev->setValue('0x'.dechex($value - 1)); |
} else { |
$dev->setValue($buffer5); |
} |
} else { |
$dev->setValue($buffer5); |
} |
251,7 → 254,7 |
* |
* @see PSI_Interface_Sensor::build() |
* |
* @return Void |
* @return void |
*/ |
public function build() |
{ |
/web/acc/phpsysinfo/includes/mb/class.k8temp.inc.php |
---|
34,13 → 34,12 |
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
break; |
case 'data': |
if (CommonFunctions::rfts(PSI_APP_ROOT.'/data/k8temp.txt', $lines)) { |
if (CommonFunctions::rftsdata('k8temp.tmp', $lines)) { |
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
} |
break; |
default: |
$this->error->addConfigError('__construct()', '[sensor_k8temp] ACCESS'); |
break; |
} |
} |
71,7 → 70,7 |
* |
* @see PSI_Interface_Sensor::build() |
* |
* @return Void |
* @return void |
*/ |
public function build() |
{ |
/web/acc/phpsysinfo/includes/mb/class.lmsensors.inc.php |
---|
33,11 → 33,10 |
CommonFunctions::executeProgram("sensors", "", $lines); |
break; |
case 'data': |
CommonFunctions::rfts(PSI_APP_ROOT.'/data/lmsensors.txt', $lines); |
CommonFunctions::rftsdata('lmsensors.tmp', $lines); |
break; |
default: |
$this->error->addConfigError('__construct()', '[sensor_lmsensors] ACCESS'); |
break; |
} |
if (trim($lines) !== "") { |
74,15 → 73,23 |
; |
} elseif (preg_match("/^(.+):(.+).C\s*\((.+)=(.+).C\)(.*)/", $line, $data)) { |
; |
} elseif (preg_match("/^(.+):\s*(FAULT)\s*\((.+)=(.+).C,(.+)=(.+).C\)(.*)\)/", $line, $data)) { |
; |
} elseif (preg_match("/^(.+):\s*(FAULT)\s*\((.+)=(.+).C,(.+)=(.+).C\)(.*)/", $line, $data)) { |
; |
} elseif (preg_match("/^(.+):\s*(FAULT)\s*\((.+)=(.+).C\)(.*)/", $line, $data)) { |
; |
} elseif (preg_match("/^(.+):(.+).C\s*\(/", $line, $data)) { |
; |
} elseif (preg_match("/^(.+):(.+).C\s+\D+/", $line, $data)) { |
; |
} else { |
preg_match("/^(.+):(.+).C$/", $line, $data); |
preg_match("/^(.+):(.+).C\r?$/", $line, $data); |
} |
if (count($data)>2) { |
foreach ($data as $key=>$value) { |
if (preg_match("/^\+?(-?[0-9\.]+).?$/", trim($value), $newvalue)) { |
$data[$key] = 0+trim($newvalue[1]); |
$data[$key] = floatval($newvalue[1]); |
} else { |
$data[$key] = trim($value); |
} |
139,8 → 146,8 |
} elseif (isset($data[4]) && $data[2] <= $data[4]) { |
$dev->setMax($data[4]); |
} |
if (preg_match("/\sALARM\s*$/", $line) || preg_match("/\sALARM\s+sensor\s+=/", $line)) { |
$dev->setEvent("Alarm"); |
if (preg_match("/\s(ALARM)\s*$/", $line, $evbuf) || preg_match("/\s(ALARM)\s+sensor\s+=/", $line, $evbuf) || (($evbuf[1] = $dev->getValue()) === 'FAULT')) { |
$dev->setEvent($evbuf[1]); |
} |
$this->mbinfo->setMbTemp($dev); |
} |
171,15 → 178,23 |
; |
} elseif (preg_match("/^(.+):(.+) RPM\s*\((.+)=(.+) RPM\)(.*)/", $line, $data)) { |
; |
} elseif (preg_match("/^(.+):\s*(FAULT)\s*\((.+)=(.+) RPM,(.+)=(.+)\)(.*)\)/", $line, $data)) { |
; |
} elseif (preg_match("/^(.+):\s*(FAULT)\s*\((.+)=(.+) RPM,(.+)=(.+)\)(.*)/", $line, $data)) { |
; |
} elseif (preg_match("/^(.+):\s*(FAULT)\s*\((.+)=(.+) RPM\)(.*)/", $line, $data)) { |
; |
} elseif (preg_match("/^(.+):(.+) RPM\s*\(/", $line, $data)) { |
; |
} elseif (preg_match("/^(.+):(.+) RPM\s+\D+/", $line, $data)) { |
; |
} else { |
preg_match("/^(.+):(.+) RPM$/", $line, $data); |
preg_match("/^(.+):(.+) RPM\r?$/", $line, $data); |
} |
if (count($data)>2) { |
foreach ($data as $key=>$value) { |
if (preg_match("/^\+?(-?[0-9\.]+).?$/", trim($value), $newvalue)) { |
$data[$key] = 0+trim($newvalue[1]); |
$data[$key] = floatval($newvalue[1]); |
} else { |
$data[$key] = trim($value); |
} |
190,8 → 205,8 |
if (isset($data[4])) { |
$dev->setMin(trim($data[4])); |
} |
if (preg_match("/\sALARM\s*$/", $line)) { |
$dev->setEvent("Alarm"); |
if (preg_match("/\s(ALARM)\s*$/", $line, $evbuf) || (($evbuf[1] = $dev->getValue()) === 'FAULT')) { |
$dev->setEvent($evbuf[1]); |
} |
$this->mbinfo->setMbFan($dev); |
} |
220,16 → 235,22 |
; |
} elseif (preg_match("/^(.+):(.+) V\s*\((.+)=(.+) V,(.+)=(.+) V\)(.*)/", $line, $data)) { |
; |
} elseif (preg_match("/^(.+):\s*(FAULT)\s*\((.+)=(.+) V,(.+)=(.+) V\)(.*)\)/", $line, $data)) { |
; |
} elseif (preg_match("/^(.+):\s*(FAULT)\s*\((.+)=(.+) V,(.+)=(.+) V\)(.*)/", $line, $data)) { |
; |
} elseif (preg_match("/^(.+):(.+) V\s*\(/", $line, $data)) { |
; |
} elseif (preg_match("/^(.+):(.+) V\s+\D+/", $line, $data)) { |
; |
} else { |
preg_match("/^(.+):(.+) V$/", $line, $data); |
preg_match("/^(.+):(.+) V\r?$/", $line, $data); |
} |
if (count($data)>2) { |
foreach ($data as $key=>$value) { |
if (preg_match("/^\+?(-?[0-9\.]+)$/", trim($value), $newvalue)) { |
$data[$key] = 0+trim($newvalue[1]); |
$data[$key] = floatval($newvalue[1]); |
} else { |
$data[$key] = trim($value); |
} |
243,8 → 264,8 |
if (isset($data[6])) { |
$dev->setMax($data[6]); |
} |
if (preg_match("/\sALARM\s*$/", $line)) { |
$dev->setEvent("Alarm"); |
if (preg_match("/\s(ALARM)\s*$/", $line, $evbuf) || (($evbuf[1] = $dev->getValue()) === 'FAULT')) { |
$dev->setEvent($evbuf[1]); |
} |
$this->mbinfo->setMbVolt($dev); |
} |
274,19 → 295,27 |
; |
} elseif (preg_match("/^(.+):(.+) W\s*\((.+)=(.+) W,(.+)=(.+) W\)(.*)/", $line, $data)) { |
; |
} elseif (preg_match("/^(.+):\s*(FAULT)\s*\((.+)=(.+) W,(.+)=(.+) W\)(.*)\)/", $line, $data)) { |
; |
} elseif (preg_match("/^(.+):\s*(FAULT)\s*\((.+)=(.+) W,(.+)=(.+) W\)(.*)/", $line, $data)) { |
; |
} else |
*/ |
if (preg_match("/^(.+):(.+) W\s*\((.+)=(.+) W\)(.*)/", $line, $data)) { |
; |
} elseif (preg_match("/^(.+):\s*(FAULT)\s*\((.+)=(.+) W\)(.*)/", $line, $data)) { |
; |
} elseif (preg_match("/^(.+):(.+) W\s*\(/", $line, $data)) { |
; |
} elseif (preg_match("/^(.+):(.+) W\s+\D+/", $line, $data)) { |
; |
} else { |
preg_match("/^(.+):(.+) W$/", $line, $data); |
preg_match("/^(.+):(.+) W\r?$/", $line, $data); |
} |
if (count($data)>2) { |
foreach ($data as $key=>$value) { |
if (preg_match("/^\+?(-?[0-9\.]+).?$/", trim($value), $newvalue)) { |
$data[$key] = 0+trim($newvalue[1]); |
$data[$key] = floatval($newvalue[1]); |
} else { |
$data[$key] = trim($value); |
} |
303,8 → 332,8 |
if (isset($data[4]) && $data[2] <= $data[4]) { |
$dev->setMax($data[4]); |
} |
if (preg_match("/\sALARM\s*$/", $line)) { |
$dev->setEvent("Alarm"); |
if (preg_match("/\s(ALARM)\s*$/", $line, $evbuf) || (($evbuf[1] = $dev->getValue()) === 'FAULT')) { |
$dev->setEvent($evbuf[1]); |
} |
$this->mbinfo->setMbPower($dev); |
} |
333,10 → 362,16 |
; |
} elseif (preg_match("/^(.+):(.+) A\s*\((.+)=(.+) A,(.+)=(.+) A\)(.*)/", $line, $data)) { |
; |
} elseif (preg_match("/^(.+):\s*(FAULT)\s*\((.+)=(.+) A,(.+)=(.+) A\)(.*)\)/", $line, $data)) { |
; |
} elseif (preg_match("/^(.+):\s*(FAULT)\s*\((.+)=(.+) A,(.+)=(.+) A\)(.*)/", $line, $data)) { |
; |
} elseif (preg_match("/^(.+):(.+) A\s*\(/", $line, $data)) { |
; |
} elseif (preg_match("/^(.+):(.+) A\s+\D+/", $line, $data)) { |
; |
} else { |
preg_match("/^(.+):(.+) A$/", $line, $data); |
preg_match("/^(.+):(.+) A\r?$/", $line, $data); |
} |
if (count($data)>2) { |
foreach ($data as $key=>$value) { |
355,8 → 390,8 |
if (isset($data[6])) { |
$dev->setMax($data[6]); |
} |
if (preg_match("/\sALARM\s*$/", $line)) { |
$dev->setEvent("Alarm"); |
if (preg_match("/\s(ALARM)\s*$/", $line, $evbuf) || (($evbuf[1] = $dev->getValue()) === 'FAULT')) { |
$dev->setEvent($evbuf[1]); |
} |
$this->mbinfo->setMbCurrent($dev); |
} |
381,8 → 416,8 |
} |
} |
$data = array(); |
preg_match("/^(.+):\s*([^\-\+\d\s].+)$/", $line, $data); |
if ((count($data)>2) && ($data[1]!=="Adapter")) { |
preg_match("/^(.+):\s*([^\-\+\d\s].+)\r?$/", $line, $data); |
if ((count($data)>2) && ($data[1]!=="Adapter") && !preg_match("/^FAULT/", $data[2])) { |
$dev = new SensorDevice(); |
$dev->setName($data[1].$sname); |
if (preg_match("/(.*\s*)ALARM\s*$/", $data[2], $aldata)) { |
405,7 → 440,7 |
* |
* @see PSI_Interface_Sensor::build() |
* |
* @return Void |
* @return void |
*/ |
public function build() |
{ |
/web/acc/phpsysinfo/includes/mb/class.mbm5.inc.php |
---|
36,7 → 36,7 |
parent::__construct(); |
if ((PSI_OS == 'WINNT') && !defined('PSI_EMU_HOSTNAME')) { |
$delim = "/;/"; |
CommonFunctions::rfts(PSI_APP_ROOT."/data/MBM5.csv", $buffer); |
CommonFunctions::rftsdata("MBM5.csv", $buffer); |
if (strpos($buffer, ";") === false) { |
$delim = "/,/"; |
} |
110,7 → 110,7 |
* |
* @see PSI_Interface_Sensor::build() |
* |
* @return Void |
* @return void |
*/ |
public function build() |
{ |
/web/acc/phpsysinfo/includes/mb/class.mbmon.inc.php |
---|
45,13 → 45,12 |
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
break; |
case 'data': |
if (CommonFunctions::rfts(PSI_APP_ROOT.'/data/mbmon.txt', $lines)) { |
if (CommonFunctions::rftsdata('mbmon.tmp', $lines)) { |
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
} |
break; |
default: |
$this->error->addConfigError('__construct()', '[sensor_mbmon] ACCESS'); |
break; |
} |
} |
/web/acc/phpsysinfo/includes/mb/class.nvidiasmi.inc.php |
---|
43,13 → 43,12 |
$this->_gpus = preg_split("/^(?=GPU )/m", $lines, -1, PREG_SPLIT_NO_EMPTY); |
break; |
case 'data': |
if (CommonFunctions::rfts(PSI_APP_ROOT.'/data/nvidiasmi.txt', $lines)) { |
if (CommonFunctions::rftsdata('nvidiasmi.tmp', $lines)) { |
$this->_gpus = preg_split("/^(?=GPU )/m", $lines, -1, PREG_SPLIT_NO_EMPTY); |
} |
break; |
default: |
$this->error->addConfigError('__construct()', '[sensor_nvidiasmi] ACCESS'); |
break; |
} |
} |
58,81 → 57,80 |
* |
* @see PSI_Interface_Sensor::build() |
* |
* @return Void |
* @return void |
*/ |
public function build() |
{ |
$gpuc=count($this->_gpus); |
switch ($gpuc) { |
case 0: |
$this->error->addError("nvidia-smi", "No values"); |
break; |
case 1: |
$this->error->addError("nvidia-smi", "Error: ".$this->_gpus[0]); |
break; |
default: |
for ($c = 0; $c < $gpuc; $c++) { |
if (preg_match("/^\s+GPU Current Temp\s+:\s*(\d+)\s*C\s*$/m", $this->_gpus[$c], $out)) { |
$dev = new SensorDevice(); |
$dev->setName("GPU ".($c)." (nvidiasmi)"); |
$dev->setValue($out[1]); |
if (preg_match("/^\s+GPU Shutdown Temp\s+:\s*(\d+)\s*C\s*$/m", $this->_gpus[$c], $out)) { |
$dev->setMax($out[1]); |
} |
$this->mbinfo->setMbTemp($dev); |
case 0: |
$this->error->addError("nvidia-smi", "No values"); |
break; |
case 1: |
$this->error->addError("nvidia-smi", "Error: ".$this->_gpus[0]); |
break; |
default: |
for ($c = 0; $c < $gpuc; $c++) { |
if (preg_match("/^\s+GPU Current Temp\s+:\s*(\d+)\s*C\s*$/m", $this->_gpus[$c], $out)) { |
$dev = new SensorDevice(); |
$dev->setName("GPU ".($c)." (nvidiasmi)"); |
$dev->setValue($out[1]); |
if (preg_match("/^\s+GPU Shutdown Temp\s+:\s*(\d+)\s*C\s*$/m", $this->_gpus[$c], $out)) { |
$dev->setMax($out[1]); |
} |
if (preg_match("/^\s+Power Draw\s+:\s*([\d\.]+)\s*W\s*$/m", $this->_gpus[$c], $out)) { |
$dev = new SensorDevice(); |
$dev->setName("GPU ".($c)." (nvidiasmi)"); |
$dev->setValue($out[1]); |
if (preg_match("/^\s+Power Limit\s+:\s*([\d\.]+)\s*W\s*$/m", $this->_gpus[$c], $out)) { |
$dev->setMax($out[1]); |
} |
$this->mbinfo->setMbPower($dev); |
$this->mbinfo->setMbTemp($dev); |
} |
if (preg_match("/^\s+Power Draw\s+:\s*([\d\.]+)\s*W\s*$/m", $this->_gpus[$c], $out)) { |
$dev = new SensorDevice(); |
$dev->setName("GPU ".($c)." (nvidiasmi)"); |
$dev->setValue($out[1]); |
if (preg_match("/^\s+Power Limit\s+:\s*([\d\.]+)\s*W\s*$/m", $this->_gpus[$c], $out)) { |
$dev->setMax($out[1]); |
} |
if (preg_match("/^\s+Fan Speed\s+:\s*(\d+)\s*%\s*$/m", $this->_gpus[$c], $out)) { |
$dev = new SensorDevice(); |
$dev->setName("GPU ".($c)." (nvidiasmi)"); |
$dev->setValue($out[1]); |
$dev->setUnit("%"); |
$this->mbinfo->setMbFan($dev); |
} |
if (preg_match("/^\s+Performance State\s+:\s*(\S+)\s*$/m", $this->_gpus[$c], $out)) { |
$dev = new SensorDevice(); |
$dev->setName("GPU ".($c)." Performance State (nvidiasmi)"); |
$dev->setValue($out[1]); |
$this->mbinfo->setMbOther($dev); |
} |
if (preg_match("/^\s+Gpu\s+:\s*(\d+)\s*%\s*$/m", $this->_gpus[$c], $out)) { |
$dev = new SensorDevice(); |
$dev->setName("GPU ".($c)." Utilization (nvidiasmi)"); |
$dev->setValue($out[1]); |
$dev->setUnit("%"); |
$this->mbinfo->setMbOther($dev); |
} |
if (preg_match("/^\s+Memory\s+:\s*(\d+)\s*%\s*$/m", $this->_gpus[$c], $out)) { |
$dev = new SensorDevice(); |
$dev->setName("GPU ".($c)." Memory Utilization (nvidiasmi)"); |
$dev->setValue($out[1]); |
$dev->setUnit("%"); |
$this->mbinfo->setMbOther($dev); |
} |
if (preg_match("/^\s+Encoder\s+:\s*(\d+)\s*%\s*$/m", $this->_gpus[$c], $out)) { |
$dev = new SensorDevice(); |
$dev->setName("GPU ".($c)." Encoder Utilization (nvidiasmi)"); |
$dev->setValue($out[1]); |
$dev->setUnit("%"); |
$this->mbinfo->setMbOther($dev); |
} |
if (preg_match("/^\s+Decoder\s+:\s*(\d+)\s*%\s*$/m", $this->_gpus[$c], $out)) { |
$dev = new SensorDevice(); |
$dev->setName("GPU ".($c)." Decoder Utilization (nvidiasmi)"); |
$dev->setValue($out[1]); |
$dev->setUnit("%"); |
$this->mbinfo->setMbOther($dev); |
} |
$this->mbinfo->setMbPower($dev); |
} |
break; |
if (preg_match("/^\s+Fan Speed\s+:\s*(\d+)\s*%\s*$/m", $this->_gpus[$c], $out)) { |
$dev = new SensorDevice(); |
$dev->setName("GPU ".($c)." (nvidiasmi)"); |
$dev->setValue($out[1]); |
$dev->setUnit("%"); |
$this->mbinfo->setMbFan($dev); |
} |
if (preg_match("/^\s+Performance State\s+:\s*(\S+)\s*$/m", $this->_gpus[$c], $out)) { |
$dev = new SensorDevice(); |
$dev->setName("GPU ".($c)." Performance State (nvidiasmi)"); |
$dev->setValue($out[1]); |
$this->mbinfo->setMbOther($dev); |
} |
if (preg_match("/^\s+Gpu\s+:\s*(\d+)\s*%\s*$/m", $this->_gpus[$c], $out)) { |
$dev = new SensorDevice(); |
$dev->setName("GPU ".($c)." Utilization (nvidiasmi)"); |
$dev->setValue($out[1]); |
$dev->setUnit("%"); |
$this->mbinfo->setMbOther($dev); |
} |
if (preg_match("/^\s+Memory\s+:\s*(\d+)\s*%\s*$/m", $this->_gpus[$c], $out)) { |
$dev = new SensorDevice(); |
$dev->setName("GPU ".($c)." Memory Utilization (nvidiasmi)"); |
$dev->setValue($out[1]); |
$dev->setUnit("%"); |
$this->mbinfo->setMbOther($dev); |
} |
if (preg_match("/^\s+Encoder\s+:\s*(\d+)\s*%\s*$/m", $this->_gpus[$c], $out)) { |
$dev = new SensorDevice(); |
$dev->setName("GPU ".($c)." Encoder Utilization (nvidiasmi)"); |
$dev->setValue($out[1]); |
$dev->setUnit("%"); |
$this->mbinfo->setMbOther($dev); |
} |
if (preg_match("/^\s+Decoder\s+:\s*(\d+)\s*%\s*$/m", $this->_gpus[$c], $out)) { |
$dev = new SensorDevice(); |
$dev->setName("GPU ".($c)." Decoder Utilization (nvidiasmi)"); |
$dev->setValue($out[1]); |
$dev->setUnit("%"); |
$this->mbinfo->setMbOther($dev); |
} |
} |
} |
} |
} |
/web/acc/phpsysinfo/includes/mb/class.ohm.inc.php |
---|
28,9 → 28,9 |
{ |
parent::__construct(); |
if ((PSI_OS == 'WINNT') || defined('PSI_EMU_HOSTNAME')) { |
$_wmi = CommonFunctions::initWMI('root\OpenHardwareMonitor', true); |
$_wmi = WINNT::initWMI('root\OpenHardwareMonitor', true); |
if ($_wmi) { |
$tmpbuf = CommonFunctions::getWMI($_wmi, 'Sensor', array('Parent', 'Name', 'SensorType', 'Value')); |
$tmpbuf = WINNT::getWMI($_wmi, 'Sensor', array('Parent', 'Name', 'SensorType', 'Value')); |
if ($tmpbuf) foreach ($tmpbuf as $buffer) { |
if (!isset($this->_buf[$buffer['SensorType']]) || !isset($this->_buf[$buffer['SensorType']][$buffer['Parent'].' '.$buffer['Name']])) { // avoid duplicates |
$this->_buf[$buffer['SensorType']][$buffer['Parent'].' '.$buffer['Name']] = $buffer['Value']; |
105,7 → 105,7 |
* |
* @see PSI_Interface_Sensor::build() |
* |
* @return Void |
* @return void |
*/ |
public function build() |
{ |
/web/acc/phpsysinfo/includes/mb/class.pitemp.inc.php |
---|
22,11 → 22,11 |
CommonFunctions::rfts('/sys/class/thermal/thermal_zone0/temp', $temp, 1); |
CommonFunctions::rfts('/sys/class/thermal/thermal_zone0/trip_point_0_temp', $temp_max, 1, 4096, PSI_DEBUG); |
} |
if (!is_null($temp) && (($temp = trim($temp)) != "")) { |
if (($temp !== null) && (($temp = trim($temp)) != "")) { |
$dev = new SensorDevice(); |
$dev->setName("CPU 1"); |
$dev->setValue($temp / 1000); |
if (!is_null($temp_max) && (($temp_max = trim($temp_max)) != "") && ($temp_max > 0)) { |
if (($temp_max !== null) && (($temp_max = trim($temp_max)) != "") && ($temp_max > 0)) { |
$dev->setMax($temp_max / 1000); |
} |
$this->mbinfo->setMbTemp($dev); |
36,7 → 36,7 |
private function _voltage() |
{ |
$volt = null; |
if (CommonFunctions::rfts('/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/ac/voltage_now', $volt, 1, 4096, false) && !is_null($volt) && (($volt = trim($volt)) != "")) { // Banana Pi |
if (CommonFunctions::rfts('/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/ac/voltage_now', $volt, 1, 4096, false) && ($volt !== null) && (($volt = trim($volt)) != "")) { // Banana Pi |
$dev = new SensorDevice(); |
$dev->setName("Voltage 1"); |
$dev->setValue($volt / 1000000); |
47,7 → 47,7 |
private function _current() |
{ |
$current = null; |
if (CommonFunctions::rfts('/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/ac/current_now', $current, 1, 4096, false) && !is_null($current) && (($current = trim($current)) != "")) { // Banana Pi |
if (CommonFunctions::rfts('/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/axp20-supplyer.28/power_supply/ac/current_now', $current, 1, 4096, false) && ($current !== null) && (($current = trim($current)) != "")) { // Banana Pi |
$dev = new SensorDevice(); |
$dev->setName("Current 1"); |
$dev->setValue($current / 1000000); |
/web/acc/phpsysinfo/includes/mb/class.qtssnmp.inc.php |
---|
71,7 → 71,7 |
* |
* @see PSI_Interface_Sensor::build() |
* |
* @return Void |
* @return void |
*/ |
public function build() |
{ |
/web/acc/phpsysinfo/includes/mb/class.speedfan.inc.php |
---|
38,7 → 38,7 |
} |
break; |
case 'data': |
if (CommonFunctions::rfts(PSI_APP_ROOT.'/data/speedfan.txt', $buffer) && (strlen($buffer) > 0)) { |
if (CommonFunctions::rftsdata('speedfan.tmp', $buffer) && (strlen($buffer) > 0)) { |
if (preg_match("/^Temperatures:\s+(.+)$/m", $buffer, $out)) { |
$this->_filecontent["temp"] = $out[1]; |
} |
52,7 → 52,6 |
break; |
default: |
$this->error->addConfigError('__construct()', '[sensor_speedfan] ACCESS'); |
break; |
} |
} |
115,7 → 114,7 |
* |
* @see PSI_Interface_Sensor::build() |
* |
* @return Void |
* @return void |
*/ |
public function build() |
{ |
/web/acc/phpsysinfo/includes/mb/class.thermalzone.inc.php |
---|
30,18 → 30,24 |
switch (defined('PSI_SENSOR_THERMALZONE_ACCESS')?strtolower(PSI_SENSOR_THERMALZONE_ACCESS):'command') { |
case 'command': |
if ((PSI_OS == 'WINNT') || defined('PSI_EMU_HOSTNAME')) { |
if (defined('PSI_EMU_HOSTNAME') || CommonFunctions::isAdmin()) { |
$_wmi = CommonFunctions::initWMI('root\WMI', true); |
if (defined('PSI_EMU_HOSTNAME') || WINNT::isAdmin()) { |
$_wmi = WINNT::initWMI('root\WMI', true); |
if ($_wmi) { |
$this->_buf = CommonFunctions::getWMI($_wmi, 'MSAcpi_ThermalZoneTemperature', array('InstanceName', 'CriticalTripPoint', 'CurrentTemperature')); |
$this->_buf = WINNT::getWMI($_wmi, 'MSAcpi_ThermalZoneTemperature', array('InstanceName', 'CriticalTripPoint', 'CurrentTemperature')); |
} |
} else { |
$this->error->addError("Error reading data from thermalzone sensor", "Allowed only for systems with administrator privileges (run as administrator)"); |
$_wmi = WINNT::getcimv2wmi(); |
if ($_wmi) { |
$this->_buf = WINNT::getWMI($_wmi, 'Win32_PerfFormattedData_Counters_ThermalZoneInformation', array('Name', 'HighPrecisionTemperature', 'Temperature')); |
} |
if (!$this->_buf || PSI_DEBUG) { |
$this->error->addError("Error reading data from thermalzone sensor", "Allowed only for systems with administrator privileges (run as administrator)"); |
} |
} |
} |
break; |
case 'data': |
if (!defined('PSI_EMU_HOSTNAME') && CommonFunctions::rfts(PSI_APP_ROOT.'/data/thermalzone.txt', $lines, 0, 4096, false)) { //output of "wmic /namespace:\\root\wmi PATH MSAcpi_ThermalZoneTemperature get CriticalTripPoint,CurrentTemperature,InstanceName" |
if (!defined('PSI_EMU_HOSTNAME') && CommonFunctions::rftsdata('thermalzone.tmp', $lines)) { //output of "wmic /namespace:\\root\wmi PATH MSAcpi_ThermalZoneTemperature get CriticalTripPoint,CurrentTemperature,InstanceName" |
$lines = trim(preg_replace('/[\x00-\x09\x0b-\x1F]/', '', $lines)); |
$lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
if ((($clines=count($lines)) > 1) && preg_match("/CriticalTripPoint\s+CurrentTemperature\s+InstanceName/i", $lines[0])) for ($i = 1; $i < $clines; $i++) { |
54,7 → 60,6 |
break; |
default: |
$this->error->addConfigError('__construct()', '[sensor_thermalzone] ACCESS'); |
break; |
} |
} |
81,15 → 86,27 |
$dev->setMax($maxvalue); |
} |
$this->mbinfo->setMbTemp($dev); |
} else { |
if ((isset($buffer['HighPrecisionTemperature']) && (($value = ($buffer['HighPrecisionTemperature'] - 2732)/10) > -100)) |
|| (isset($buffer['Temperature']) && (($value = ($buffer['Temperature'] - 273)) > -100))) { |
$dev = new SensorDevice(); |
if (isset($buffer['Name']) && preg_match("/([^\\\\\. ]+)$/", $buffer['Name'], $outbuf)) { |
$dev->setName('ThermalZone '.$outbuf[1]); |
} else { |
$dev->setName('ThermalZone THM0'); |
} |
$dev->setValue($value); |
$this->mbinfo->setMbTemp($dev); |
} |
} |
} |
} elseif (($mode == 'command') && (PSI_OS != 'WINNT') && !defined('PSI_EMU_HOSTNAME')) { |
$notwas = true; |
$thermalzones = glob('/sys/class/thermal/thermal_zone*/'); |
$thermalzones = CommonFunctions::findglob('/sys/class/thermal/thermal_zone*/'); |
if (is_array($thermalzones) && (count($thermalzones) > 0)) foreach ($thermalzones as $thermalzone) { |
$thermalzonetemp = $thermalzone.'temp'; |
$temp = null; |
if (CommonFunctions::rfts($thermalzonetemp, $temp, 1, 4096, false) && !is_null($temp) && (($temp = trim($temp)) != "")) { |
if (CommonFunctions::rfts($thermalzonetemp, $temp, 1, 4096, false) && ($temp !== null) && (($temp = trim($temp)) != "")) { |
if ($temp >= 1000) { |
$div = 1000; |
} elseif ($temp >= 200) { |
104,7 → 121,7 |
$dev->setValue($temp); |
$temp_type = null; |
if (CommonFunctions::rfts($thermalzone.'type', $temp_type, 1, 4096, false) && !is_null($temp_type) && (($temp_type = trim($temp_type)) != "")) { |
if (CommonFunctions::rfts($thermalzone.'type', $temp_type, 1, 4096, false) && ($temp_type !== null) && (($temp_type = trim($temp_type)) != "")) { |
$dev->setName($temp_type); |
} else { |
$dev->setName("ThermalZone"); |
111,7 → 128,7 |
} |
$temp_max = null; |
if (CommonFunctions::rfts($thermalzone.'trip_point_0_temp', $temp_max, 1, 4096, false) && !is_null($temp_max) && (($temp_max = trim($temp_max)) != "") && ($temp_max > -40)) { |
if (CommonFunctions::rfts($thermalzone.'trip_point_0_temp', $temp_max, 1, 4096, false) && ($temp_max !== null) && (($temp_max = trim($temp_max)) != "") && ($temp_max > -40)) { |
$temp_max = $temp_max / $div; |
if (($temp_max != 0) || ($temp != 0)) { // if non-zero values |
$dev->setMax($temp_max); |
125,10 → 142,10 |
} |
} |
if ($notwas) { |
$thermalzones = glob('/proc/acpi/thermal_zone/TH*/temperature'); |
$thermalzones = (PSI_ROOT_FILESYSTEM.'/proc/acpi/thermal_zone/TH*/temperature'); |
if (is_array($thermalzones) && (count($thermalzones) > 0)) foreach ($thermalzones as $thermalzone) { |
$temp = null; |
if (CommonFunctions::rfts($thermalzone, $temp, 1, 4096, false) && !is_null($temp) && (($temp = trim($temp)) != "")) { |
if (CommonFunctions::rfts($thermalzone, $temp, 1, 4096, false) && ($temp !== null) && (($temp = trim($temp)) != "")) { |
$dev = new SensorDevice(); |
if (preg_match("/^\/proc\/acpi\/thermal_zone\/(.+)\/temperature$/", $thermalzone, $name)) { |
$dev->setName("ThermalZone ".$name[1]); |
148,7 → 165,7 |
* |
* @see PSI_Interface_Sensor::build() |
* |
* @return Void |
* @return void |
*/ |
public function build() |
{ |
/web/acc/phpsysinfo/includes/mb/class.thinkpad.inc.php |
---|
19,14 → 19,14 |
* |
* @see PSI_Interface_Sensor::build() |
* |
* @return Void |
* @return void |
*/ |
public function build() |
{ |
if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) { |
$hwpaths = glob("/sys/devices/platform/thinkpad_hwmon/", GLOB_NOSORT); |
$hwpaths = CommonFunctions::findglob("/sys/devices/platform/thinkpad_hwmon/", GLOB_NOSORT); |
if (is_array($hwpaths) && (count($hwpaths) == 1)) { |
$hwpaths2 = glob("/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon*/", GLOB_NOSORT); |
$hwpaths2 = CommonFunctions::findglob("/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon*/", GLOB_NOSORT); |
if (is_array($hwpaths2) && (count($hwpaths2) > 0)) { |
$hwpaths = array_merge($hwpaths, $hwpaths2); |
} |