/web/acc/phpsysinfo/includes/mb/class.coretemp.inc.php |
---|
25,17 → 25,19 |
*/ |
public function build() |
{ |
if (PSI_OS == 'Linux') { |
if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) { |
$hwpaths = glob("/sys/devices/platform/coretemp.*/", GLOB_NOSORT); |
if (is_array($hwpaths) && (count($hwpaths) > 0)) { |
$hwpaths = array_merge($hwpaths, glob("/sys/devices/platform/coretemp.*/hwmon/hwmon*/", GLOB_NOSORT)); |
} |
if (is_array($hwpaths) && (($totalh = count($hwpaths)) > 0)) { |
$hwpaths2 = glob("/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]); |
} |
} |
} else { |
} elseif (PSI_OS == 'FreeBSD') { |
$smp = 1; |
CommonFunctions::executeProgram('sysctl', '-n kern.smp.cpus', $smp); |
for ($i = 0; $i < $smp; $i++) { |
/web/acc/phpsysinfo/includes/mb/class.freeipmi.inc.php |
---|
27,14 → 27,14 |
public function __construct() |
{ |
parent::__construct(); |
switch (defined('PSI_SENSOR_FREEIPMI_ACCESS')?strtolower(PSI_SENSOR_FREEIPMI_ACCESS):'command') { |
if ((PSI_OS != 'WINNT') && !defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_FREEIPMI_ACCESS')?strtolower(PSI_SENSOR_FREEIPMI_ACCESS):'command') { |
case 'command': |
CommonFunctions::executeProgram('ipmi-sensors', '--output-sensor-thresholds', $lines); |
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
$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)) { |
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
$this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
} |
break; |
default: |
/web/acc/phpsysinfo/includes/mb/class.hddtemp.inc.php |
---|
24,7 → 24,7 |
private function _temperature() |
{ |
$ar_buf = array(); |
switch (defined('PSI_SENSOR_HDDTEMP_ACCESS')?strtolower(PSI_SENSOR_HDDTEMP_ACCESS):'command') { |
if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_HDDTEMP_ACCESS')?strtolower(PSI_SENSOR_HDDTEMP_ACCESS):'command') { |
case 'tcp': |
$lines = ''; |
// Timo van Roermund: connect to the hddtemp daemon, use a 5 second timeout. |
/web/acc/phpsysinfo/includes/mb/class.healthd.inc.php |
---|
27,7 → 27,7 |
public function __construct() |
{ |
parent::__construct(); |
switch (defined('PSI_SENSOR_HEALTHD_ACCESS')?strtolower(PSI_SENSOR_HEALTHD_ACCESS):'command') { |
if (PSI_OS == 'FreeBSD') switch (defined('PSI_SENSOR_HEALTHD_ACCESS')?strtolower(PSI_SENSOR_HEALTHD_ACCESS):'command') { |
case 'command': |
if (CommonFunctions::executeProgram('healthdc', '-t', $lines)) { |
$lines0 = preg_split("/\n/", $lines, 1, PREG_SPLIT_NO_EMPTY); |
/web/acc/phpsysinfo/includes/mb/class.hwmon.inc.php |
---|
37,6 → 37,13 |
$dev->setName($buf.$name); |
} else { |
$labelname = trim(preg_replace("/_input$/", "", pathinfo($sensor[$i], PATHINFO_BASENAME))); |
if (($name == " (drivetemp)") && (count($buf = CommonFunctions::gdc($hwpath . "device/block", false)))) { |
$labelname = "/dev/" . $buf[0]; |
if (($buf = CommonFunctions::rolv($hwpath . "device/model"))!==null) { |
$labelname .= " (".$buf.")"; |
$name = ""; |
} |
} |
if ($labelname !== "") { |
$dev->setName($labelname.$name); |
} else { |
239,17 → 246,21 |
*/ |
public function build() |
{ |
$hwpaths = glob("/sys/class/hwmon/hwmon*/", GLOB_NOSORT); |
if (is_array($hwpaths) && (count($hwpaths) > 0)) { |
$hwpaths = array_merge($hwpaths, glob("/sys/class/hwmon/hwmon*/device/", GLOB_NOSORT)); |
} |
if (is_array($hwpaths) && (($totalh = count($hwpaths)) > 0)) { |
for ($h = 0; $h < $totalh; $h++) { |
$this->_temperature($hwpaths[$h]); |
$this->_voltage($hwpaths[$h]); |
$this->_fans($hwpaths[$h]); |
$this->_power($hwpaths[$h]); |
$this->_current($hwpaths[$h]); |
if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) { |
$hwpaths = glob("/sys/class/hwmon/hwmon*/", GLOB_NOSORT); |
if (is_array($hwpaths) && (count($hwpaths) > 0)) { |
$hwpaths2 = glob("/sys/class/hwmon/hwmon*/device/", 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]); |
$this->_voltage($hwpaths[$h]); |
$this->_fans($hwpaths[$h]); |
$this->_power($hwpaths[$h]); |
$this->_current($hwpaths[$h]); |
} |
} |
} |
} |
/web/acc/phpsysinfo/includes/mb/class.hwsensors.inc.php |
---|
27,10 → 27,12 |
public function __construct() |
{ |
parent::__construct(); |
$lines = ""; |
// CommonFunctions::executeProgram('sysctl', '-w hw.sensors', $lines); |
CommonFunctions::executeProgram('sysctl', 'hw.sensors', $lines); |
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
if (PSI_OS == 'OpenBSD') { |
$lines = ""; |
// CommonFunctions::executeProgram('sysctl', '-w hw.sensors', $lines); |
CommonFunctions::executeProgram('sysctl', 'hw.sensors', $lines); |
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
} |
} |
/** |
/web/acc/phpsysinfo/includes/mb/class.ipmicfg.inc.php |
---|
0,0 → 1,239 |
<?php |
/** |
* ipmicfg sensor class, getting information from ipmicfg -sdr |
* |
* PHP version 5 |
* |
* @category PHP |
* @package PSI_Sensor |
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net> |
* @copyright 2021 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 IPMIcfg extends Sensors |
{ |
/** |
* content to parse |
* |
* @var array |
*/ |
private $_lines = array(); |
/** |
* fill the private content var through command or data access |
*/ |
public function __construct() |
{ |
parent::__construct(); |
if (!defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_IPMICFG_ACCESS')?strtolower(PSI_SENSOR_IPMICFG_ACCESS):'command') { |
case 'command': |
if (!defined('PSI_SENSOR_IPMICFG_PSFRUINFO') || (strtolower(PSI_SENSOR_IPMICFG_PSFRUINFO)!=="only")) { |
CommonFunctions::executeProgram('ipmicfg', '-sdr', $lines); |
} |
if (defined('PSI_SENSOR_IPMICFG_PSFRUINFO') && (PSI_SENSOR_IPMICFG_PSFRUINFO!==false)) { |
if (CommonFunctions::executeProgram('ipmicfg', '-psfruinfo', $lines2, PSI_DEBUG)) { |
$lines.=$lines2; |
} |
} |
$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)) { |
$this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
} |
break; |
default: |
$this->error->addConfigError('__construct()', '[sensor_ipmicfg] ACCESS'); |
break; |
} |
} |
/** |
* get temperature information |
* |
* @return void |
*/ |
private function _temperature() |
{ |
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)) { |
$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 ($valbuffmin[1]<-128) $valbuffmin[1]+=256; //+256 correction |
} |
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]); |
} |
if ((isset($valbuffmin[1]) && ($valbuff[1]<=$valbuffmin[1])) || (isset($valbuffmax[1]) && ($valbuff[1]>=$valbuffmax[1]))) { //own range test due to errors with +256 correction |
$dev->setEvent("Alarm"); |
} |
$this->mbinfo->setMbTemp($dev); |
} elseif ((defined('PSI_SENSOR_IPMICFG_PSFRUINFO') && (PSI_SENSOR_IPMICFG_PSFRUINFO!==false)) && |
(count($buffer)==2) && preg_match("/^\s*([-\d]+)C\/[-\d]+F\s*$/", $buffer[1], $valbuff)) { |
$dev = new SensorDevice(); |
$dev->setName(trim($buffer[0])." (psfruinfo)"); |
$dev->setValue($valbuff[1]); |
$this->mbinfo->setMBTemp($dev); |
} |
} |
} |
/** |
* get voltage information |
* |
* @return void |
*/ |
private function _voltage() |
{ |
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)) { |
$dev = new SensorDevice(); |
$dev->setName($namebuff[1]); |
$dev->setValue($valbuff[1]); |
if (preg_match("/^\s*([\d\.].+)\sV\s*$/",$buffer[3], $valbuffmin)) { |
$dev->setMin($valbuffmin[1]); |
} |
if (preg_match("/^\s*([\d\.].+)\sV\s*$/",$buffer[4], $valbuffmax)) { |
$dev->setMax($valbuffmax[1]); |
} |
if (trim($buffer[0]) != "OK") $dev->setEvent(trim($buffer[0])); |
$this->mbinfo->setMbVolt($dev); |
} |
} |
} |
/** |
* get fan information |
* |
* @return void |
*/ |
private function _fans() |
{ |
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)) { |
$dev = new SensorDevice(); |
$dev->setName($namebuff[1]); |
$dev->setValue($valbuff[1]); |
if (preg_match("/^\s*(\d+)\sRPM\s*$/",$buffer[3], $valbuffmin)) { |
$dev->setMin($valbuffmin[1]); |
} |
if ((trim($buffer[0]) != "OK") && isset($valbuffmin[1])) { |
$dev->setEvent(trim($buffer[0])); |
} |
$this->mbinfo->setMbFan($dev); |
} elseif ((defined('PSI_SENSOR_IPMICFG_PSFRUINFO') && (PSI_SENSOR_IPMICFG_PSFRUINFO!==false)) && |
(count($buffer)==2) && preg_match("/^\s*(\d+)\sRPM\s*$/", $buffer[1], $valbuff)) { |
$dev = new SensorDevice(); |
$dev->setName(trim($buffer[0])." (psfruinfo)"); |
$dev->setValue($valbuff[1]); |
$this->mbinfo->setMBFan($dev); |
} |
} |
} |
/** |
* get power information |
* |
* @return void |
*/ |
private function _power() |
{ |
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)) { |
$dev = new SensorDevice(); |
$dev->setName($namebuff[1]); |
$dev->setValue($valbuff[1]); |
if (preg_match("/^\s*(\d+)\sWatts\s*$/",$buffer[4], $valbuffmax)) { |
$dev->setMax($valbuffmax[1]); |
} |
if (trim($buffer[0]) != "OK") $dev->setEvent(trim($buffer[0])); |
$this->mbinfo->setMbPower($dev); |
} |
} |
} |
/** |
* get current information |
* |
* @return void |
*/ |
private function _current() |
{ |
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)) { |
$dev = new SensorDevice(); |
$dev->setName($namebuff[1]); |
$dev->setValue($valbuff[1]); |
if (preg_match("/^\s*([\d\.].+)\sAmps\s*$/",$buffer[3], $valbuffmin)) { |
$dev->setMin($valbuffmin[1]); |
} |
if (preg_match("/^\s*([\d\.].+)\sAmps\s*$/",$buffer[4], $valbuffmax)) { |
$dev->setMax($valbuffmax[1]); |
} |
if (trim($buffer[0]) != "OK") $dev->setEvent(trim($buffer[0])); |
$this->mbinfo->setMbCurrent($dev); |
} |
} |
} |
/** |
* get other information |
* |
* @return void |
*/ |
private function _other() |
{ |
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)==4) && preg_match("/^\s*\(\d+\)\s(.*)\s*$/", $buffer[1], $namebuff) && |
($buffer[2]!=="Correctable ECC / other correctable memory error") && |
($buffer[2]!=="N/A")) { |
$dev = new SensorDevice(); |
$dev->setName($namebuff[1]); |
$dev->setValue($buffer[2]); |
if (trim($buffer[0]) != "OK") $dev->setEvent(trim($buffer[0])); |
$this->mbinfo->setMbOther($dev); |
} elseif ((defined('PSI_SENSOR_IPMICFG_PSFRUINFO') && (PSI_SENSOR_IPMICFG_PSFRUINFO!==false)) && |
(count($buffer)==2) && (trim($buffer[0])=="Status")) { |
$dev = new SensorDevice(); |
$dev->setName(trim($buffer[0])." (psfruinfo)"); |
$dev->setValue($buffer[1]); |
$this->mbinfo->setMbOther($dev); |
} |
} |
} |
/** |
* get the information |
* |
* @see PSI_Interface_Sensor::build() |
* |
* @return Void |
*/ |
public function build() |
{ |
$this->_temperature(); |
$this->_voltage(); |
$this->_fans(); |
$this->_power(); |
$this->_current(); |
$this->_other(); |
} |
} |
/web/acc/phpsysinfo/includes/mb/class.ipmitool.inc.php |
---|
28,7 → 28,7 |
{ |
parent::__construct(); |
$lines = ""; |
switch (defined('PSI_SENSOR_IPMITOOL_ACCESS')?strtolower(PSI_SENSOR_IPMITOOL_ACCESS):'command') { |
if (!defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_IPMITOOL_ACCESS')?strtolower(PSI_SENSOR_IPMITOOL_ACCESS):'command') { |
case 'command': |
CommonFunctions::executeProgram('ipmitool', 'sensor -v', $lines); |
break; |
/web/acc/phpsysinfo/includes/mb/class.ipmiutil.inc.php |
---|
27,7 → 27,7 |
public function __construct() |
{ |
parent::__construct(); |
switch (defined('PSI_SENSOR_IPMIUTIL_ACCESS')?strtolower(PSI_SENSOR_IPMIUTIL_ACCESS):'command') { |
if (!defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_IPMIUTIL_ACCESS')?strtolower(PSI_SENSOR_IPMIUTIL_ACCESS):'command') { |
case 'command': |
CommonFunctions::executeProgram('ipmiutil', 'sensor -stw', $lines); |
$this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
/web/acc/phpsysinfo/includes/mb/class.k8temp.inc.php |
---|
27,7 → 27,7 |
public function __construct() |
{ |
parent::__construct(); |
switch (defined('PSI_SENSOR_K8TEMP_ACCESS')?strtolower(PSI_SENSOR_K8TEMP_ACCESS):'command') { |
if ((PSI_OS != 'WINNT') && !defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_K8TEMP_ACCESS')?strtolower(PSI_SENSOR_K8TEMP_ACCESS):'command') { |
case 'command': |
$lines = ""; |
CommonFunctions::executeProgram('k8temp', '', $lines); |
/web/acc/phpsysinfo/includes/mb/class.lmsensors.inc.php |
---|
28,7 → 28,7 |
{ |
parent::__construct(); |
$lines = ""; |
switch (defined('PSI_SENSOR_LMSENSORS_ACCESS')?strtolower(PSI_SENSOR_LMSENSORS_ACCESS):'command') { |
if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_LMSENSORS_ACCESS')?strtolower(PSI_SENSOR_LMSENSORS_ACCESS):'command') { |
case 'command': |
CommonFunctions::executeProgram("sensors", "", $lines); |
break; |
/web/acc/phpsysinfo/includes/mb/class.mbm5.inc.php |
---|
34,14 → 34,16 |
public function __construct() |
{ |
parent::__construct(); |
$delim = "/;/"; |
CommonFunctions::rfts(PSI_APP_ROOT."/data/MBM5.csv", $buffer); |
if (strpos($buffer, ";") === false) { |
$delim = "/,/"; |
if ((PSI_OS == 'WINNT') && !defined('PSI_EMU_HOSTNAME')) { |
$delim = "/;/"; |
CommonFunctions::rfts(PSI_APP_ROOT."/data/MBM5.csv", $buffer); |
if (strpos($buffer, ";") === false) { |
$delim = "/,/"; |
} |
$buffer = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY); |
$this->_buf_label = preg_split($delim, substr($buffer[0], 0, -2), -1, PREG_SPLIT_NO_EMPTY); |
$this->_buf_value = preg_split($delim, substr($buffer[1], 0, -2), -1, PREG_SPLIT_NO_EMPTY); |
} |
$buffer = preg_split("/\n/", $buffer, -1, PREG_SPLIT_NO_EMPTY); |
$this->_buf_label = preg_split($delim, substr($buffer[0], 0, -2), -1, PREG_SPLIT_NO_EMPTY); |
$this->_buf_value = preg_split($delim, substr($buffer[1], 0, -2), -1, PREG_SPLIT_NO_EMPTY); |
} |
/** |
/web/acc/phpsysinfo/includes/mb/class.mbmon.inc.php |
---|
27,7 → 27,7 |
public function __construct() |
{ |
parent::__construct(); |
switch (defined('PSI_SENSOR_MBMON_ACCESS')?strtolower(PSI_SENSOR_MBMON_ACCESS):'command') { |
if ((PSI_OS != 'WINNT') && !defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_MBMON_ACCESS')?strtolower(PSI_SENSOR_MBMON_ACCESS):'command') { |
case 'tcp': |
$fp = fsockopen("localhost", 411, $errno, $errstr, 5); |
if ($fp) { |
/web/acc/phpsysinfo/includes/mb/class.nvidiasmi.inc.php |
---|
0,0 → 1,138 |
<?php |
/** |
* nvidiasmi sensor class, getting hardware temperature information and fan speed from nvidia-smi utility |
* |
* PHP version 5 |
* |
* @category PHP |
* @package PSI_Sensor |
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net> |
* @copyright 2020 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 NvidiaSMI extends Sensors |
{ |
/** |
* content to parse |
* |
* @var array |
*/ |
private $_gpus = array(); |
/** |
* fill the private array |
*/ |
public function __construct() |
{ |
parent::__construct(); |
if (!defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_NVIDIASMI_ACCESS')?strtolower(PSI_SENSOR_NVIDIASMI_ACCESS):'command') { |
case 'command': |
if (PSI_OS == 'WINNT') { |
$winnt_exe = (defined('PSI_SENSOR_NVIDIASMI_EXE_PATH') && is_string(PSI_SENSOR_NVIDIASMI_EXE_PATH))?strtolower(PSI_SENSOR_NVIDIASMI_EXE_PATH):"c:\\Program Files\\NVIDIA Corporation\\NVSMI\\nvidia-smi.exe"; |
if (($_exe=realpath(trim($winnt_exe))) && preg_match("/^([a-zA-Z]:\\\\[^\\\\]+)/", $_exe, $out)) { |
CommonFunctions::executeProgram('cmd', "/c set ProgramFiles=".$out[1]."^&\"".$_exe."\" -q", $lines); |
} else { |
$this->error->addConfigError('__construct()', '[sensor_nvidiasmi] EXE_PATH="'.$winnt_exe.'"'); |
} |
} else { |
CommonFunctions::executeProgram('nvidia-smi', '-q', $lines); |
} |
$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)) { |
$this->_gpus = preg_split("/^(?=GPU )/m", $lines, -1, PREG_SPLIT_NO_EMPTY); |
} |
break; |
default: |
$this->error->addConfigError('__construct()', '[sensor_nvidiasmi] ACCESS'); |
break; |
} |
} |
/** |
* get the information |
* |
* @see PSI_Interface_Sensor::build() |
* |
* @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); |
} |
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); |
} |
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); |
} |
} |
break; |
} |
} |
} |
/web/acc/phpsysinfo/includes/mb/class.ohm.inc.php |
---|
27,19 → 27,14 |
public function __construct() |
{ |
parent::__construct(); |
$_wmi = null; |
try { |
// initialize the wmi object |
$objLocator = new COM('WbemScripting.SWbemLocator'); |
$_wmi = $objLocator->ConnectServer('', 'root\OpenHardwareMonitor'); |
} catch (Exception $e) { |
$this->error->addError("WMI connect error", "PhpSysInfo can not connect to the WMI interface for OpenHardwareMonitor data."); |
} |
if ($_wmi) { |
$tmpbuf = CommonFunctions::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']; |
if ((PSI_OS == 'WINNT') || defined('PSI_EMU_HOSTNAME')) { |
$_wmi = CommonFunctions::initWMI('root\OpenHardwareMonitor', true); |
if ($_wmi) { |
$tmpbuf = CommonFunctions::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']; |
} |
} |
} |
} |
/web/acc/phpsysinfo/includes/mb/class.pitemp.inc.php |
---|
57,8 → 57,10 |
public function build() |
{ |
$this->_temperature(); |
$this->_voltage(); |
$this->_current(); |
if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) { |
$this->_temperature(); |
$this->_voltage(); |
$this->_current(); |
} |
} |
} |
/web/acc/phpsysinfo/includes/mb/class.qtssnmp.inc.php |
---|
75,7 → 75,9 |
*/ |
public function build() |
{ |
$this->_temperature(); |
$this->_fans(); |
if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) { |
$this->_temperature(); |
$this->_fans(); |
} |
} |
} |
/web/acc/phpsysinfo/includes/mb/class.speedfan.inc.php |
---|
23,7 → 23,7 |
public function __construct() |
{ |
parent::__construct(); |
switch (defined('PSI_SENSOR_SPEEDFAN_ACCESS')?strtolower(PSI_SENSOR_SPEEDFAN_ACCESS):'command') { |
if ((PSI_OS == 'WINNT') && !defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_SPEEDFAN_ACCESS')?strtolower(PSI_SENSOR_SPEEDFAN_ACCESS):'command') { |
case 'command': |
if (CommonFunctions::executeProgram("SpeedFanGet.exe", "", $buffer, PSI_DEBUG) && (strlen($buffer) > 0)) { |
if (preg_match("/^Temperatures:\s+(.+)$/m", $buffer, $out)) { |
/web/acc/phpsysinfo/includes/mb/class.thermalzone.inc.php |
---|
27,18 → 27,34 |
public function __construct() |
{ |
parent::__construct(); |
if (PSI_OS == 'WINNT') { |
$_wmi = null; |
try { |
// initialize the wmi object |
$objLocator = new COM('WbemScripting.SWbemLocator'); |
$_wmi = $objLocator->ConnectServer('', 'root\WMI'); |
} catch (Exception $e) { |
$this->error->addError("WMI connect error", "PhpSysInfo can not connect to the WMI interface for ThermalZone data."); |
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 ($_wmi) { |
$this->_buf = CommonFunctions::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)"); |
} |
} |
if ($_wmi) { |
$this->_buf = CommonFunctions::getWMI($_wmi, 'MSAcpi_ThermalZoneTemperature', array('InstanceName', 'CriticalTripPoint', 'CurrentTemperature')); |
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" |
$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++) { |
$values = preg_split("/\s+/", trim($lines[$i]), -1, PREG_SPLIT_NO_EMPTY); |
if (count($values)==3) { |
$this->_buf[] = array('CriticalTripPoint'=>trim($values[0]), 'CurrentTemperature'=>trim($values[1]), 'InstanceName'=>trim($values[2])); |
} |
} |
} |
break; |
default: |
$this->error->addConfigError('__construct()', '[sensor_thermalzone] ACCESS'); |
break; |
} |
} |
49,7 → 65,9 |
*/ |
private function _temperature() |
{ |
if (PSI_OS == 'WINNT') { |
$mode = defined('PSI_SENSOR_THERMALZONE_ACCESS')?strtolower(PSI_SENSOR_THERMALZONE_ACCESS):'command'; |
if ((($mode == 'command') && ((PSI_OS == 'WINNT') || defined('PSI_EMU_HOSTNAME'))) |
|| (($mode == 'data') && !defined('PSI_EMU_HOSTNAME'))) { |
if ($this->_buf) foreach ($this->_buf as $buffer) { |
if (isset($buffer['CurrentTemperature']) && (($value = ($buffer['CurrentTemperature'] - 2732)/10) > -100)) { |
$dev = new SensorDevice(); |
65,7 → 83,7 |
$this->mbinfo->setMbTemp($dev); |
} |
} |
} else { |
} elseif (($mode == 'command') && (PSI_OS != 'WINNT') && !defined('PSI_EMU_HOSTNAME')) { |
$notwas = true; |
$thermalzones = glob('/sys/class/thermal/thermal_zone*/'); |
if (is_array($thermalzones) && (count($thermalzones) > 0)) foreach ($thermalzones as $thermalzone) { |
/web/acc/phpsysinfo/includes/mb/class.thinkpad.inc.php |
---|
23,11 → 23,18 |
*/ |
public function build() |
{ |
if (PSI_OS == 'Linux') { |
if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) { |
$hwpaths = glob("/sys/devices/platform/thinkpad_hwmon/", GLOB_NOSORT); |
if (is_array($hwpaths) && (count($hwpaths) == 1)) { |
$this->_temperature($hwpaths[0]); |
$this->_fans($hwpaths[0]); |
$hwpaths2 = glob("/sys/devices/platform/thinkpad_hwmon/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]); |
$this->_fans($hwpaths[$h]); |
} |
} |
} |
} |