/**
  * fill the private content var
  */
 public function __construct()
 {
     parent::__construct();
     if (PSI_OS == 'WINNT') {
         $_wmi = null;
         // don't set this params for local connection, it will not work
         $strHostname = '';
         $strUser = '';
         $strPassword = '';
         try {
             // initialize the wmi object
             $objLocator = new COM('WbemScripting.SWbemLocator');
             if ($strHostname == "") {
                 $_wmi = $objLocator->ConnectServer($strHostname, 'root\\WMI');
             } else {
                 $_wmi = $objLocator->ConnectServer($strHostname, 'root\\WMI', $strHostname . '\\' . $strUser, $strPassword);
             }
         } 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'));
         }
     }
 }
 /**
  * fill the private content var through tcp or file access
  */
 public function __construct()
 {
     parent::__construct();
     switch (strtolower(PSI_SENSOR_ACCESS)) {
         case 'tcp':
             $fp = fsockopen("localhost", 411, $errno, $errstr, 5);
             if ($fp) {
                 $lines = "";
                 while (!feof($fp)) {
                     $lines .= fread($fp, 1024);
                 }
                 $this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
             } else {
                 $this->error->addError("fsockopen()", $errno . " " . $errstr);
             }
             break;
         case 'command':
             CommonFunctions::executeProgram('mbmon', '-c 1 -r', $lines, PSI_DEBUG);
             $this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
             break;
         default:
             $this->error->addConfigError('__construct()', 'PSI_SENSOR_ACCESS');
             break;
     }
 }
 /**
  * fill the private content var through command or data access
  */
 public function __construct()
 {
     parent::__construct();
     switch (defined('PSI_SENSOR_LMSENSORS_ACCESS') ? strtolower(PSI_SENSOR_LMSENSORS_ACCESS) : 'command') {
         case 'command':
             if (CommonFunctions::executeProgram("sensors", "", $lines)) {
                 // Martijn Stolk: Dirty fix for misinterpreted output of sensors,
                 // where info could come on next line when the label is too long.
                 $lines = str_replace(":\n", ":", $lines);
                 $lines = str_replace("\n\n", "\n", $lines);
                 $this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
             }
             break;
         case 'data':
             if (CommonFunctions::rfts(APP_ROOT . '/data/lmsensors.txt', $lines)) {
                 $lines = str_replace(":\n", ":", $lines);
                 $lines = str_replace("\n\n", "\n", $lines);
                 $this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
             }
             break;
         default:
             $this->error->addConfigError('__construct()', 'PSI_SENSOR_LMSENSORS_ACCESS');
             break;
     }
 }
 public function __construct()
 {
     parent::__construct();
     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)) {
                     $this->_filecontent["temp"] = $out[1];
                 }
                 if (preg_match("/^Fans:\\s+(.+)\$/m", $buffer, $out)) {
                     $this->_filecontent["fans"] = $out[1];
                 }
                 if (preg_match("/^Voltages:\\s+(.+)\$/m", $buffer, $out)) {
                     $this->_filecontent["volt"] = $out[1];
                 }
             }
             break;
         case 'data':
             if (CommonFunctions::rfts(APP_ROOT . '/data/speedfan.txt', $buffer) && strlen($buffer) > 0) {
                 if (preg_match("/^Temperatures:\\s+(.+)\$/m", $buffer, $out)) {
                     $this->_filecontent["temp"] = $out[1];
                 }
                 if (preg_match("/^Fans:\\s+(.+)\$/m", $buffer, $out)) {
                     $this->_filecontent["fans"] = $out[1];
                 }
                 if (preg_match("/^Voltages:\\s+(.+)\$/m", $buffer, $out)) {
                     $this->_filecontent["volt"] = $out[1];
                 }
             }
             break;
         default:
             $this->error->addConfigError('__construct()', 'PSI_SENSOR_SPEEDFAN_ACCESS');
             break;
     }
 }
 /**
  * fill the private content var through command
  */
 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);
 }
 /**
  * read the MBM5.csv file and fill the private arrays
  */
 public function __construct()
 {
     parent::__construct();
     $delim = "/;/";
     CommonFunctions::rfts(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);
 }
