* Mon May 12 2025 Brian Read <brianr@koozali.org> 11.0.0-1.sme
- Adding SM2 panel [SME: 13004] - Upgrade to phpsysinfo 3.4.4 - Add code to delete inline styles and add css to make it look better. - version saved / built uses the static version, which means no drops downs and choices.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
* @package PSI HPUX OS class
|
||||
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
|
||||
* @copyright 2009 phpSysInfo
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
|
||||
* @version SVN: $Id: class.HPUX.inc.php 596 2012-07-05 19:37:48Z namiltd $
|
||||
* @link http://phpsysinfo.sourceforge.net
|
||||
*/
|
||||
@@ -20,12 +20,17 @@
|
||||
* @package PSI HPUX OS class
|
||||
* @author Michael Cramer <BigMichi1@users.sourceforge.net>
|
||||
* @copyright 2009 phpSysInfo
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
|
||||
* @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 HPUX extends OS
|
||||
{
|
||||
/**
|
||||
* uptime command result.
|
||||
*/
|
||||
private $_uptime = null;
|
||||
|
||||
/**
|
||||
* Virtual Host Name
|
||||
*
|
||||
@@ -33,8 +38,8 @@ class HPUX extends OS
|
||||
*/
|
||||
private function _hostname()
|
||||
{
|
||||
if (PSI_USE_VHOST === true) {
|
||||
$this->sys->setHostname(getenv('SERVER_NAME'));
|
||||
if (PSI_USE_VHOST) {
|
||||
if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm);
|
||||
} else {
|
||||
if (CommonFunctions::executeProgram('hostname', '', $ret)) {
|
||||
$this->sys->setHostname($ret);
|
||||
@@ -42,24 +47,6 @@ class HPUX extends OS
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* IP of the Virtual Host Name
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _ip()
|
||||
{
|
||||
if (PSI_USE_VHOST === true) {
|
||||
$this->sys->setIp(gethostbyname($this->sys->getHostname()));
|
||||
} else {
|
||||
if (!($result = getenv('SERVER_ADDR'))) {
|
||||
$this->sys->setIp(gethostbyname($this->sys->getHostname()));
|
||||
} else {
|
||||
$this->sys->setIp($result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* HP-UX Version
|
||||
*
|
||||
@@ -80,8 +67,8 @@ class HPUX extends OS
|
||||
*/
|
||||
private function _uptime()
|
||||
{
|
||||
if (CommonFunctions::executeProgram('uptime', '', $buf)) {
|
||||
if (preg_match("/up (\d+) days,\s*(\d+):(\d+),/", $buf, $ar_buf)) {
|
||||
if (($this->_uptime !== null) || CommonFunctions::executeProgram('uptime', '', $this->_uptime)) {
|
||||
if (preg_match("/up (\d+) days,\s*(\d+):(\d+),/", $this->_uptime, $ar_buf)) {
|
||||
$min = $ar_buf[3];
|
||||
$hours = $ar_buf[2];
|
||||
$days = $ar_buf[1];
|
||||
@@ -90,19 +77,6 @@ class HPUX extends OS
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of Users
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _users()
|
||||
{
|
||||
if (CommonFunctions::executeProgram('who', '-q', $ret)) {
|
||||
$who = preg_split('/=/', $ret, -1, PREG_SPLIT_NO_EMPTY);
|
||||
$this->sys->setUsers($who[1]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Processor Load
|
||||
* optionally create a loadbar
|
||||
@@ -111,8 +85,8 @@ class HPUX extends OS
|
||||
*/
|
||||
private function _loadavg()
|
||||
{
|
||||
if (CommonFunctions::executeProgram('uptime', '', $buf)) {
|
||||
if (preg_match("/average: (.*), (.*), (.*)$/", $buf, $ar_buf)) {
|
||||
if (($this->_uptime !== null) || CommonFunctions::executeProgram('uptime', '', $this->_uptime)) {
|
||||
if (preg_match("/average: (.*), (.*), (.*)$/", $this->_uptime, $ar_buf)) {
|
||||
$this->sys->setLoad($ar_buf[1].' '.$ar_buf[2].' '.$ar_buf[3]);
|
||||
}
|
||||
}
|
||||
@@ -132,31 +106,29 @@ class HPUX extends OS
|
||||
$dev = new CpuDevice();
|
||||
$details = preg_split("/\n/", $processor, -1, PREG_SPLIT_NO_EMPTY);
|
||||
foreach ($details as $detail) {
|
||||
$arrBuff = preg_split('/\s+:\s+/', trim($detail));
|
||||
if (count($arrBuff) == 2) {
|
||||
switch (strtolower($arrBuff[0])) {
|
||||
if (preg_match('/^([^:]+):(.+)$/', trim($detail) , $arrBuff) && (($arrBuff2 = trim($arrBuff[2])) !== '')) {
|
||||
switch (strtolower(trim($arrBuff[1]))) {
|
||||
case 'model name':
|
||||
case 'cpu':
|
||||
$dev->setModel($arrBuff[1]);
|
||||
$dev->setModel($arrBuff2);
|
||||
break;
|
||||
case 'cpu mhz':
|
||||
case 'clock':
|
||||
$dev->setCpuSpeed($arrBuff[1]);
|
||||
$dev->setCpuSpeed($arrBuff2);
|
||||
break;
|
||||
case 'cycle frequency [hz]':
|
||||
$dev->setCpuSpeed($arrBuff[1] / 1000000);
|
||||
$dev->setCpuSpeed($arrBuff2 / 1000000);
|
||||
break;
|
||||
case 'cpu0clktck':
|
||||
$dev->setCpuSpeed(hexdec($arrBuff[1]) / 1000000); // Linux sparc64
|
||||
$dev->setCpuSpeed(hexdec($arrBuff2) / 1000000); // Linux sparc64
|
||||
break;
|
||||
case 'l2 cache':
|
||||
case 'cache size':
|
||||
$dev->setCache(preg_replace("/[a-zA-Z]/", "", $arrBuff[1]) * 1024);
|
||||
$dev->setCache(preg_replace("/[a-zA-Z]/", "", $arrBuff2) * 1024);
|
||||
break;
|
||||
case 'bogomips':
|
||||
case 'cpu0bogo':
|
||||
$dev->setBogomips($arrBuff[1]);
|
||||
break;
|
||||
$dev->setBogomips($arrBuff2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -172,19 +144,25 @@ class HPUX extends OS
|
||||
private function _pci()
|
||||
{
|
||||
if (CommonFunctions::rfts('/proc/pci', $bufr)) {
|
||||
$device = false;
|
||||
$bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
|
||||
foreach ($bufe as $buf) {
|
||||
if (preg_match('/Bus/', $buf)) {
|
||||
if (preg_match('/^\s*Bus\s/', $buf)) {
|
||||
$device = true;
|
||||
continue;
|
||||
}
|
||||
if ($device) {
|
||||
$dev = new HWDevice();
|
||||
$dev->setName(preg_replace('/\([^\)]+\)\.$/', '', trim($buf)));
|
||||
$this->sys->setPciDevices($dev);
|
||||
/*
|
||||
list($key, $value) = preg_split('/: /', $buf, 2);
|
||||
if (!preg_match('/bridge/i', $key) && !preg_match('/USB/i', $key)) {
|
||||
$dev = new HWDevice();
|
||||
$dev->setName(preg_replace('/\([^\)]+\)\.$/', '', trim($value)));
|
||||
$this->sys->setPciDevices($dev);
|
||||
}
|
||||
*/
|
||||
$device = false;
|
||||
}
|
||||
}
|
||||
@@ -203,10 +181,10 @@ class HPUX extends OS
|
||||
if (preg_match('/^hd/', $file)) {
|
||||
$dev = new HWDevice();
|
||||
$dev->setName(trim($file));
|
||||
if (CommonFunctions::rfts("/proc/ide/".$file."/media", $buf, 1)) {
|
||||
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS && CommonFunctions::rfts("/proc/ide/".$file."/media", $buf, 1)) {
|
||||
if (trim($buf) == 'disk') {
|
||||
if (CommonFunctions::rfts("/proc/ide/".$file."/capacity", $buf, 1, 4096, false)) {
|
||||
$dev->setCapacity(trim($buf) * 512 / 1024);
|
||||
$dev->setCapacity(trim($buf) * 512);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -250,9 +228,11 @@ class HPUX extends OS
|
||||
{
|
||||
if (CommonFunctions::rfts('/proc/bus/usb/devices', $bufr, 0, 4096, false)) {
|
||||
$bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
|
||||
$devnum = -1;
|
||||
$results = array();
|
||||
foreach ($bufe as $buf) {
|
||||
if (preg_match('/^T/', $buf)) {
|
||||
$devnum += 1;
|
||||
$devnum++;
|
||||
$results[$devnum] = "";
|
||||
} elseif (preg_match('/^S:/', $buf)) {
|
||||
list($key, $value) = preg_split('/: /', $buf, 2);
|
||||
@@ -344,7 +324,7 @@ class HPUX extends OS
|
||||
$mounts = preg_split("/\n/", $df, -1, PREG_SPLIT_NO_EMPTY);
|
||||
if (CommonFunctions::executeProgram('mount', '-v', $s, PSI_DEBUG)) {
|
||||
$lines = preg_split("/\n/", $s, -1, PREG_SPLIT_NO_EMPTY);
|
||||
while (list(, $line) = each($lines)) {
|
||||
foreach ($lines as $line) {
|
||||
$a = preg_split('/ /', $line, -1, PREG_SPLIT_NO_EMPTY);
|
||||
$fsdev[$a[0]] = $a[4];
|
||||
}
|
||||
@@ -381,24 +361,33 @@ class HPUX extends OS
|
||||
*
|
||||
* @see PSI_Interface_OS::build()
|
||||
*
|
||||
* @return Void
|
||||
* @return void
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$this->_distro();
|
||||
$this->_hostname();
|
||||
$this->_ip();
|
||||
$this->_kernel();
|
||||
$this->_uptime();
|
||||
$this->_users();
|
||||
$this->_loadavg();
|
||||
$this->_cpuinfo();
|
||||
$this->_pci();
|
||||
$this->_ide();
|
||||
$this->_scsi();
|
||||
$this->_usb();
|
||||
$this->_network();
|
||||
$this->_memory();
|
||||
$this->_filesystems();
|
||||
if (!$this->blockname || $this->blockname==='vitals') {
|
||||
$this->_distro();
|
||||
$this->_hostname();
|
||||
$this->_kernel();
|
||||
$this->_uptime();
|
||||
$this->_users();
|
||||
$this->_loadavg();
|
||||
}
|
||||
if (!$this->blockname || $this->blockname==='hardware') {
|
||||
$this->_cpuinfo();
|
||||
$this->_pci();
|
||||
$this->_ide();
|
||||
$this->_scsi();
|
||||
$this->_usb();
|
||||
}
|
||||
if (!$this->blockname || $this->blockname==='memory') {
|
||||
$this->_memory();
|
||||
}
|
||||
if (!$this->blockname || $this->blockname==='filesystem') {
|
||||
$this->_filesystems();
|
||||
}
|
||||
if (!$this->blockname || $this->blockname==='network') {
|
||||
$this->_network();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user