Subversion Repositories ALCASAR

Compare Revisions

Regard whitespace Rev 2976 → Rev 2770

/web/acc/phpsysinfo/includes/mb/class.nvidiasmi.inc.php
File deleted
/web/acc/phpsysinfo/includes/mb/class.ipmicfg.inc.php
File deleted
/web/acc/phpsysinfo/includes/mb/class.coretemp.inc.php
25,19 → 25,17
*/
public function build()
{
if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) {
if (PSI_OS == 'Linux') {
$hwpaths = glob("/sys/devices/platform/coretemp.*/", GLOB_NOSORT);
if (is_array($hwpaths) && (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);
$hwpaths = array_merge($hwpaths, glob("/sys/devices/platform/coretemp.*/hwmon/hwmon*/", GLOB_NOSORT));
}
$totalh = count($hwpaths);
if (is_array($hwpaths) && (($totalh = count($hwpaths)) > 0)) {
for ($h = 0; $h < $totalh; $h++) {
$this->_temperature($hwpaths[$h]);
}
}
} elseif (PSI_OS == 'FreeBSD') {
} else {
$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();
if ((PSI_OS != 'WINNT') && !defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_FREEIPMI_ACCESS')?strtolower(PSI_SENSOR_FREEIPMI_ACCESS):'command') {
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("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
break;
case 'data':
if (CommonFunctions::rfts(PSI_APP_ROOT.'/data/freeipmi.txt', $lines)) {
$this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
$this->_lines = preg_split("/\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();
if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_HDDTEMP_ACCESS')?strtolower(PSI_SENSOR_HDDTEMP_ACCESS):'command') {
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();
if (PSI_OS == 'FreeBSD') switch (defined('PSI_SENSOR_HEALTHD_ACCESS')?strtolower(PSI_SENSOR_HEALTHD_ACCESS):'command') {
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,13 → 37,6
$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 {
246,14 → 239,11
*/
public function build()
{
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);
$hwpaths = array_merge($hwpaths, glob("/sys/class/hwmon/hwmon*/device/", GLOB_NOSORT));
}
$totalh = count($hwpaths);
if (is_array($hwpaths) && (($totalh = count($hwpaths)) > 0)) {
for ($h = 0; $h < $totalh; $h++) {
$this->_temperature($hwpaths[$h]);
$this->_voltage($hwpaths[$h]);
264,4 → 254,3
}
}
}
}
/web/acc/phpsysinfo/includes/mb/class.hwsensors.inc.php
27,13 → 27,11
public function __construct()
{
parent::__construct();
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);
}
}
 
/**
* get temperature information
/web/acc/phpsysinfo/includes/mb/class.ipmitool.inc.php
28,7 → 28,7
{
parent::__construct();
$lines = "";
if (!defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_IPMITOOL_ACCESS')?strtolower(PSI_SENSOR_IPMITOOL_ACCESS):'command') {
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();
if (!defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_IPMIUTIL_ACCESS')?strtolower(PSI_SENSOR_IPMIUTIL_ACCESS):'command') {
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();
if ((PSI_OS != 'WINNT') && !defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_K8TEMP_ACCESS')?strtolower(PSI_SENSOR_K8TEMP_ACCESS):'command') {
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 = "";
if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_LMSENSORS_ACCESS')?strtolower(PSI_SENSOR_LMSENSORS_ACCESS):'command') {
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,7 → 34,6
public function __construct()
{
parent::__construct();
if ((PSI_OS == 'WINNT') && !defined('PSI_EMU_HOSTNAME')) {
$delim = "/;/";
CommonFunctions::rfts(PSI_APP_ROOT."/data/MBM5.csv", $buffer);
if (strpos($buffer, ";") === false) {
44,7 → 43,6
$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);
}
}
 
/**
* get temperature information
/web/acc/phpsysinfo/includes/mb/class.mbmon.inc.php
27,7 → 27,7
public function __construct()
{
parent::__construct();
if ((PSI_OS != 'WINNT') && !defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_MBMON_ACCESS')?strtolower(PSI_SENSOR_MBMON_ACCESS):'command') {
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.ohm.inc.php
27,8 → 27,14
public function __construct()
{
parent::__construct();
if ((PSI_OS == 'WINNT') || defined('PSI_EMU_HOSTNAME')) {
$_wmi = CommonFunctions::initWMI('root\OpenHardwareMonitor', true);
$_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) {
38,7 → 44,6
}
}
}
}
 
/**
* get temperature information
/web/acc/phpsysinfo/includes/mb/class.pitemp.inc.php
57,10 → 57,8
 
public function build()
{
if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) {
$this->_temperature();
$this->_voltage();
$this->_current();
}
}
}
/web/acc/phpsysinfo/includes/mb/class.qtssnmp.inc.php
75,9 → 75,7
*/
public function build()
{
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();
if ((PSI_OS == 'WINNT') && !defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_SPEEDFAN_ACCESS')?strtolower(PSI_SENSOR_SPEEDFAN_ACCESS):'command') {
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,36 → 27,20
public function __construct()
{
parent::__construct();
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 (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.");
}
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)");
}
}
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;
}
}
 
/**
* get temperature information
65,9 → 49,7
*/
private function _temperature()
{
$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 (PSI_OS == 'WINNT') {
if ($this->_buf) foreach ($this->_buf as $buffer) {
if (isset($buffer['CurrentTemperature']) && (($value = ($buffer['CurrentTemperature'] - 2732)/10) > -100)) {
$dev = new SensorDevice();
83,7 → 65,7
$this->mbinfo->setMbTemp($dev);
}
}
} elseif (($mode == 'command') && (PSI_OS != 'WINNT') && !defined('PSI_EMU_HOSTNAME')) {
} else {
$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,19 → 23,12
*/
public function build()
{
if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) {
if (PSI_OS == 'Linux') {
$hwpaths = glob("/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);
if (is_array($hwpaths2) && (count($hwpaths2) > 0)) {
$hwpaths = array_merge($hwpaths, $hwpaths2);
$this->_temperature($hwpaths[0]);
$this->_fans($hwpaths[0]);
}
$totalh = count($hwpaths);
for ($h = 0; $h < $totalh; $h++) {
$this->_temperature($hwpaths[$h]);
$this->_fans($hwpaths[$h]);
}
}
}
}
}