Beispiel #7
0
 /**
  * fill the private array
  */
 function __construct()
 {
     parent::__construct();
     switch (strtolower(PSI_SENSOR_ACCESS)) {
         case 'command':
             $lines = "";
             CommonFunctions::executeProgram('k8temp', '', $lines);
             $this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
             break;
         default:
             $this->error->addConfigError('__construct()', 'PSI_SENSOR_ACCESS');
             break;
     }
 }
 /**
  * fill the private content var
  */
 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) {
         $this->_buf = CommonFunctions::getWMI($_wmi, 'Sensor', array('Parent', 'Name', 'SensorType', 'Value'));
     }
 }
 /**
  * fill the private content var
  */
 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.");
         }
         if ($_wmi) {
             $this->_buf = CommonFunctions::getWMI($_wmi, 'MSAcpi_ThermalZoneTemperature', array('InstanceName', 'CriticalTripPoint', 'CurrentTemperature'));
         }
     }
 }
 /**
  * fill the private content var through tcp or file access
  */
 public function __construct()
 {
     parent::__construct();
     switch (strtolower(PSI_SENSOR_ACCESS)) {
         case 'command':
             CommonFunctions::executeProgram('ipmiutil', 'sensor -stw', $lines);
             $this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
             break;
         case 'file':
             if (CommonFunctions::rfts(APP_ROOT . '/data/ipmiutil.txt', $lines)) {
                 $this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
             }
             break;
         default:
             $this->error->addConfigError('__construct()', 'PSI_SENSOR_ACCESS');
             break;
     }
 }
 /**
  * fill the private content var through command or data access
  */
 public function __construct()
 {
     parent::__construct();
     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);
             break;
         case 'data':
             if (CommonFunctions::rfts(APP_ROOT . '/data/freeipmi.txt', $lines)) {
                 $this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
             }
             break;
         default:
             $this->error->addConfigError('__construct()', 'PSI_SENSOR_FREEIPMI_ACCESS');
             break;
     }
 }
Beispiel #12
0
 /**
  * read the MBM5.csv file and fill the private arrays
  */
 public function __construct()
 {
     parent::__construct();
     switch (strtolower(PSI_SENSOR_ACCESS)) {
         case 'file':
             $delim = "/;/";
             CommonFunctions::rfts(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);
             break;
         default:
             $this->error->addConfigError('__construct()', 'PSI_SENSOR_ACCESS');
             break;
     }
 }
 /**
  * fill the private array
  */
 public function __construct()
 {
     parent::__construct();
     switch (defined('PSI_SENSOR_K8TEMP_ACCESS') ? strtolower(PSI_SENSOR_K8TEMP_ACCESS) : 'command') {
         case 'command':
             $lines = "";
             CommonFunctions::executeProgram('k8temp', '', $lines);
             $this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
             break;
         case 'data':
             if (CommonFunctions::rfts(APP_ROOT . '/data/k8temp.txt', $lines)) {
                 $this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
             }
             break;
         default:
             $this->error->addConfigError('__construct()', 'PSI_SENSOR_K8TEMP_ACCESS');
             break;
     }
 }
Beispiel #14
0
 /**
  * fill the private content var
  */
 public function __construct()
 {
     parent::__construct();
     // don't set this params for local connection, it will not work
     $strHostname = '';
     $strUser = '';
     $strPassword = '';
     try {
         // initialize the wmi object
         $objLocator = new COM('WbemScripting.SWbemLocator');
         if ($strHostname == "") {
             $this->_wmi = $objLocator->ConnectServer($strHostname, 'root\\OpenHardwareMonitor');
         } else {
             $this->_wmi = $objLocator->ConnectServer($strHostname, 'root\\OpenHardwareMonitor', $strHostname . '\\' . $strUser, $strPassword);
         }
     } catch (Exception $e) {
         $this->error->addError("WMI connect error", "PhpSysInfo can not connect to the WMI interface for security reasons.\nCheck an authentication mechanism for the directory where phpSysInfo is installed.");
     }
     $this->_buf = CommonFunctions::getWMI($this->_wmi, 'Sensor', array('Parent', 'Name', 'SensorType', 'Value'));
 }
Beispiel #15
0
 /**
  * fill the private content var
  */
 public function __construct()
 {
     parent::__construct();
     $_wmi = null;
     // don't set this params for local connection, it will not work
     $strHostname = '';
     $strUser = '';
     $strPassword = '';
     try {
         // initialize the wmi object
         $objLocator = new COM('WbemScripting.SWbemLocator');
         if ($strHostname == "") {
             $_wmi = $objLocator->ConnectServer($strHostname, 'root\\OpenHardwareMonitor');
         } else {
             $_wmi = $objLocator->ConnectServer($strHostname, 'root\\OpenHardwareMonitor', $strHostname . '\\' . $strUser, $strPassword);
         }
     } catch (Exception $e) {
         $this->error->addError("WMI connect error", "PhpSysInfo can not connect to the WMI interface for OpenHardwareMonitor data.");
     }
     if ($_wmi) {
         $this->_buf = CommonFunctions::getWMI($_wmi, 'Sensor', array('Parent', 'Name', 'SensorType', 'Value'));
     }
 }