/web/acc/phpsysinfo/CHANGELOG.md |
---|
3,6 → 3,15 |
http://phpsysinfo.sourceforge.net/ |
phpSysInfo 3.4.2 |
---------------- |
- [ADD] RebornOS, Parrot OS, Pop!_OS, Nitrux, Makulu, Absolute, Bluestar, Ultramarine Linux and TrueNAS to detected distros |
- [ADD] schabau_bootstrap template |
- [ADD] Raid plugin - storcli and perccli status |
- [NEW] Partial support for GNU Hurd |
- [NEW] Ability to retrieve Linux, GNU Hurd, DrayOS and FortiOS system information via SSH |
phpSysInfo 3.4.1 |
---------------- |
- [ADD] Linuxfx, EndeavourOS, Garuda, Arco and Artix Linux to detected distros |
330,8 → 339,9 |
- [ADD] Generations Linux and SliTaz to detected distros |
- [ADD] IPMI and LMSensors currents information |
- [ADD] Plugin IPMIInfo - added powers and currents values |
- [ADD] Partial support of QNX |
- [NEW] Partial support of QNX |
- [FIX] Reduce execution time on Linux systems when showing load average PR#47 |
phpSysInfo 3.1.10 |
/web/acc/phpsysinfo/README.md |
---|
2,7 → 2,7 |
============== |
* Copyright (c), 1999-2008, Uriah Welcome ([sf.net/users/precision](https://sf.net/users/precision)) |
* Copyright (c), 1999-2009, Michael Cramer ([sf.net/users/bigmichi1](https://sf.net/users/bigmichi1)) |
* Copyright (c), 1999-2009, Michael Cramer ([github.com/bigmichi1](https://github.com/bigmichi1), [sf.net/users/bigmichi1](https://sf.net/users/bigmichi1)) |
* Copyright (c), 2007-2008, Audun Larsen ([sf.net/users/xqus](https://sf.net/users/xqus)) |
* Copyright (c), 2007-2015, Erkan Valentin ([github.com/rk4an](https://github.com/rk4an), [sf.net/users/jacky672](https://sf.net/users/jacky672)) |
* Copyright (c), 2009-2022, Mieczyslaw Nalewaj ([github.com/namiltd](https://github.com/namiltd), [sf.net/users/namiltd](https://sf.net/users/namiltd)) |
29,7 → 29,7 |
- NetBSD |
- DragonFly |
- HP-UX |
- Darwin / Mac OS / OS X |
- Darwin / Mac OS / OS X / iOS |
- Windows 2000 / XP / 2003 / Vista / 2008 / 7 / 2011 / 2012 / 8 / 8.1 / 10 / 10 IoT / 2016 / 2019 / 2022 / 11 |
- Android |
40,6 → 40,9 |
- ReactOS |
- IBM AIX |
- QNX |
- GNU Hurd |
- FortiOS (via SSH) |
- DrayOS (via SSH) |
If your platform is not here try checking out the mailing list archives or |
the message boards on SourceForge. |
/web/acc/phpsysinfo/data/ModelTranslation.txt |
---|
36,6 → 36,9 |
iMac21,1:MacBook Air M1:Apple M1 |
iMac21,2:MacBook Air M1:Apple M1 |
M43ADP1,1:Development Mac Pro:Intel Xeon X5340 |
Mac13,1:Mac Studio M1 Max:Apple M1 Max |
Mac13,2:Mac Studio M1 Ultra:Apple M1 Ultra |
Mac14,2:MacBook Air M2:Apple M2 |
MacBook1,1:MacBook Core Duo:Intel Core Duo T2400/T2500 |
MacBook2,1:MacBook Core 2 Duo:Intel Core 2 Duo T5600/T7200/T7400 |
MacBook3,1:MacBook Core 2 Duo:Intel Core 2 Duo T7300/T7500 |
/web/acc/phpsysinfo/data/distros.ini |
---|
114,9 → 114,9 |
Image = "NixOS.png" |
;detected in "/etc/os-release" |
[FreeEOS] |
Image = "free-eos.png" |
Files = "/etc/eos-version" |
[Free-EOS] |
Image = "FreeEOS.png" |
Files = "/etc/eos-release;/etc/eos-version" |
[NuTyX] |
Image = "NuTyX.png" |
139,10 → 139,27 |
[Artix Linux] |
Image = "Artix.png" |
Mode = "Detection" |
Files = "/etc/artix-release" |
Mode = "Detection" |
;detected in "/etc/os-release" |
[RebornOS] |
Image = "RebornOS.png" |
;detected in "lsb_release -a" |
;detected in "/etc/lsb-release" |
;wrong in "/etc/os-release" Arch |
;wrong in "/etc/arch-release" Arch |
[RebornOS Linux] |
Image = "RebornOS.png" |
;wrong in "/etc/os-release" |
[BluestarLinux] |
Image = "Bluestar.png" |
;detected in "/etc/lsb-release" |
;wrong in "/etc/os-release" Arch |
;wrong in "/etc/arch-release" Arch |
[EndeavourOS] |
Image = "EndeavourOS.png" |
;detected in "lsb_release -a" |
152,8 → 169,8 |
[ArcoLinux] |
Image = "Arco.png" |
Mode = "Detection" |
Files = "/etc/arcolinux-release" |
Mode = "Detection" |
;detected in "lsb_release -a" |
;detected in "/etc/lsb-release" |
;detected in "/etc/os-release" |
175,7 → 192,7 |
;detected in "/etc/lsb-release" |
;wrong in "/etc/os-release" Manjaro |
;wrong in "/etc/manjaro-release" Manjaro |
;wrong in "/etc/arch-release" Arch |
;wrong in "/etc/arch-release" Arch | Manjaro |
[Netrunner] |
Image = "Netrunner.png" |
229,6 → 246,7 |
[Arch Linux] |
Image = "Arch.png" |
Mode = "Analyse" |
Files = "/etc/arch-release" |
;detected in "/etc/os-release" |
296,6 → 314,16 |
;detected in "/etc/os-release" |
;wrong in "/etc/debian_version" Debian |
[Pop] |
Image = "Pop.png" |
;detected in "lsb_release -a" |
;detected in "/etc/lsb-release" |
;wrong in "/etc/debian_version" Debian |
[Pop!_OS] |
Image = "Pop.png" |
;detected in "/etc/os-release" |
[Mer] |
Image = "Mer.png" |
Mode = "Analyse" |
328,6 → 356,15 |
;detected in "/etc/lsb-release" |
;detected in "/etc/os-release" |
[Parrot] |
Image = "Parrot.png" |
;detected in "lsb_release -a" |
;wrong in "/etc/debian_version" Debian |
[Parrot OS] |
Image = "Parrot.png" |
;detected in "/etc/os-release" |
[BOSS] |
Image = "BOSS.png" |
Name = "BOSS GNU/Linux" |
522,6 → 559,18 |
;wrong in "/etc/os-release" Ubuntu |
;wrong in "/etc/debian_version" Debian |
[Linuxmint] |
Image = "Mint.png" |
;detected in "lsb_release -a" |
[Linux Mint] |
Image = "Mint.png" |
;detected in "/etc/os-release |
[LMDE] |
Image = "Mint.png" |
;detected in "/etc/os-release" |
[Trisquel] |
Image = "Trisquel.png" |
;detected in "lsb_release -a" |
548,6 → 597,23 |
;detected in "/etc/os-release" |
;wrong in "/etc/debian_version" Debian |
[Nitrux] |
Image = "Nitrux.png" |
;detected in "lsb_release -a" |
;detected in "/etc/lsb-release" |
;detected in "/etc/os-release" |
;wrong in "/etc/debian_version" Debian |
[MakuluLinux] |
Image = "Makulu.png" |
;detected in "/etc/lsb-release" |
;detected in "/etc/os-release" |
;wrong in "/etc/debian_version" Debian |
[Ubuntu MakuluLinux] |
Image = "Makulu.png" |
;detected in "lsb_release -a" |
[Linuxfx] |
Image = "Linuxfx.png" |
Name="Linuxfx" |
578,7 → 644,7 |
;detected in "/etc/os-release" |
[IYCC] |
Image = "iycc.png" |
Image = "IYCC.png" |
;detected in "/etc/lsb-release" |
[HipServ] |
836,6 → 902,14 |
;detected in "/etc/redhat-release" |
;detected in "/etc/system-release" |
[CentOSStream] |
Image = "CentOS.png" |
;detected in "lsb_release -a" |
[CentOS Stream] |
Image = "CentOS.png" |
;detected in "/etc/os-release" |
[CentOS Linux] |
Image = "CentOS.png" |
;detected in "/etc/os-release" |
871,6 → 945,11 |
;detected in "/etc/mandrake-release;/etc/mandrakelinux-release" |
;detected in "/etc/redhat-release" |
[Absolute] |
Image = "Absolute.png" |
;delected in "/etc/os-release" |
;wrong in "/etc/slackware-version" Slackware |
[Salix] |
Image = "Salix.png" |
Mode = "Detection" |
909,6 → 988,12 |
;detected in "/etc/os-release" |
;wrong in "/etc/slackware-version" Slackware |
[Slackware] |
Image = "Slackware.png" |
Files = "/etc/slackware-release" |
;detected in "/etc/os-release" |
;detected in "/etc/slackware-version" |
[Calculate] |
Image = "Calculate.png" |
;detected in "/etc/gentoo-release" |
950,6 → 1035,17 |
;wrong in "/etc/system-release" Fedora |
;wrong in "/etc/os-release" Fedora |
[Ultramarine] |
Image = "Ultramarine.png" |
Files = "/etc/ultramarine-release" |
;detected in "lsb_release -a" |
;detected in "/etc/redhat-release" |
;detected in "/etc/system-release" |
[Ultramarine Linux] |
Image = "Ultramarine.png" |
;detected in "/etc/os-release" |
[ALT] |
Image = "ALT.png" |
Files = "/etc/altlinux-release" |
957,6 → 1053,10 |
;detected in "/etc/redhat-release" |
;detected in "/etc/system-release" |
[ALT Linux] |
Image = "ALT.png" |
;detected in "/etc/os-release" |
[Simply] |
Image = "ALT.png" |
;detected in "/etc/fedora-release" |
967,10 → 1067,6 |
Image = "ALT.png" |
;detected in "/etc/os-release" |
[ALT Linux] |
Image = "ALT.png" |
;detected in "/etc/os-release" |
[Fuduntu] |
Image = "Fuduntu.png" |
Files = "/etc/fuduntu-release" |
1072,12 → 1168,6 |
;detected in "/etc/lsb-release" |
;detected in "/etc/os-release" |
; at the end because some distros may also have the same files (like Salix, Slax, SMS, Porteus, Vector, Zenwalk) |
[Slackware] |
Image = "Slackware.png" |
Files = "/etc/slackware-release;/etc/slackware-version" |
;detected in "/etc/os-release" |
[Qubes] |
Image = "Qubes.png" |
Files = "/etc/qubes-release" |
/web/acc/phpsysinfo/data/osnames.ini |
---|
43,6 → 43,7 |
10.15="Catalina" |
11="Big Sur" |
12="Monterey" |
13="Ventura" |
[win10] |
10240="1507" |
58,5 → 59,7 |
19042="20H2" |
19043="21H1" |
19044="21H2" |
19045="22H2" |
21996="leaked" |
22000="21H2" |
22621="22H2" |
/web/acc/phpsysinfo/gfx/images/Absolute.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/web/acc/phpsysinfo/gfx/images/Bluestar.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/web/acc/phpsysinfo/gfx/images/DrayOS.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/web/acc/phpsysinfo/gfx/images/Fedora.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
/web/acc/phpsysinfo/gfx/images/FortiOS.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/web/acc/phpsysinfo/gfx/images/FreeEOS.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/web/acc/phpsysinfo/gfx/images/Hurd.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/web/acc/phpsysinfo/gfx/images/IYCC.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/web/acc/phpsysinfo/gfx/images/Makulu.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/web/acc/phpsysinfo/gfx/images/Mint.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
/web/acc/phpsysinfo/gfx/images/Nitrux.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/web/acc/phpsysinfo/gfx/images/Parrot.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/web/acc/phpsysinfo/gfx/images/Pop.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/web/acc/phpsysinfo/gfx/images/RebornOS.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/web/acc/phpsysinfo/gfx/images/TrueNAS.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/web/acc/phpsysinfo/gfx/images/Ultramarine.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes: |
Added: svn:mime-type |
+image/png |
\ No newline at end of property |
/web/acc/phpsysinfo/gfx/images/gNewSense.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
/web/acc/phpsysinfo/includes/autoloader.inc.php |
---|
69,7 → 69,7 |
function errorHandlerPsi($level, $message, $file, $line) |
{ |
$error = PSI_Error::singleton(); |
if (PSI_DEBUG || (($level !== 2) && ($level !== 8)) || !(preg_match("/^[^:]*: open_basedir /", $message) || preg_match("/^fopen\(/", $message) || preg_match("/^is_readable\(/", $message) || preg_match("/^file_exists\(/", $message) || preg_match("/^fgets\(/", $message))) { // disable open_basedir, fopen, is_readable, file_exists and fgets warnings and notices |
if ((PSI_DEBUG && !preg_match("/^fgets\(|^stream_select\(/", $message)) || (($level !== 2) && ($level !== 8)) || !preg_match("/^[^:]*: open_basedir |^fopen\(|^fwrite\(|^is_readable\(|^file_exists\(|^fgets\(|^stream_select\(/", $message)) { // disable open_basedir, fopen, is_readable, file_exists, fgets and stream_select warnings and notices |
$error->addPhpError("errorHandlerPsi : ", "Level : ".$level." Message : ".$message." File : ".$file." Line : ".$line); |
} |
} |
/web/acc/phpsysinfo/includes/class.CommonFunctions.inc.php |
---|
156,7 → 156,7 |
* NOT $program = CommonFunctions::executeProgram('netstat', '-anp|grep LIST'); |
* |
* @param string $strProgramname name of the program |
* @param string $strArgs arguments to the program |
* @param string $strArguments arguments to the program |
* @param string &$strBuffer output of the command |
* @param boolean $booErrorRep en- or disables the reporting of errors which should be logged |
* @param int $timeout timeout value in seconds (default value is PSI_EXEC_TIMEOUT_INT) |
163,10 → 163,23 |
* |
* @return boolean command successfull or not |
*/ |
public static function executeProgram($strProgramname, $strArgs, &$strBuffer, $booErrorRep = true, $timeout = PSI_EXEC_TIMEOUT_INT) |
public static function executeProgram($strProgramname, $strArguments, &$strBuffer, $booErrorRep = true, $timeout = PSI_EXEC_TIMEOUT_INT, $separator = '') |
{ |
if (PSI_ROOT_FILESYSTEM !== '') { // disabled if ROOTFS defined |
return false; |
} |
if ((PSI_OS != 'WINNT') && preg_match('/^([^=]+=[^ \t]+)[ \t]+(.*)$/', $strProgramname, $strmatch)) { |
$strSet = $strmatch[1].' '; |
$strProgramname = $strmatch[2]; |
} else { |
$strSet = ''; |
} |
$strAll = trim($strSet.$strProgramname.' '.$strArguments); |
if (defined('PSI_LOG') && is_string(PSI_LOG) && (strlen(PSI_LOG)>0) && ((substr(PSI_LOG, 0, 1)=="-") || (substr(PSI_LOG, 0, 1)=="+"))) { |
$out = self::_parse_log_file("Executing: ".trim($strProgramname.' '.$strArgs)); |
$out = self::_parse_log_file("Executing: ".$strAll); |
if ($out == false) { |
if (substr(PSI_LOG, 0, 1)=="-") { |
$strBuffer = ''; |
180,21 → 193,65 |
} |
} |
if (PSI_ROOT_FILESYSTEM !== '') { // disabled if ROOTFS defined |
return false; |
$PathStr = ''; |
if (defined('PSI_EMU_PORT') && !in_array($strProgramname, array('ping', 'snmpwalk'))) { |
if (defined('PSI_SUDO_COMMANDS') && is_string(PSI_SUDO_COMMANDS)) { |
if (preg_match(ARRAY_EXP, PSI_SUDO_COMMANDS)) { |
$sudocommands = eval(PSI_SUDO_COMMANDS); |
} else { |
$sudocommands = array(PSI_SUDO_COMMANDS); |
} |
if (in_array($strProgramname, $sudocommands)) { |
$strAll = 'sudo '.$strAll; |
} |
} |
$strSet = ''; |
$strProgramname = 'sshpass'; |
$strOptions = ''; |
if (defined('PSI_EMU_ADD_OPTIONS') && is_string(PSI_EMU_ADD_OPTIONS)) { |
if (preg_match(ARRAY_EXP, PSI_EMU_ADD_OPTIONS)) { |
$arrParams = eval(PSI_EMU_ADD_OPTIONS); |
} else { |
$arrParams = array(PSI_EMU_ADD_OPTIONS); |
} |
foreach ($arrParams as $Params) if (preg_match('/(\S+)\s*\=\s*(\S+)/', $Params, $obuf)) { |
$strOptions = $strOptions.'-o '.$obuf[1].'='.$obuf[2].' '; |
} |
} |
if (defined('PSI_EMU_ADD_PATHS') && is_string(PSI_EMU_ADD_PATHS)) { |
if (preg_match(ARRAY_EXP, PSI_EMU_ADD_PATHS)) { |
$arrPath = eval(PSI_EMU_ADD_PATHS); |
} else { |
$arrPath = array(PSI_EMU_ADD_PATHS); |
} |
foreach ($arrPath as $Path) { |
if ($PathStr === '') { |
$PathStr = $Path; |
} else { |
$PathStr = $PathStr.':'.$Path; |
} |
} |
if ($separator === '') { |
$strArguments = '-e ssh -Tq '.$strOptions.'-o ConnectTimeout='.$timeout.' -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null '.PSI_EMU_USER.'@'.PSI_EMU_HOSTNAME.' -p '.PSI_EMU_PORT.' "PATH=\''.$PathStr.':$PATH\' '.$strAll.'"' ; |
} else { |
$strArguments = '-e ssh -Tq '.$strOptions.'-o ConnectTimeout='.$timeout.' -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null '.PSI_EMU_USER.'@'.PSI_EMU_HOSTNAME.' -p '.PSI_EMU_PORT; |
} |
} else { |
if ($separator === '') { |
$strArguments = '-e ssh -Tq '.$strOptions.'-o ConnectTimeout='.$timeout.' -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null '.PSI_EMU_USER.'@'.PSI_EMU_HOSTNAME.' -p '.PSI_EMU_PORT.' "'.$strAll.'"' ; |
} else { |
$strArguments = '-e ssh -Tq '.$strOptions.'-o ConnectTimeout='.$timeout.' -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null '.PSI_EMU_USER.'@'.PSI_EMU_HOSTNAME.' -p '.PSI_EMU_PORT; |
} |
} |
$externally = true; |
} else { |
$externally = false; |
} |
if ((PSI_OS != 'WINNT') && preg_match('/^([^=]+=[^ \t]+)[ \t]+(.*)$/', $strProgramname, $strmatch)) { |
$strSet = $strmatch[1].' '; |
$strProgramname = $strmatch[2]; |
} else { |
$strSet = ''; |
} |
$strProgram = self::_findProgram($strProgramname); |
$error = PSI_Error::singleton(); |
if (!$strProgram) { |
if ($booErrorRep) { |
if ($booErrorRep || $externally) { |
$error->addError('find_program("'.$strProgramname.'")', 'program not found on the machine'); |
} |
205,7 → 262,7 |
} |
} |
if ((PSI_OS != 'WINNT') && defined('PSI_SUDO_COMMANDS') && is_string(PSI_SUDO_COMMANDS)) { |
if ((PSI_OS != 'WINNT') && !defined('PSI_EMU_HOSTNAME') && defined('PSI_SUDO_COMMANDS') && is_string(PSI_SUDO_COMMANDS)) { |
if (preg_match(ARRAY_EXP, PSI_SUDO_COMMANDS)) { |
$sudocommands = eval(PSI_SUDO_COMMANDS); |
} else { |
214,9 → 271,7 |
if (in_array($strProgramname, $sudocommands)) { |
$sudoProgram = self::_findProgram("sudo"); |
if (!$sudoProgram) { |
if ($booErrorRep) { |
$error->addError('find_program("sudo")', 'program not found on the machine'); |
} |
$error->addError('find_program("sudo")', 'program not found on the machine'); |
return false; |
} else { |
229,6 → 284,7 |
} |
} |
$strArgs = $strArguments; |
// see if we've gotten a | or &, if we have we need to do path checking on the cmd |
if ($strArgs) { |
$arrArgs = preg_split('/ /', $strArgs, -1, PREG_SPLIT_NO_EMPTY); |
236,10 → 292,25 |
if (($arrArgs[$i] == '|') || ($arrArgs[$i] == '&')) { |
$strCmd = $arrArgs[$i + 1]; |
$strNewcmd = self::_findProgram($strCmd); |
if ($arrArgs[$i] == '|') { |
$strArgs = preg_replace('/\| '.$strCmd.'/', '| "'.$strNewcmd.'"', $strArgs); |
if (!$strNewcmd) { |
if ($booErrorRep || $externally) { |
$error->addError('find_program("'.$strCmd.'")', 'program not found on the machine'); |
} |
return false; |
} |
if (preg_match('/\s/', $strNewcmd)) { |
if ($arrArgs[$i] == '|') { |
$strArgs = preg_replace('/\| '.$strCmd.'/', '| "'.$strNewcmd.'"', $strArgs); |
} else { |
$strArgs = preg_replace('/& '.$strCmd.'/', '& "'.$strNewcmd.'"', $strArgs); |
} |
} else { |
$strArgs = preg_replace('/& '.$strCmd.'/', '& "'.$strNewcmd.'"', $strArgs); |
if ($arrArgs[$i] == '|') { |
$strArgs = preg_replace('/\| '.$strCmd.'/', '| '.$strNewcmd, $strArgs); |
} else { |
$strArgs = preg_replace('/& '.$strCmd.'/', '& '.$strNewcmd, $strArgs); |
} |
} |
} |
} |
250,7 → 321,15 |
$strError = ''; |
$pipes = array(); |
$descriptorspec = array(0=>array("pipe", "r"), 1=>array("pipe", "w"), 2=>array("pipe", "w")); |
if ($externally) { |
putenv('SSHPASS='.PSI_EMU_PASSWORD); |
} |
if (defined("PSI_MODE_POPEN") && PSI_MODE_POPEN) { |
if ($separator !== '') { |
$error->addError('executeProgram', 'wrong execution mode'); |
return false; |
} |
if (PSI_OS == 'WINNT') { |
$process = $pipes[1] = popen($strSet.$strProgram.$strArgs." 2>nul", "r"); |
} else { |
258,9 → 337,19 |
} |
} else { |
$process = proc_open($strSet.$strProgram.$strArgs, $descriptorspec, $pipes); |
if ($separator !== '') { |
if ($PathStr === '') { |
fwrite($pipes[0], $strAll."\n "); // spaces at end for handling 'more' |
} else { |
fwrite($pipes[0], 'PATH=\''.$PathStr.':$PATH\' '.$strAll."\n"); |
} |
} |
} |
if ($externally) { |
putenv('SSHPASS'); |
} |
if (is_resource($process)) { |
$te = self::_timeoutfgets($pipes, $strBuffer, $strError, $timeout); |
$te = self::_timeoutfgets($pipes, $strBuffer, $strError, $timeout, $separator); |
if (defined("PSI_MODE_POPEN") && PSI_MODE_POPEN) { |
$return_value = pclose($pipes[1]); |
} else { |
286,7 → 375,7 |
$strError = trim($strError); |
$strBuffer = trim($strBuffer); |
if (defined('PSI_LOG') && is_string(PSI_LOG) && (strlen(PSI_LOG)>0) && (substr(PSI_LOG, 0, 1)!="-") && (substr(PSI_LOG, 0, 1)!="+")) { |
error_log("---".gmdate('r T')."--- Executing: ".trim($strProgramname.$strArgs)."\n".$strBuffer."\n", 3, PSI_LOG); |
error_log("---".gmdate('r T')."--- Executing: ".$strAll."\n".$strBuffer."\n", 3, PSI_LOG); |
} |
if (! empty($strError)) { |
if ($booErrorRep) { |
306,6 → 395,10 |
*/ |
public static function rolv($similarFileName, $match = "//", $replace = "") |
{ |
if (defined('PSI_EMU_PORT')) { |
return null; |
} |
$filename = preg_replace($match, $replace, $similarFileName); |
if (self::fileexists($filename) && self::rfts($filename, $buf, 1, 4096, false) && (($buf=trim($buf)) != "")) { |
return $buf; |
359,6 → 452,10 |
*/ |
public static function rfts($strFileName, &$strRet, $intLines = 0, $intBytes = 4096, $booErrorRep = true) |
{ |
if (defined('PSI_EMU_PORT')) { |
return false; |
} |
if (defined('PSI_LOG') && is_string(PSI_LOG) && (strlen(PSI_LOG)>0) && ((substr(PSI_LOG, 0, 1)=="-") || (substr(PSI_LOG, 0, 1)=="+"))) { |
$out = self::_parse_log_file("Reading: ".$strFileName); |
if ($out == false) { |
478,6 → 575,10 |
*/ |
public static function findglob($pattern, $flags = 0) |
{ |
if (defined('PSI_EMU_PORT')) { |
return false; |
} |
$outarr = glob(PSI_ROOT_FILESYSTEM.$pattern, $flags); |
if (PSI_ROOT_FILESYSTEM == '') { |
return $outarr; |
503,6 → 604,10 |
*/ |
public static function fileexists($strFileName) |
{ |
if (defined('PSI_EMU_PORT')) { |
return false; |
} |
if (defined('PSI_LOG') && is_string(PSI_LOG) && (strlen(PSI_LOG)>0) && ((substr(PSI_LOG, 0, 1)=="-") || (substr(PSI_LOG, 0, 1)=="+"))) { |
$log_file = substr(PSI_LOG, 1); |
if (file_exists($log_file) |
613,7 → 718,7 |
* |
* @return boolean timeout expired or not |
*/ |
private static function _timeoutfgets($pipes, &$out, &$err, $timeout) |
private static function _timeoutfgets($pipes, &$out, &$err, $timeout, $separator = '') |
{ |
$w = null; |
$e = null; |
638,6 → 743,9 |
break; |
} elseif ($n === 0) { |
error_log('stream_select: timeout expired !'); |
// if ($separator !== '') { |
// fwrite($pipes[0], "q"); |
// } |
$te = true; |
break; |
} |
649,6 → 757,13 |
$err .= fread($r, 4096); |
} |
} |
// if (($separator !== '') && preg_match('/'.$separator.'[^'.$separator.']+'.$separator.'/', $out)) { |
if (($separator !== '') && preg_match('/'.$separator.'[\s\S]+'.$separator.'/', $out)) { |
fwrite($pipes[0], "quit\n"); |
$separator = ''; //only one time |
// $te = true; |
// break; |
} |
} |
return $te; |
692,6 → 807,8 |
if (gettype($vendor_data) === "array") { |
$vendarray = array( |
'KVM' => 'kvm', // KVM |
'OpenStack' => 'kvm', // Detect OpenStack instance as KVM in non x86 architecture |
'KubeVirt' => 'kvm', // Detect KubeVirt instance as KVM in non x86 architecture |
'Amazon EC2' => 'amazon', // Amazon EC2 Nitro using Linux KVM |
'QEMU' => 'qemu', // QEMU |
'VMware' => 'vmware', // VMware https://kb.vmware.com/s/article/1009458 |
704,6 → 821,7 |
// https://wiki.freebsd.org/bhyve |
'BHYVE' => 'bhyve', // bhyve |
'Hyper-V' => 'microsoft', // Hyper-V |
'Apple Virtualization' => 'apple', // Apple Virtualization.framework guests |
'Microsoft Corporation Virtual Machine' => 'microsoft' // Hyper-V |
); |
for ($i = 0; $i < count($vendor_data); $i++) { |
717,6 → 835,7 |
$vidarray = array( |
'bhyvebhyve' => 'bhyve', // bhyve |
'KVMKVMKVM' => 'kvm', // KVM |
'LinuxKVMHv' => 'hv-kvm', // KVM (KVM + HyperV Enlightenments) |
'MicrosoftHv' => 'microsoft', // Hyper-V |
'lrpepyhvr' => 'parallels', // Parallels |
'UnisysSpar64' => 'spar', // Unisys sPar |
744,7 → 863,7 |
*/ |
public static function readdmimemdata() |
{ |
if ((PSI_OS != 'WINNT') && !defined('PSI_EMU_HOSTNAME') && (self::$_dmimd === null)) { |
if ((PSI_OS != 'WINNT') && (!defined('PSI_EMU_HOSTNAME') || defined('PSI_EMU_PORT')) && (self::$_dmimd === null)) { |
self::$_dmimd = array(); |
$buffer = ''; |
if (defined('PSI_DMIDECODE_ACCESS') && (strtolower(PSI_DMIDECODE_ACCESS)==='data')) { |
/web/acc/phpsysinfo/includes/class.Parser.inc.php |
---|
117,7 → 117,7 |
$mount_parm[] = $parm; |
} |
} |
} elseif (CommonFunctions::rfts(((PSI_ROOT_FILESYSTEM === '')||(PHP_OS !== 'Linux'))?"/etc/mtab":"/proc/1/mounts", $mount)) { |
} elseif (CommonFunctions::rfts(((PSI_ROOT_FILESYSTEM === '')||(PSI_OS !== 'Linux'))?"/etc/mtab":"/proc/1/mounts", $mount)) { |
$mount = preg_split("/\n/", $mount, -1, PREG_SPLIT_NO_EMPTY); |
foreach ($mount as $mount_line) { |
if (preg_match("/(\S+) (\S+) (\S+) (\S+) ([0-9]+) ([0-9]+)/", $mount_line, $mount_buf)) { |
/web/acc/phpsysinfo/includes/error/class.PSI_Error.inc.php |
---|
240,6 → 240,10 |
} else { |
$strFunc = $val['function'].'('; |
if (isset($val['args'][0])) { |
if (($val['function'] == 'executeProgram') && ($val['args'][0] == 'sshpass') |
&& isset($val['args'][1]) && preg_match('/"([^"]+)"$/', $val['args'][1], $tmpout)) { |
$val['args'][1] = 'ssh: '. $tmpout[1]; |
} |
$strFunc .= ' '; |
$strComma = ''; |
foreach ($val['args'] as $valArgs) { |
/web/acc/phpsysinfo/includes/mb/class.cpumem.inc.php |
---|
73,7 → 73,7 |
$this->mbinfo->setMbVolt($dev); |
} |
} |
if ((PSI_OS != 'WINNT') && !defined('PSI_EMU_HOSTNAME')) { |
if ((PSI_OS != 'WINNT') && (!defined('PSI_EMU_HOSTNAME') || defined('PSI_EMU_PORT'))) { |
$dmimd = CommonFunctions::readdmimemdata(); |
$counter = 0; |
foreach ($dmimd as $mem) { |
/web/acc/phpsysinfo/includes/mb/class.fortisensor.inc.php |
---|
0,0 → 1,122 |
<?php |
/** |
* fortisensor sensor class, getting hardware sensors information from Fortinet devices |
* |
* PHP version 5 |
* |
* @category PHP |
* @package PSI_Sensor |
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net> |
* @copyright 2022 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 FortiSensor extends Sensors |
{ |
/** |
* content to parse |
* |
* @var array |
*/ |
private $_lines = array(); |
/** |
* fill the private array |
*/ |
public function __construct() |
{ |
parent::__construct(); |
$lines = ""; |
if (defined('PSI_EMU_PORT') && CommonFunctions::executeProgram('execute', 'sensor list', $resulte, false) && ($resulte !== "") |
&& preg_match('/^(.*[\$#]\s*)/', $resulte, $resulto, PREG_OFFSET_CAPTURE)) { |
$resulti = substr($resulte, strlen($resulto[1][0])); |
if (preg_match('/(\n.*[\$#])$/', $resulti, $resulto, PREG_OFFSET_CAPTURE)) { |
$lines = substr($resulti, 0, $resulto[1][1]); |
} |
} |
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
} |
/** |
* get temperature information |
* |
* @return void |
*/ |
private function _temperature() |
{ |
foreach ($this->_lines as $line) { |
if (preg_match('/^\s*\d+\s(.+)\sTemperature\s+([\d\.]+)\s\S*C\s*$/', $line, $data)) { |
$dev = new SensorDevice(); |
$dev->setName($data[1]); |
$dev->setValue($data[2]); |
$this->mbinfo->setMbTemp($dev); |
} elseif (preg_match('/^\s*\d+\s(.+)\s+alarm=(\d)\s+value=(\d+)\s/', $line, $data) |
&& !preg_match('/fan| vin/i', $data[1])) { |
$dev = new SensorDevice(); |
$dev->setName(trim($data[1])); |
$dev->setValue($data[3]); |
if ($data[2] != 0) { |
$dev->setEvent("Alarm"); |
} |
$this->mbinfo->setMbTemp($dev); |
} |
} |
} |
/** |
* get voltage information |
* |
* @return void |
*/ |
private function _voltage() |
{ |
foreach ($this->_lines as $line) { |
if (preg_match('/^\s*\d+\s(.+)\s+alarm=(\d)\s+value=([\d\.]+)\s/', $line, $data) |
&& preg_match('/\./', $data[3]) |
&& !preg_match('/fan|temp/i', $data[1])) { |
$dev = new SensorDevice(); |
$dev->setName(trim($data[1])); |
$dev->setValue($data[3]); |
if ($data[2] != 0) { |
$dev->setEvent("Alarm"); |
} |
$this->mbinfo->setMbVolt($dev); |
} |
} |
} |
/** |
* get fan information |
* |
* @return void |
*/ |
private function _fans() |
{ |
foreach ($this->_lines as $line) { |
if (preg_match('/^\s*\d+\s(.+)\s+alarm=(\d)\s+value=(\d+)\s/', $line, $data) |
&& preg_match('/fan/i', $data[1])) { |
$dev = new SensorDevice(); |
$dev->setName(trim($data[1])); |
$dev->setValue($data[3]); |
if ($data[2] != 0) { |
$dev->setEvent("Alarm"); |
} |
$this->mbinfo->setMbFan($dev); |
} |
} |
} |
/** |
* get the information |
* |
* @see PSI_Interface_Sensor::build() |
* |
* @return void |
*/ |
public function build() |
{ |
$this->_temperature(); |
$this->_voltage(); |
$this->_fans(); |
} |
} |
/web/acc/phpsysinfo/includes/mb/class.freeipmi.inc.php |
---|
27,13 → 27,13 |
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') { |
if ((PSI_OS != 'WINNT') && (!defined('PSI_EMU_HOSTNAME') || defined('PSI_EMU_PORT'))) 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); |
break; |
case 'data': |
if (CommonFunctions::rftsdata('freeipmi.tmp', $lines)) { |
if (!defined('PSI_EMU_PORT') && CommonFunctions::rftsdata('freeipmi.tmp', $lines)) { |
$this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
} |
break; |
/web/acc/phpsysinfo/includes/mb/class.hddtemp.inc.php |
---|
24,11 → 24,11 |
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') { |
if ((PSI_OS == 'Linux') && (!defined('PSI_EMU_HOSTNAME') || defined('PSI_EMU_PORT'))) 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. |
$fp = @fsockopen('localhost', 7634, $errno, $errstr, 5); |
$fp = @fsockopen(defined('PSI_EMU_HOSTNAME')?PSI_EMU_HOSTNAME:'localhost', 7634, $errno, $errstr, 5); |
// if connected, read the output of the hddtemp daemon |
if ($fp) { |
while (!feof($fp)) { |
/web/acc/phpsysinfo/includes/mb/class.healthd.inc.php |
---|
37,7 → 37,7 |
} |
break; |
case 'data': |
if (CommonFunctions::rftsdata('healthd.tmp', $lines)) { |
if (!defined('PSI_EMU_PORT') && 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]); |
/web/acc/phpsysinfo/includes/mb/class.hwmon.inc.php |
---|
246,7 → 246,7 |
*/ |
public function build() |
{ |
if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) { |
if ((PSI_OS == 'Linux') && (!defined('PSI_EMU_HOSTNAME') || defined('PSI_EMU_PORT'))) { |
$hwpaths = CommonFunctions::findglob("/sys/class/hwmon/hwmon*/", GLOB_NOSORT); |
if (is_array($hwpaths) && (count($hwpaths) > 0)) { |
$hwpaths2 = CommonFunctions::findglob("/sys/class/hwmon/hwmon*/device/", GLOB_NOSORT); |
/web/acc/phpsysinfo/includes/mb/class.ipmicfg.inc.php |
---|
27,7 → 27,7 |
public function __construct() |
{ |
parent::__construct(); |
if (!defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_IPMICFG_ACCESS')?strtolower(PSI_SENSOR_IPMICFG_ACCESS):'command') { |
if (!defined('PSI_EMU_HOSTNAME') || defined('PSI_EMU_PORT')) 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); |
40,7 → 40,7 |
$this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
break; |
case 'data': |
if (CommonFunctions::rftsdata('ipmicfg.tmp', $lines)) { |
if (!defined('PSI_EMU_PORT') && CommonFunctions::rftsdata('ipmicfg.tmp', $lines)) { |
$this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
} |
break; |
/web/acc/phpsysinfo/includes/mb/class.ipmitool.inc.php |
---|
28,12 → 28,14 |
{ |
parent::__construct(); |
$lines = ""; |
if (!defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_IPMITOOL_ACCESS')?strtolower(PSI_SENSOR_IPMITOOL_ACCESS):'command') { |
if (!defined('PSI_EMU_HOSTNAME') || defined('PSI_EMU_PORT')) switch (defined('PSI_SENSOR_IPMITOOL_ACCESS')?strtolower(PSI_SENSOR_IPMITOOL_ACCESS):'command') { |
case 'command': |
CommonFunctions::executeProgram('ipmitool', 'sensor -v', $lines); |
break; |
case 'data': |
CommonFunctions::rftsdata('ipmitool.tmp', $lines); |
if (!defined('PSI_EMU_PORT')) { |
CommonFunctions::rftsdata('ipmitool.tmp', $lines); |
} |
break; |
default: |
$this->error->addConfigError('__construct()', '[sensor_ipmitool] ACCESS'); |
/web/acc/phpsysinfo/includes/mb/class.ipmiutil.inc.php |
---|
27,13 → 27,13 |
public function __construct() |
{ |
parent::__construct(); |
if (!defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_IPMIUTIL_ACCESS')?strtolower(PSI_SENSOR_IPMIUTIL_ACCESS):'command') { |
if (!defined('PSI_EMU_HOSTNAME') || defined('PSI_EMU_PORT')) 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); |
break; |
case 'data': |
if (CommonFunctions::rftsdata('ipmiutil.tmp', $lines)) { |
if (!defined('PSI_EMU_PORT') && CommonFunctions::rftsdata('ipmiutil.tmp', $lines)) { |
$this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
} |
break; |
/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') { |
if ((PSI_OS != 'WINNT') && (!defined('PSI_EMU_HOSTNAME') || defined('PSI_EMU_PORT'))) switch (defined('PSI_SENSOR_K8TEMP_ACCESS')?strtolower(PSI_SENSOR_K8TEMP_ACCESS):'command') { |
case 'command': |
$lines = ""; |
CommonFunctions::executeProgram('k8temp', '', $lines); |
34,7 → 34,7 |
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
break; |
case 'data': |
if (CommonFunctions::rftsdata('k8temp.tmp', $lines)) { |
if (!defined('PSI_EMU_PORT') && CommonFunctions::rftsdata('k8temp.tmp', $lines)) { |
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
} |
break; |
/web/acc/phpsysinfo/includes/mb/class.lmsensors.inc.php |
---|
28,12 → 28,14 |
{ |
parent::__construct(); |
$lines = ""; |
if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_LMSENSORS_ACCESS')?strtolower(PSI_SENSOR_LMSENSORS_ACCESS):'command') { |
if ((PSI_OS == 'Linux') && (!defined('PSI_EMU_HOSTNAME') || defined('PSI_EMU_PORT'))) switch (defined('PSI_SENSOR_LMSENSORS_ACCESS')?strtolower(PSI_SENSOR_LMSENSORS_ACCESS):'command') { |
case 'command': |
CommonFunctions::executeProgram("sensors", "", $lines); |
break; |
case 'data': |
CommonFunctions::rftsdata('lmsensors.tmp', $lines); |
if (!defined('PSI_EMU_PORT')) { |
CommonFunctions::rftsdata('lmsensors.tmp', $lines); |
} |
break; |
default: |
$this->error->addConfigError('__construct()', '[sensor_lmsensors] ACCESS'); |
/web/acc/phpsysinfo/includes/mb/class.mbmon.inc.php |
---|
27,9 → 27,9 |
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') { |
if ((PSI_OS != 'WINNT') && (!defined('PSI_EMU_HOSTNAME') || defined('PSI_EMU_PORT'))) switch (defined('PSI_SENSOR_MBMON_ACCESS')?strtolower(PSI_SENSOR_MBMON_ACCESS):'command') { |
case 'tcp': |
$fp = fsockopen("localhost", 411, $errno, $errstr, 5); |
$fp = fsockopen(defined('PSI_EMU_HOSTNAME')?PSI_EMU_HOSTNAME:'localhost', 411, $errno, $errstr, 5); |
if ($fp) { |
$lines = ""; |
while (!feof($fp)) { |
45,7 → 45,7 |
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
break; |
case 'data': |
if (CommonFunctions::rftsdata('mbmon.tmp', $lines)) { |
if (!defined('PSI_EMU_PORT') && CommonFunctions::rftsdata('mbmon.tmp', $lines)) { |
$this->_lines = preg_split("/\n/", $lines, -1, PREG_SPLIT_NO_EMPTY); |
} |
break; |
/web/acc/phpsysinfo/includes/mb/class.nvidiasmi.inc.php |
---|
27,7 → 27,7 |
public function __construct() |
{ |
parent::__construct(); |
if (!defined('PSI_EMU_HOSTNAME')) switch (defined('PSI_SENSOR_NVIDIASMI_ACCESS')?strtolower(PSI_SENSOR_NVIDIASMI_ACCESS):'command') { |
if (!defined('PSI_EMU_HOSTNAME') || defined('PSI_EMU_PORT')) 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"; |
43,7 → 43,7 |
$this->_gpus = preg_split("/^(?=GPU )/m", $lines, -1, PREG_SPLIT_NO_EMPTY); |
break; |
case 'data': |
if (CommonFunctions::rftsdata('nvidiasmi.tmp', $lines)) { |
if (!defined('PSI_EMU_PORT') && CommonFunctions::rftsdata('nvidiasmi.tmp', $lines)) { |
$this->_gpus = preg_split("/^(?=GPU )/m", $lines, -1, PREG_SPLIT_NO_EMPTY); |
} |
break; |
/web/acc/phpsysinfo/includes/mb/class.ohm.inc.php |
---|
27,7 → 27,7 |
public function __construct() |
{ |
parent::__construct(); |
if ((PSI_OS == 'WINNT') || defined('PSI_EMU_HOSTNAME')) { |
if ((PSI_OS == 'WINNT') || (defined('PSI_EMU_HOSTNAME') && !defined('PSI_EMU_PORT'))) { |
$_wmi = WINNT::initWMI('root\OpenHardwareMonitor', true); |
if ($_wmi) { |
$tmpbuf = WINNT::getWMI($_wmi, 'Sensor', array('Parent', 'Name', 'SensorType', 'Value')); |
/web/acc/phpsysinfo/includes/mb/class.qtssnmp.inc.php |
---|
21,7 → 21,12 |
*/ |
private function _temperature() |
{ |
if (CommonFunctions::executeProgram("snmpwalk", "-Ona -c public -v 1 -t ".PSI_SNMP_TIMEOUT_INT." -r ".PSI_SNMP_RETRY_INT." 127.0.0.1 .1.3.6.1.4.1.24681.1.2.5.0", $buffer, PSI_DEBUG) |
if (!defined('PSI_EMU_PORT')) { |
$address = '127.0.0.1'; |
} else { |
$address = PSI_EMU_HOSTNAME; |
} |
if (CommonFunctions::executeProgram("snmpwalk", "-Ona -c public -v 1 -t ".PSI_SNMP_TIMEOUT_INT." -r ".PSI_SNMP_RETRY_INT." ".$address." .1.3.6.1.4.1.24681.1.2.5.0", $buffer, PSI_DEBUG) |
&& preg_match('/^[\.\d]+ = STRING:\s\"?(\d+)\sC/', $buffer, $data)) { |
$dev = new SensorDevice(); |
$dev->setName("CPU"); |
29,7 → 34,7 |
$this->mbinfo->setMbTemp($dev); |
} |
if (CommonFunctions::executeProgram("snmpwalk", "-Ona -c public -v 1 -t ".PSI_SNMP_TIMEOUT_INT." -r ".PSI_SNMP_RETRY_INT." 127.0.0.1 .1.3.6.1.4.1.24681.1.2.6.0", $buffer, PSI_DEBUG) |
if (CommonFunctions::executeProgram("snmpwalk", "-Ona -c public -v 1 -t ".PSI_SNMP_TIMEOUT_INT." -r ".PSI_SNMP_RETRY_INT." ".$address." .1.3.6.1.4.1.24681.1.2.6.0", $buffer, PSI_DEBUG) |
&& preg_match('/^[\.\d]+ = STRING:\s\"?(\d+)\sC/', $buffer, $data)) { |
$dev = new SensorDevice(); |
$dev->setName("System"); |
37,7 → 42,7 |
$this->mbinfo->setMbTemp($dev); |
} |
if (CommonFunctions::executeProgram("snmpwalk", "-Ona -c public -v 1 -t ".PSI_SNMP_TIMEOUT_INT." -r ".PSI_SNMP_RETRY_INT." 127.0.0.1 .1.3.6.1.4.1.24681.1.2.11.1.3", $buffer, PSI_DEBUG)) { |
if (CommonFunctions::executeProgram("snmpwalk", "-Ona -c public -v 1 -t ".PSI_SNMP_TIMEOUT_INT." -r ".PSI_SNMP_RETRY_INT." ".$address." .1.3.6.1.4.1.24681.1.2.11.1.3", $buffer, PSI_DEBUG)) { |
$lines = preg_split('/\r?\n/', $buffer); |
foreach ($lines as $line) if (preg_match('/^[\.\d]+\.(\d+) = STRING:\s\"?(\d+)\sC/', $line, $data)) { |
$dev = new SensorDevice(); |
55,7 → 60,12 |
*/ |
private function _fans() |
{ |
if (CommonFunctions::executeProgram("snmpwalk", "-Ona -c public -v 1 -t ".PSI_SNMP_TIMEOUT_INT." -r ".PSI_SNMP_RETRY_INT." 127.0.0.1 .1.3.6.1.4.1.24681.1.2.15.1.3", $buffer, PSI_DEBUG)) { |
if (!defined('PSI_EMU_PORT')) { |
$address = '127.0.0.1'; |
} else { |
$address = PSI_EMU_HOSTNAME; |
} |
if (CommonFunctions::executeProgram("snmpwalk", "-Ona -c public -v 1 -t ".PSI_SNMP_TIMEOUT_INT." -r ".PSI_SNMP_RETRY_INT." ".$address." .1.3.6.1.4.1.24681.1.2.15.1.3", $buffer, PSI_DEBUG)) { |
$lines = preg_split('/\r?\n/', $buffer); |
foreach ($lines as $line) if (preg_match('/^[\.\d]+\.(\d+) = STRING:\s\"?(\d+)\sRPM/', $line, $data)) { |
$dev = new SensorDevice(); |
75,7 → 85,7 |
*/ |
public function build() |
{ |
if ((PSI_OS == 'Linux') && !defined('PSI_EMU_HOSTNAME')) { |
if ((PSI_OS == 'Linux') && (!defined('PSI_EMU_HOSTNAME') || defined('PSI_EMU_PORT'))) { |
$this->_temperature(); |
$this->_fans(); |
} |
/web/acc/phpsysinfo/includes/mb/class.thermalzone.inc.php |
---|
29,7 → 29,7 |
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 ((PSI_OS == 'WINNT') || (defined('PSI_EMU_HOSTNAME') && !defined('PSI_EMU_PORT'))) { |
if (defined('PSI_EMU_HOSTNAME') || WINNT::isAdmin()) { |
$_wmi = WINNT::initWMI('root\WMI', true); |
if ($_wmi) { |
/web/acc/phpsysinfo/includes/os/class.Android.inc.php |
---|
54,7 → 54,7 |
* |
* @return void |
*/ |
private function _kernel() |
protected function _kernel() |
{ |
if (CommonFunctions::executeProgram('uname', '-r', $strBuf, false)) { |
$result = $strBuf; |
91,7 → 91,7 |
* |
* @return void |
*/ |
private function _filesystems() |
protected function _filesystems() |
{ |
$notwas = true; |
if (CommonFunctions::executeProgram('df', '2>/dev/null ', $df, PSI_DEBUG) && preg_match("/\s+[0-9\.]+[KMGT]\s+/", $df)) { |
197,7 → 197,7 |
* |
* @return void |
*/ |
private function _machine() |
protected function _machine() |
{ |
if ($lines = $this->_get_buildprop()) { |
$buf = ""; |
/web/acc/phpsysinfo/includes/os/class.BSDCommon.inc.php |
---|
232,8 → 232,15 |
protected function kernel() |
{ |
$s = $this->grabkey('kern.version'); |
$a = preg_split('/:/', $s); |
if (isset($a[2])) { |
$a = preg_split('/:/', $s, 4); |
if (isset($a[3])) { |
if (preg_match('/^(\d{2} [A-Z]{3});/', $a[3], $abuf) // eg. 19:58 GMT;... |
|| preg_match('/^(\d{2} [A-Z]{3} \d{4})/', $a[3], $abuf)) { // eg. 26:31 PDT 2019... |
$this->sys->setKernel($a[0].$a[1].':'.$a[2].':'.$abuf[1]); |
} else { |
$this->sys->setKernel($a[0].$a[1].':'.$a[2]); |
} |
} elseif (isset($a[2])) { |
$this->sys->setKernel($a[0].$a[1].':'.$a[2]); |
} else { |
$this->sys->setKernel($s); |
305,7 → 312,7 |
array_shift($pslines); |
$sum = 0; |
foreach ($pslines as $psline) { |
$sum+=trim($psline); |
$sum+=str_replace(',', '.', trim($psline)); |
} |
$this->_cpu_loads['cpu'] = min($sum/$ncpu, 100); |
} |
331,6 → 338,7 |
$s = $this->grabkey('vm.loadavg'); |
$s = preg_replace('/{ /', '', $s); |
$s = preg_replace('/ }/', '', $s); |
$s = str_replace(',', '.', $s); |
$this->sys->setLoad($s); |
if (PSI_LOAD_BAR) { |
358,7 → 366,7 |
$regexps = preg_split("/\n/", $this->_CPURegExp1, -1, PREG_SPLIT_NO_EMPTY); // multiple regexp separated by \n |
foreach ($regexps as $regexp) { |
if (preg_match($regexp, $line, $ar_buf) && (sizeof($ar_buf) > 2)) { |
if ($dev->getCpuSpeed() === 0) { |
if ($dev->getCpuSpeed() == 0) { |
$dev->setCpuSpeed(round($ar_buf[2])); |
} |
$notwas = false; |
/web/acc/phpsysinfo/includes/os/class.Darwin.inc.php |
---|
97,8 → 97,8 |
protected function cpuinfo() |
{ |
$dev = new CpuDevice(); |
if (CommonFunctions::executeProgram('hostinfo', '| grep "Processor type"', $buf, PSI_DEBUG)) { |
$dev->setModel(preg_replace('/Processor type: /', '', $buf)); |
if (CommonFunctions::executeProgram('hostinfo', '', $buf, PSI_DEBUG) && ($buf !== '') && preg_match('/^Processor type:[ ]+(.+)$/m', $buf, $proc) && (($proc[1] = trim($proc[1])) !== '')) { |
$dev->setModel($proc[1]); |
$buf=$this->grabkey('hw.model'); |
if (($buf !== null) && (trim($buf) != "")) { |
$this->sys->setMachine(trim($buf)); |
264,60 → 264,61 |
*/ |
protected function memory() |
{ |
$s = $this->grabkey('hw.memsize'); |
if (CommonFunctions::executeProgram('vm_stat', '', $pstat, PSI_DEBUG)) { |
// calculate free memory from page sizes (each page = 4096) |
if (preg_match('/^Pages free:\s+(\S+)/m', $pstat, $free_buf)) { |
if (preg_match('/^Anonymous pages:\s+(\S+)/m', $pstat, $anon_buf) |
&& preg_match('/^Pages wired down:\s+(\S+)/m', $pstat, $wire_buf) |
&& preg_match('/^File-backed pages:\s+(\S+)/m', $pstat, $fileb_buf)) { |
// OS X 10.9 or never |
$this->sys->setMemFree($free_buf[1] * 4 * 1024); |
$this->sys->setMemApplication(($anon_buf[1]+$wire_buf[1]) * 4 * 1024); |
$this->sys->setMemCache($fileb_buf[1] * 4 * 1024); |
if (preg_match('/^Pages occupied by compressor:\s+(\S+)/m', $pstat, $compr_buf)) { |
$this->sys->setMemBuffer($compr_buf[1] * 4 * 1024); |
if (($s = $this->grabkey('hw.memsize')) > 0) { |
$this->sys->setMemTotal($s); |
if (CommonFunctions::executeProgram('vm_stat', '', $pstat, PSI_DEBUG)) { |
// calculate free memory from page sizes (each page = 4096) |
if (preg_match('/^Pages free:\s+(\S+)/m', $pstat, $free_buf)) { |
if (preg_match('/^Anonymous pages:\s+(\S+)/m', $pstat, $anon_buf) |
&& preg_match('/^Pages wired down:\s+(\S+)/m', $pstat, $wire_buf) |
&& preg_match('/^File-backed pages:\s+(\S+)/m', $pstat, $fileb_buf)) { |
// OS X 10.9 or never |
$this->sys->setMemFree($free_buf[1] * 4 * 1024); |
$this->sys->setMemApplication(($anon_buf[1]+$wire_buf[1]) * 4 * 1024); |
$this->sys->setMemCache($fileb_buf[1] * 4 * 1024); |
if (preg_match('/^Pages occupied by compressor:\s+(\S+)/m', $pstat, $compr_buf)) { |
$this->sys->setMemBuffer($compr_buf[1] * 4 * 1024); |
} |
} else { |
if (preg_match('/^Pages speculative:\s+(\S+)/m', $pstat, $spec_buf)) { |
$this->sys->setMemFree(($free_buf[1]+$spec_buf[1]) * 4 * 1024); |
} else { |
$this->sys->setMemFree($free_buf[1] * 4 * 1024); |
} |
} else { |
if (preg_match('/^Pages speculative:\s+(\S+)/m', $pstat, $spec_buf)) { |
$this->sys->setMemFree(($free_buf[1]+$spec_buf[1]) * 4 * 1024); |
} else { |
$this->sys->setMemFree($free_buf[1] * 4 * 1024); |
} |
$appMemory = 0; |
if (preg_match('/^Pages wired down:\s+(\S+)/m', $pstat, $wire_buf)) { |
$appMemory += $wire_buf[1] * 4 * 1024; |
} |
if (preg_match('/^Pages active:\s+(\S+)/m', $pstat, $active_buf)) { |
$appMemory += $active_buf[1] * 4 * 1024; |
} |
$this->sys->setMemApplication($appMemory); |
$appMemory = 0; |
if (preg_match('/^Pages wired down:\s+(\S+)/m', $pstat, $wire_buf)) { |
$appMemory += $wire_buf[1] * 4 * 1024; |
} |
if (preg_match('/^Pages active:\s+(\S+)/m', $pstat, $active_buf)) { |
$appMemory += $active_buf[1] * 4 * 1024; |
} |
$this->sys->setMemApplication($appMemory); |
if (preg_match('/^Pages inactive:\s+(\S+)/m', $pstat, $inactive_buf)) { |
$this->sys->setMemCache($inactive_buf[1] * 4 * 1024); |
if (preg_match('/^Pages inactive:\s+(\S+)/m', $pstat, $inactive_buf)) { |
$this->sys->setMemCache($inactive_buf[1] * 4 * 1024); |
} |
} |
} else { |
$lines = preg_split("/\n/", $pstat, -1, PREG_SPLIT_NO_EMPTY); |
$ar_buf = preg_split("/\s+/", $lines[1], 19); |
$this->sys->setMemFree($ar_buf[2] * 4 * 1024); |
} |
} else { |
$lines = preg_split("/\n/", $pstat, -1, PREG_SPLIT_NO_EMPTY); |
$ar_buf = preg_split("/\s+/", $lines[1], 19); |
$this->sys->setMemFree($ar_buf[2] * 4 * 1024); |
$this->sys->setMemUsed($this->sys->getMemTotal() - $this->sys->getMemFree()); |
} |
$this->sys->setMemTotal($s); |
$this->sys->setMemUsed($this->sys->getMemTotal() - $this->sys->getMemFree()); |
if (CommonFunctions::executeProgram('sysctl', 'vm.swapusage | colrm 1 22', $swapBuff, PSI_DEBUG)) { |
$swap1 = preg_split('/M/', $swapBuff); |
$swap2 = preg_split('/=/', $swap1[1]); |
$swap3 = preg_split('/=/', $swap1[2]); |
if (($swap=trim($swap1[0])) > 0) { |
if (($swap = $this->grabkey("vm.swapusage")) > 0) { |
$swap0 = preg_split('/M/', $swapBuff); |
$swap1 = preg_split('/=/', $swap0[0]); |
$swap2 = preg_split('/=/', $swap0[1]); |
$swap3 = preg_split('/=/', $swap0[2]); |
if (($swap=str_replace(',', '.', trim($swap1[1]))) > 0) { |
$dev = new DiskDevice(); |
$dev->setName('SWAP'); |
$dev->setMountPoint('SWAP'); |
$dev->setFsType('swap'); |
$dev->setTotal($swap * 1024 * 1024); |
$dev->setUsed(trim($swap2[1]) * 1024 * 1024); |
$dev->setFree(trim($swap3[1]) * 1024 * 1024); |
$dev->setUsed(str_replace(',', '.', trim($swap2[1])) * 1024 * 1024); |
$dev->setFree(str_replace(',', '.', trim($swap3[1])) * 1024 * 1024); |
$this->sys->setSwapDevices($dev); |
} |
} |
417,7 → 418,7 |
} |
if (isset($distro_arr['System Version'])) { |
$distro = $distro_arr['System Version']; |
if (preg_match('/^Mac OS|^OS X|^macOS/', $distro)) { |
if (preg_match('/^Mac OS |^OS X |^macOS |^iPhone OS |^Mac OS$|^OS X$|^macOS$|^iPhone OS$/', $distro)) { |
$this->sys->setDistributionIcon('Apple.png'); |
if (preg_match('/(^Mac OS X Server|^Mac OS X|^OS X Server|^OS X|^macOS Server|^macOS) ((\d+)\.\d+)/', $distro, $ver) |
&& ($list = @parse_ini_file(PSI_APP_ROOT."/data/osnames.ini", true))) { |
/web/acc/phpsysinfo/includes/os/class.FreeBSD.inc.php |
---|
127,6 → 127,9 |
} elseif (preg_match('/^FreeNAS/i', $version)) { // FreeNAS detection |
$this->sys->setDistribution($version); |
$this->sys->setDistributionIcon('FreeNAS.png'); |
} elseif (preg_match('/^TrueNAS/i', $version)) { // TrueNAS detection |
$this->sys->setDistribution($version); |
$this->sys->setDistributionIcon('TrueNAS.png'); |
} else { |
$this->sys->setDistributionIcon('FreeBSD.png'); |
} |
/web/acc/phpsysinfo/includes/os/class.GNU.inc.php |
---|
0,0 → 1,118 |
<?php |
/** |
* GNU Class |
* |
* PHP version 5 |
* |
* @category PHP |
* @package PSI GNU class |
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net> |
* @copyright 2012 phpSysInfo |
* @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.GNU.inc.php 687 2012-09-06 20:54:49Z namiltd $ |
* @link http://phpsysinfo.sourceforge.net |
*/ |
/** |
* GNU sysinfo class |
* get all the required information from GNU |
* |
* @category PHP |
* @package PSI GNU class |
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net> |
* @copyright 2022 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 GNU extends Linux |
{ |
/** |
* Network devices |
* includes also rx/tx bytes |
* |
* @return void |
*/ |
protected function _network($bufr = null) |
{ |
if ($this->sys->getOS() == 'GNU') { |
if (CommonFunctions::executeProgram('ifconfig', '-a', $bufr, PSI_DEBUG)) { |
$lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY); |
$was = false; |
$macaddr = ""; |
$dev = null; |
foreach ($lines as $line) { |
if (preg_match("/^\/dev\/([^\s:]+)/", $line, $ar_buf) || preg_match("/^([^\s:]+)/", $line, $ar_buf)) { |
if ($was) { |
if ($macaddr != "") { |
$dev->setInfo($macaddr.($dev->getInfo()?';'.$dev->getInfo():'')); |
} |
$this->sys->setNetDevices($dev); |
} |
$macaddr = ""; |
$dev = new NetDevice(); |
$dev->setName($ar_buf[1]); |
$was = true; |
} else { |
if ($was) { |
if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS)) { |
if (preg_match('/^\s+inet address\s+(\S+)$/', $line, $ar_buf)) { |
$dev->setInfo($ar_buf[1]); |
} elseif (preg_match('/^\s+hardware addr\s+(\S+)$/', $line, $ar_buf)) { |
if (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR) { |
$macaddr = preg_replace('/:/', '-', strtoupper($ar_buf[1])); |
if ($macaddr === '00-00-00-00-00-00') { // empty |
$macaddr = ""; |
} |
} |
} |
} |
} |
} |
} |
if ($was) { |
if ($macaddr != "") { |
$dev->setInfo($macaddr.($dev->getInfo()?';'.$dev->getInfo():'')); |
} |
$this->sys->setNetDevices($dev); |
} |
} |
} else { |
parent::_network($bufr); |
} |
} |
/** |
* Number of Users |
* |
* @return void |
*/ |
protected function _users() |
{ |
if ($this->sys->getOS() == 'GNU') { |
if (CommonFunctions::executeProgram('who', '', $strBuf, PSI_DEBUG)) { |
if (strlen($strBuf) > 0) { |
$lines = preg_split('/\n/', $strBuf); |
preg_match_all('/^login\s+/m', $strBuf, $ttybuf); |
if (($who = count($lines)-count($ttybuf[0])) > 0) { |
$this->sys->setUsers($who); |
} |
} |
} |
} else { |
parent::_users(); |
} |
} |
/** |
* get the information |
* |
* @return void |
*/ |
public function build() |
{ |
if ($this->sys->getOS() == 'GNU') { |
$this->error->addWarning("The GNU Hurd version of phpSysInfo is a work in progress, some things currently don't work"); |
} |
parent::build(); |
} |
} |
/web/acc/phpsysinfo/includes/os/class.Linux.inc.php |
---|
34,7 → 34,7 |
/** |
* Assoc array of all CPUs loads. |
*/ |
private $_cpu_loads = null; |
protected $_cpu_loads = null; |
/** |
* Version string. |
196,7 → 196,7 |
$this->_machine_info['machine'] = trim(preg_replace("/^\/,?/", "", preg_replace("/ ?(To be filled by O\.E\.M\.|System manufacturer|System Product Name|Not Specified|Default string) ?/i", "", $this->_machine_info['machine']))); |
} |
if (defined('PSI_SHOW_VIRTUALIZER_INFO') && PSI_SHOW_VIRTUALIZER_INFO && ($this->system_detect_virt === null) && count($vendor_array)>0) { |
if (defined('PSI_SHOW_VIRTUALIZER_INFO') && PSI_SHOW_VIRTUALIZER_INFO && ($this->system_detect_virt === null) && count($vendor_array) > 0) { |
$virt = CommonFunctions::decodevirtualizer($vendor_array); |
if ($virt !== null) { |
$this->_machine_info['hypervisor'] = $virt; |
216,20 → 216,29 |
{ |
if ($this->_kernel_string === null) { |
$this->_kernel_string = ""; |
if (CommonFunctions::executeProgram($uname="uptrack-uname", '-r', $strBuf, false) || // show effective kernel if ksplice uptrack is installed |
CommonFunctions::executeProgram($uname="uname", '-r', $strBuf, PSI_DEBUG)) { |
if ($this->sys->getOS() == 'SSH') { |
if (CommonFunctions::executeProgram('uname', '-s', $strBuf, false) && ($strBuf !== '')) { |
$this->sys->setOS($strBuf); |
} else { |
return $this->_kernel_string; |
} |
} |
if ((CommonFunctions::executeProgram($uname="uptrack-uname", '-r', $strBuf, false) && ($strBuf !== '')) || // show effective kernel if ksplice uptrack is installed |
(CommonFunctions::executeProgram($uname="uname", '-r', $strBuf, PSI_DEBUG) && ($strBuf !== ''))) { |
$this->_kernel_string = $strBuf; |
if (CommonFunctions::executeProgram($uname, '-v', $strBuf, PSI_DEBUG)) { |
if (CommonFunctions::executeProgram($uname, '-v', $strBuf, PSI_DEBUG) && ($strBuf !== '')) { |
if (preg_match('/ SMP /', $strBuf)) { |
$this->_kernel_string .= ' (SMP)'; |
} |
} |
if (CommonFunctions::executeProgram($uname, '-m', $strBuf, PSI_DEBUG)) { |
if (CommonFunctions::executeProgram($uname, '-m', $strBuf, PSI_DEBUG) && ($strBuf !== '')) { |
$this->_kernel_string .= ' '.$strBuf; |
} |
} elseif (CommonFunctions::rfts('/proc/version', $strBuf, 1)) { |
if (preg_match('/version\s+(\S+)/', $strBuf, $ar_buf)) { |
if (preg_match('/\/Hurd-([^\)]+)/', $strBuf, $ar_buf)) { |
$this->_kernel_string = $ar_buf[1]; |
} elseif (preg_match('/version\s+(\S+)/', $strBuf, $ar_buf)) { |
$this->_kernel_string = $ar_buf[1]; |
if (preg_match('/ SMP /', $strBuf)) { |
$this->_kernel_string .= ' (SMP)'; |
} |
241,11 → 250,20 |
} |
/** |
* check OS type |
*/ |
public function __construct($blockname = false) |
{ |
parent::__construct($blockname); |
$this->_get_kernel_string(); |
} |
/** |
* Machine |
* |
* @return void |
*/ |
private function _machine() |
protected function _machine() |
{ |
$machine_info = $this->_get_machine_info(); |
if (isset($machine_info['machine'])) { |
279,7 → 297,7 |
*/ |
protected function _hostname() |
{ |
if (PSI_USE_VHOST) { |
if (PSI_USE_VHOST && !defined('PSI_EMU_PORT')) { |
if (CommonFunctions::readenv('SERVER_NAME', $hnm)) $this->sys->setHostname($hnm); |
} else { |
if (CommonFunctions::rfts('/proc/sys/kernel/hostname', $result, 1, 4096, PSI_DEBUG && (PSI_OS != 'Android'))) { |
299,7 → 317,7 |
* |
* @return void |
*/ |
private function _kernel() |
protected function _kernel() |
{ |
if (($verBuf = $this->_get_kernel_string()) != "") { |
$this->sys->setKernel($verBuf); |
334,14 → 352,14 |
$novm = true; |
// code based on src/basic/virt.c from systemd-detect-virt source code (https://github.com/systemd/systemd) |
// First, try to detect Oracle Virtualbox and Amazon EC2 Nitro, even if they use KVM, as well as Xen even if |
// it cloaks as Microsoft Hyper-V. Attempt to detect uml at this stage also since it runs as a user-process |
// nested inside other VMs. Also check for Xen now, because Xen PV mode does not override CPUID when nested |
// inside another hypervisor. |
// First, try to detect Oracle Virtualbox, Amazon EC2 Nitro and Parallels, even if they use KVM, |
// as well as Xen even if it cloaks as Microsoft Hyper-V. Attempt to detect uml at this stage also |
// since it runs as a user-process nested inside other VMs. Also check for Xen now, because Xen PV |
// mode does not override CPUID when nested inside another hypervisor. |
$machine_info = $this->_get_machine_info(); |
if (isset($machine_info['hypervisor'])) { |
$hypervisor = $machine_info['hypervisor']; |
if (($hypervisor === 'oracle') || ($hypervisor === 'amazon') || ($hypervisor === 'xen')) { |
if (($hypervisor === 'oracle') || ($hypervisor === 'amazon') || ($hypervisor === 'xen') || ($hypervisor === 'parallels')) { |
$this->sys->setVirtualizer($hypervisor); |
$novm = false; |
} |
520,12 → 538,15 |
* |
* @return void |
*/ |
protected function _uptime() |
protected function _uptime($bufu = null) |
{ |
if (CommonFunctions::rfts('/proc/uptime', $buf, 1, 4096, PSI_OS != 'Android')) { |
$ar_buf = preg_split('/ /', $buf); |
$this->sys->setUptime(trim($ar_buf[0])); |
} elseif (($this->_uptime !== null) || CommonFunctions::executeProgram('uptime', '', $this->_uptime)) { |
} elseif (($this->_uptime !== null) || ($bufu !== null) || CommonFunctions::executeProgram('uptime', '', $bufu)) { |
if (($this->_uptime === null) && ($bufu !== null)) { |
$this->_uptime = $bufu; |
} |
if (preg_match("/up (\d+) day[s]?,[ ]+(\d+):(\d+),/", $this->_uptime, $ar_buf)) { |
$min = $ar_buf[3]; |
$hours = $ar_buf[2]; |
539,9 → 560,19 |
$min = $ar_buf[2]; |
$hours = $ar_buf[1]; |
$this->sys->setUptime($hours * 3600 + $min * 60); |
} elseif (preg_match("/up[ ]+(\d+):(\d+):(\d+)/", $this->_uptime, $ar_buf)) { |
$sec = $ar_buf[3]; |
$min = $ar_buf[2]; |
$hours = $ar_buf[1]; |
$this->sys->setUptime($hours * 3600 + $min * 60 + $sec); |
} elseif (preg_match("/up[ ]+(\d+) min,/", $this->_uptime, $ar_buf)) { |
$min = $ar_buf[1]; |
$this->sys->setUptime($min * 60); |
} elseif (preg_match("/up[ ]+(\d+) day[s]?,[ ]+(\d+) hour[s]?,[ ]+(\d+) minute[s]?/", $this->_uptime, $ar_buf)) { |
$min = $ar_buf[3]; |
$hours = $ar_buf[2]; |
$days = $ar_buf[1]; |
$this->sys->setUptime($days * 86400 + $hours * 3600 + $min * 60); |
} |
} |
} |
552,15 → 583,15 |
* |
* @return void |
*/ |
protected function _loadavg() |
protected function _loadavg($buf = null) |
{ |
if (CommonFunctions::rfts('/proc/loadavg', $buf, 1, 4096, PSI_OS != 'Android')) { |
if ((($buf !== null) || CommonFunctions::rfts('/proc/loadavg', $buf, 1, 4096, PSI_OS != 'Android')) && preg_match("/^\d/", trim($buf))) { |
$result = preg_split("/\s/", $buf, 4); |
// don't need the extra values, only first three |
unset($result[3]); |
$this->sys->setLoad(implode(' ', $result)); |
} elseif ((($this->_uptime !== null) || CommonFunctions::executeProgram('uptime', '', $this->_uptime)) && preg_match("/load average: (.*), (.*), (.*)$/", $this->_uptime, $ar_buf)) { |
$this->sys->setLoad($ar_buf[1].' '.$ar_buf[2].' '.$ar_buf[3]); |
} elseif (($buf === null) && ((($this->_uptime !== null) || CommonFunctions::executeProgram('uptime', '', $this->_uptime)) && preg_match("/load average: (.*), (.*), (.*)$/", $this->_uptime, $ar_buf))) { |
$this->sys->setLoad($ar_buf[1].' '.$ar_buf[2].' '.$ar_buf[3]); |
} |
if (PSI_LOAD_BAR) { |
$this->sys->setLoadPercent($this->_parseProcStat('cpu')); |
641,10 → 672,9 |
* |
* @return void |
*/ |
protected function _cpuinfo() |
protected function _cpuinfo($bufr = null) |
{ |
if (CommonFunctions::rfts('/proc/cpuinfo', $bufr)) { |
if (($bufr !== null) || CommonFunctions::rfts('/proc/cpuinfo', $bufr)) { |
$cpulist = null; |
$raslist = null; |
703,11 → 733,15 |
case 'cpu frequency': |
if (preg_match('/^(\d+)\s+Hz/i', $arrBuff1, $bufr2)) { |
$_cpus = round($bufr2[1]/1000000); |
} elseif (preg_match('/^(\d+)\s+MHz/i', $arrBuff1, $bufr2)) { |
$_cpus = $bufr2[1]; |
} |
break; |
case 'system bus frequency': |
if (preg_match('/^(\d+)\s+Hz/i', $arrBuff1, $bufr2)) { |
$_buss = round($bufr2[1]/1000000); |
} elseif (preg_match('/^(\d+)\s+MHz/i', $arrBuff1, $bufr2)) { |
$_buss = $bufr2[1]; |
} |
break; |
case 'bogomips per cpu': |
741,7 → 775,7 |
case 'processor': |
$proc = $arrBuff1; |
if (is_numeric($proc)) { |
if (($procname !== null) && (strlen($procname)>0)) { |
if (($procname !== null) && (strlen($procname) > 0)) { |
$dev->setModel($procname); |
} |
} else { |
755,25 → 789,40 |
case 'cpu': |
$dev->setModel($arrBuff1); |
break; |
case 'cpu frequency': |
if (preg_match('/^(\d+)\s+Hz/i', $arrBuff1, $bufr2)) { |
if (($tmpsp = round($bufr2[1]/1000000)) > 0) { |
$dev->setCpuSpeed($tmpsp); |
$speedset = true; |
} |
} elseif (preg_match('/^(\d+)\s+MHz/i', $arrBuff1, $bufr2)) { |
if ($bufr2[1] > 0) { |
$dev->setCpuSpeed($bufr2[1]); |
$speedset = true; |
} |
} |
break; |
case 'cpu mhz': |
case 'clock': |
if ($arrBuff1 > 0) { // openSUSE fix |
if ($arrBuff1 > 0) { |
$dev->setCpuSpeed($arrBuff1); |
$speedset = true; |
} |
break; |
case 'cpu mhz static': |
if ($arrBuff1 > 0) { // openSUSE fix |
$dev->setCpuSpeedMax($arrBuff1); |
} |
$dev->setCpuSpeedMax($arrBuff1); |
break; |
case 'cycle frequency [hz]': |
$dev->setCpuSpeed($arrBuff1 / 1000000); |
$speedset = true; |
if (($tmpsp = round($arrBuff1/1000000)) > 0) { |
$dev->setCpuSpeed($tmpsp); |
$speedset = true; |
} |
break; |
case 'cpu0clktck': |
$dev->setCpuSpeed(hexdec($arrBuff1) / 1000000); // Linux sparc64 |
$speedset = true; |
case 'cpu0clktck': // Linux sparc64 |
if (($tmpsp = round(hexdec($arrBuff1)/1000000)) > 0) { |
$dev->setCpuSpeed($tmpsp); |
$speedset = true; |
} |
break; |
case 'l3 cache': |
case 'cache size': |
845,8 → 894,8 |
// sparc64 specific code ends |
// XScale detection code |
if (($arch === "5TE") && ($dev->getBogomips() !== null)) { |
$dev->setCpuSpeed($dev->getBogomips()); // BogoMIPS are not BogoMIPS on this CPU, it's the speed |
if (($arch === "5TE") && (($bogo = $dev->getBogomips()) !== null) && ($bogo > 0)) { |
$dev->setCpuSpeed($bogo); // BogoMIPS are not BogoMIPS on this CPU, it's the speed |
$speedset = true; |
$dev->setBogomips(null); // no BogoMIPS available, unset previously set BogoMIPS |
} |
854,7 → 903,7 |
if (($dev->getBusSpeed() == 0) && ($_buss !== null)) { |
$dev->setBusSpeed($_buss); |
} |
if (($dev->getCpuSpeed() == 0) && ($_cpus !== null)) { |
if (($dev->getCpuSpeed() == 0) && ($_cpus !== null) && ($_cpus > 0)) { |
$dev->setCpuSpeed($_cpus); |
$speedset = true; |
} |
873,18 → 922,20 |
$proc = 0; |
} |
// variable speed processors specific code follows |
if (CommonFunctions::rfts('/sys/devices/system/cpu/cpu'.$proc.'/cpufreq/cpuinfo_cur_freq', $buf, 1, 4096, false)) { |
$dev->setCpuSpeed(trim($buf) / 1000); |
$speedset = true; |
} elseif (CommonFunctions::rfts('/sys/devices/system/cpu/cpu'.$proc.'/cpufreq/scaling_cur_freq', $buf, 1, 4096, false)) { |
$dev->setCpuSpeed(trim($buf) / 1000); |
$speedset = true; |
if (CommonFunctions::rfts('/sys/devices/system/cpu/cpu'.$proc.'/cpufreq/cpuinfo_cur_freq', $buf, 1, 4096, false) |
|| CommonFunctions::rfts('/sys/devices/system/cpu/cpu'.$proc.'/cpufreq/scaling_cur_freq', $buf, 1, 4096, false)) { |
if (round(trim($buf)/1000) > 0) { |
$dev->setCpuSpeed(round(trim($buf)/1000)); |
$speedset = true; |
} |
} |
if (CommonFunctions::rfts('/sys/devices/system/cpu/cpu'.$proc.'/cpufreq/cpuinfo_max_freq', $buf, 1, 4096, false)) { |
$dev->setCpuSpeedMax(trim($buf) / 1000); |
if (CommonFunctions::rfts('/sys/devices/system/cpu/cpu'.$proc.'/cpufreq/cpuinfo_max_freq', $buf, 1, 4096, false) |
|| CommonFunctions::rfts('/sys/devices/system/cpu/cpu'.$proc.'/cpufreq/scaling_max_freq', $buf, 1, 4096, false)) { |
$dev->setCpuSpeedMax(round(trim($buf)/1000)); |
} |
if (CommonFunctions::rfts('/sys/devices/system/cpu/cpu'.$proc.'/cpufreq/cpuinfo_min_freq', $buf, 1, 4096, false)) { |
$dev->setCpuSpeedMin(trim($buf) / 1000); |
if (CommonFunctions::rfts('/sys/devices/system/cpu/cpu'.$proc.'/cpufreq/cpuinfo_min_freq', $buf, 1, 4096, false) |
|| CommonFunctions::rfts('/sys/devices/system/cpu/cpu'.$proc.'/cpufreq/scaling_min_freq', $buf, 1, 4096, false)) { |
$dev->setCpuSpeedMin(round(trim($buf)/1000)); |
} |
// variable speed processors specific code ends |
if (PSI_LOAD_BAR) { |
901,9 → 952,15 |
&& (($_hard === 'BCM2708') || ($_hard === 'BCM2835') || ($_hard === 'BCM2709') || ($_hard === 'BCM2836') || ($_hard === 'BCM2710') || ($_hard === 'BCM2837') || ($_hard === 'BCM2711') || ($_hard === 'BCM2838')) |
&& ($_revi !== null)) { // Raspberry Pi detection (instead of 'cat /proc/device-tree/model') |
if ($raslist === null) $raslist = @parse_ini_file(PSI_APP_ROOT."/data/raspberry.ini", true); |
$oldmach = $this->sys->getMachine(); |
if (($oldmach !== '') && preg_match("/^raspberrypi rpi(,.+)/", $oldmach, $machbuf)) { |
$oldmachend = $machbuf[1]; |
} else { |
$oldmachend = ''; |
} |
if ($raslist && !preg_match('/[^0-9a-f]/', $_revi)) { |
if (($revidec = hexdec($_revi)) & 0x800000) { |
if ($this->sys->getMachine() === '') { |
if (($oldmach === '') || ($oldmachend !== '')) { |
$manufacturer = ($revidec >> 16) & 15; |
if (isset($raslist['manufacturer'][$manufacturer])) { |
$manuf = ' '.$raslist['manufacturer'][$manufacturer]; |
912,17 → 969,17 |
} |
$model = ($revidec >> 4) & 255; |
if (isset($raslist['model'][$model])) { |
$this->sys->setMachine('Raspberry Pi '.$raslist['model'][$model].' (PCB 1.'.($revidec & 15).$manuf.')'); |
$this->sys->setMachine('Raspberry Pi '.$raslist['model'][$model].' (PCB 1.'.($revidec & 15).$manuf.')'.$oldmachend); |
} else { |
$this->sys->setMachine('Raspberry Pi (PCB 1.'.($revidec & 15).$manuf.')'); |
$this->sys->setMachine('Raspberry Pi (PCB 1.'.($revidec & 15).$manuf.')'.$oldmachend); |
} |
} |
} else { |
if ($this->sys->getMachine() === '') { |
if (($oldmach === '') || ($oldmachend !== '')) { |
if (isset($raslist['old'][$revidec & 0x7fffff])) { |
$this->sys->setMachine('Raspberry Pi '.$raslist['old'][$revidec & 0x7fffff]); |
$this->sys->setMachine('Raspberry Pi '.$raslist['old'][$revidec & 0x7fffff].$oldmachend); |
} else { |
$this->sys->setMachine('Raspberry Pi'); |
$this->sys->setMachine('Raspberry Pi'.$oldmachend); |
} |
} |
} |
1119,52 → 1176,54 |
* |
* @return void |
*/ |
protected function _usb() |
protected function _usb($bufu = null) |
{ |
$usbarray = array(); |
if (CommonFunctions::executeProgram('lsusb', (PSI_OS != 'Android')?'':'2>/dev/null', $bufr, PSI_DEBUG && (PSI_OS != 'Android'), 5) && ($bufr !== "")) { |
$bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY); |
foreach ($bufe as $buf) { |
$device = preg_split("/ /", $buf, 7); |
if (((isset($device[6]) && trim($device[6]) != "")) || |
((isset($device[5]) && trim($device[5]) != ""))) { |
$usbid = intval($device[1]).'-'.intval(trim($device[3], ':')).' '.$device[5]; |
if ((isset($device[6]) && trim($device[6]) != "")) { |
$usbarray[$usbid]['name'] = trim($device[6]); |
} else { |
$usbarray[$usbid]['name'] = 'unknown'; |
if ($nobufu = ($bufu === null)) { |
if (CommonFunctions::executeProgram('lsusb', (PSI_OS != 'Android')?'':'2>/dev/null', $bufr, PSI_DEBUG && (PSI_OS != 'Android'), 5) && ($bufr !== "")) { |
$bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY); |
foreach ($bufe as $buf) { |
$device = preg_split("/ /", $buf, 7); |
if (((isset($device[6]) && trim($device[6]) != "")) || |
((isset($device[5]) && trim($device[5]) != ""))) { |
$usbid = intval($device[1]).'-'.intval(trim($device[3], ':')).' '.$device[5]; |
if ((isset($device[6]) && trim($device[6]) != "")) { |
$usbarray[$usbid]['name'] = trim($device[6]); |
} else { |
$usbarray[$usbid]['name'] = 'unknown'; |
} |
} |
} |
} |
} |
$usbdevices = CommonFunctions::findglob('/sys/bus/usb/devices/*/idProduct', GLOB_NOSORT); |
if (is_array($usbdevices) && (($total = count($usbdevices)) > 0)) { |
for ($i = 0; $i < $total; $i++) { |
if (CommonFunctions::rfts($usbdevices[$i], $idproduct, 1, 4096, false) && (($idproduct=trim($idproduct)) != "")) { // is readable |
$busnum = CommonFunctions::rolv($usbdevices[$i], '/\/idProduct$/', '/busnum'); |
$devnum = CommonFunctions::rolv($usbdevices[$i], '/\/idProduct$/', '/devnum'); |
$idvendor = CommonFunctions::rolv($usbdevices[$i], '/\/idProduct$/', '/idVendor'); |
if (($busnum!==null) && ($devnum!==null) && ($idvendor!==null)) { |
$usbid = intval($busnum).'-'.intval($devnum).' '.$idvendor.':'.$idproduct; |
$manufacturer = CommonFunctions::rolv($usbdevices[$i], '/\/idProduct$/', '/manufacturer'); |
if ($manufacturer!==null) { |
$usbarray[$usbid]['manufacturer'] = $manufacturer; |
} |
$product = CommonFunctions::rolv($usbdevices[$i], '/\/idProduct$/', '/product'); |
if ($product!==null) { |
$usbarray[$usbid]['product'] = $product; |
} |
$speed = CommonFunctions::rolv($usbdevices[$i], '/\/idProduct$/', '/speed'); |
if ($product!==null) { |
$usbarray[$usbid]['speed'] = $speed; |
} |
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS |
&& defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) { |
$serial = CommonFunctions::rolv($usbdevices[$i], '/\/idProduct$/', '/serial'); |
if (($serial!==null) && !preg_match('/\W/', $serial)) { |
$usbarray[$usbid]['serial'] = $serial; |
$usbdevices = CommonFunctions::findglob('/sys/bus/usb/devices/*/idProduct', GLOB_NOSORT); |
if (is_array($usbdevices) && (($total = count($usbdevices)) > 0)) { |
for ($i = 0; $i < $total; $i++) { |
if (CommonFunctions::rfts($usbdevices[$i], $idproduct, 1, 4096, false) && (($idproduct=trim($idproduct)) != "")) { // is readable |
$busnum = CommonFunctions::rolv($usbdevices[$i], '/\/idProduct$/', '/busnum'); |
$devnum = CommonFunctions::rolv($usbdevices[$i], '/\/idProduct$/', '/devnum'); |
$idvendor = CommonFunctions::rolv($usbdevices[$i], '/\/idProduct$/', '/idVendor'); |
if (($busnum!==null) && ($devnum!==null) && ($idvendor!==null)) { |
$usbid = intval($busnum).'-'.intval($devnum).' '.$idvendor.':'.$idproduct; |
$manufacturer = CommonFunctions::rolv($usbdevices[$i], '/\/idProduct$/', '/manufacturer'); |
if ($manufacturer!==null) { |
$usbarray[$usbid]['manufacturer'] = $manufacturer; |
} |
$product = CommonFunctions::rolv($usbdevices[$i], '/\/idProduct$/', '/product'); |
if ($product!==null) { |
$usbarray[$usbid]['product'] = $product; |
} |
$speed = CommonFunctions::rolv($usbdevices[$i], '/\/idProduct$/', '/speed'); |
if ($product!==null) { |
$usbarray[$usbid]['speed'] = $speed; |
} |
if (defined('PSI_SHOW_DEVICES_INFOS') && PSI_SHOW_DEVICES_INFOS |
&& defined('PSI_SHOW_DEVICES_SERIAL') && PSI_SHOW_DEVICES_SERIAL) { |
$serial = CommonFunctions::rolv($usbdevices[$i], '/\/idProduct$/', '/serial'); |
if (($serial!==null) && !preg_match('/\W/', $serial)) { |
$usbarray[$usbid]['serial'] = $serial; |
} |
} |
} |
} |
} |
1171,9 → 1230,9 |
} |
} |
if ((count($usbarray) == 0) && CommonFunctions::rfts('/proc/bus/usb/devices', $bufr, 0, 4096, false)) { // usb-devices |
if (!$nobufu || ((count($usbarray) == 0) && CommonFunctions::rfts('/proc/bus/usb/devices', $bufu, 0, 4096, false))) { // usb-devices |
$devnum = -1; |
$bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY); |
$bufe = preg_split("/\n/", $bufu, -1, PREG_SPLIT_NO_EMPTY); |
foreach ($bufe as $buf) { |
if (preg_match('/^T/', $buf)) { |
$devnum++; |
1202,7 → 1261,7 |
} |
} |
if ((count($usbarray) == 0) && CommonFunctions::rfts('/proc/bus/input/devices', $bufr, 0, 4096, false)) { |
if ($nobufu && (count($usbarray) == 0) && CommonFunctions::rfts('/proc/bus/input/devices', $bufr, 0, 4096, false)) { |
$devnam = "unknown"; |
$bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY); |
foreach ($bufe as $buf) { |
1375,9 → 1434,9 |
* |
* @return void |
*/ |
protected function _network() |
protected function _network($bufr = null) |
{ |
if (CommonFunctions::rfts('/proc/net/dev', $bufr, 0, 4096, PSI_DEBUG)) { |
if (($bufr === null) && CommonFunctions::rfts('/proc/net/dev', $bufr, 0, 4096, PSI_DEBUG)) { |
$bufe = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY); |
foreach ($bufe as $buf) { |
if (preg_match('/:/', $buf)) { |
1420,7 → 1479,8 |
|| preg_match('/^'.trim($dev_name).':\s+ip\s+(\S+)\s+mask/i', $buf2, $ar_buf2) |
|| preg_match('/^\s+inet6\saddr:\s([^\/\s]+)(.+)\s+Scope:[GH]/i', $buf2, $ar_buf2) |
|| preg_match('/^\s+inet6\s+(\S+)\s+prefixlen(.+)((<global>)|(<host>))/i', $buf2, $ar_buf2) |
|| preg_match('/^\s+inet6?\s+([^\/\s]+).*\s+scope\s((global)|(host))/i', $buf2, $ar_buf2)) |
|| preg_match('/^\s+inet6?\s+([^\/\s]+).*\s+scope\s((global)|(host))/i', $buf2, $ar_buf2) |
|| preg_match('/^\s+inet\saddr6:\s+(\S+)\s+prefixlen(.+)/i', $buf2, $ar_buf2)) |
&& ($ar_buf2[1]!="::") && !preg_match('/^fe80::/i', $ar_buf2[1])) { |
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').strtolower($ar_buf2[1])); |
} |
1447,7 → 1507,7 |
$this->sys->setNetDevices($dev); |
} |
} |
} elseif (CommonFunctions::executeProgram('ip', 'addr show', $bufr, PSI_DEBUG) && ($bufr!="")) { |
} elseif (($bufr === null) && CommonFunctions::executeProgram('ip', 'addr show', $bufr, PSI_DEBUG) && ($bufr!="")) { |
$lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY); |
$was = false; |
$macaddr = ""; |
1526,7 → 1586,7 |
} |
$this->sys->setNetDevices($dev); |
} |
} elseif (CommonFunctions::executeProgram('ifconfig', '-a', $bufr, PSI_DEBUG)) { |
} elseif (($bufr !== null) || CommonFunctions::executeProgram('ifconfig', '-a', $bufr, PSI_DEBUG)) { |
$lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY); |
$was = false; |
$errors = 0; |
1617,7 → 1677,8 |
} elseif ((preg_match('/^\s+inet\saddr:(\S+)/i', $line, $ar_buf2) |
|| preg_match('/^\s+inet\s+(\S+)\s+netmask/i', $line, $ar_buf2) |
|| preg_match('/^\s+inet6\saddr:\s([^\/\s]+)(.+)\s+Scope:[GH]/i', $line, $ar_buf2) |
|| preg_match('/^\s+inet6\s+(\S+)\s+prefixlen(.+)((<global>)|(<host>))/i', $line, $ar_buf2)) |
|| preg_match('/^\s+inet6\s+(\S+)\s+prefixlen(.+)((<global>)|(<host>))/i', $line, $ar_buf2) |
|| preg_match('/^\s+inet\saddr6:\s+(\S+)\s+prefixlen(.+)/i', $line, $ar_buf2)) |
&& ($ar_buf2[1]!="::") && !preg_match('/^fe80::/i', $ar_buf2[1])) { |
$dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').strtolower($ar_buf2[1])); |
} |
1644,9 → 1705,9 |
* |
* @return void |
*/ |
protected function _memory() |
protected function _memory($mbuf = null, $sbuf = null) |
{ |
if (CommonFunctions::rfts('/proc/meminfo', $mbuf)) { |
if (($mbuf !== null) || CommonFunctions::rfts('/proc/meminfo', $mbuf)) { |
$swaptotal = null; |
$swapfree = null; |
$bufe = preg_split("/\n/", $mbuf, -1, PREG_SPLIT_NO_EMPTY); |
1670,7 → 1731,7 |
if (($this->sys->getMemCache() !== null) && ($this->sys->getMemBuffer() !== null)) { |
$this->sys->setMemApplication($this->sys->getMemUsed() - $this->sys->getMemCache() - $this->sys->getMemBuffer()); |
} |
if (CommonFunctions::rfts('/proc/swaps', $sbuf, 0, 4096, false)) { |
if (($sbuf !== null) || CommonFunctions::rfts('/proc/swaps', $sbuf, 0, 4096, false)) { |
$swaps = preg_split("/\n/", $sbuf, -1, PREG_SPLIT_NO_EMPTY); |
unset($swaps[0]); |
foreach ($swaps as $swap) { |
1699,7 → 1760,7 |
* |
* @return void |
*/ |
private function _filesystems() |
protected function _filesystems() |
{ |
$df_args = ""; |
$hideFstypes = array(); |
2039,6 → 2100,26 |
$this->sys->setDistribution(trim($buf)); |
} |
} |
} elseif (CommonFunctions::fileexists($filename="/etc/slackware-version")) { |
if (!CommonFunctions::rfts($filename, $buf, 1, 4096, false)) { |
$buf = ""; |
} |
if (isset($list['Slackware']['Image'])) { |
$this->sys->setDistributionIcon($list['Slackware']['Image']); |
} |
if (isset($list['Slackware']['Name'])) { |
if (($buf === null) || (trim($buf) == "")) { |
$this->sys->setDistribution($list['Slackware']['Name']); |
} else { |
$this->sys->setDistribution($list['Slackware']['Name']." ".trim($buf)); |
} |
} else { |
if (($buf === null) || (trim($buf) == "")) { |
$this->sys->setDistribution('Slackware'); |
} else { |
$this->sys->setDistribution(trim($buf)); |
} |
} |
} elseif (CommonFunctions::fileexists($filename="/etc/config/uLinux.conf") |
&& CommonFunctions::rfts($filename, $buf, 0, 4096, false) |
&& preg_match("/^Rsync\sModel\s*=\s*QNAP/m", $buf) |
/web/acc/phpsysinfo/includes/os/class.OS.inc.php |
---|
52,6 → 52,7 |
$this->error = PSI_Error::singleton(); |
$this->sys = new System(); |
$this->blockname = $blockname; |
$this->sys->setOS(get_class($this)); |
} |
/** |
/web/acc/phpsysinfo/includes/os/class.SSH.inc.php |
---|
0,0 → 1,848 |
<?php |
/** |
* SSH Class |
* |
* PHP version 5 |
* |
* @category PHP |
* @package PSI SSH class |
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net> |
* @copyright 2012 phpSysInfo |
* @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.SSH.inc.php 687 2012-09-06 20:54:49Z namiltd $ |
* @link http://phpsysinfo.sourceforge.net |
*/ |
/** |
* SSH sysinfo class |
* get all the required information from SSH |
* |
* @category PHP |
* @package PSI SSH class |
* @author Mieczyslaw Nalewaj <namiltd@users.sourceforge.net> |
* @copyright 2022 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 SSH extends GNU |
{ |
/** |
* content of the system status |
* |
* @var string |
*/ |
private $_sysstatus = null; |
/** |
* content of the system performance status |
* |
* @var string |
*/ |
private $_sysperformance = null; |
/** |
* content of the sys ver systeminfo |
* |
* @var string |
*/ |
private $_sysversysteminfo = null; |
/** |
* content of the show status |
* |
* @var string |
*/ |
private $_showstatus = null; |
/** |
* OS type |
* |
* @var string |
*/ |
private $_ostype = null; |
/** |
* check system type |
*/ |
public function __construct($blockname = false) |
{ |
parent::__construct($blockname); |
$this->_ostype = $this->sys->getOS(); |
switch ($this->_ostype) { |
case '4.2BSD': |
case 'AIX': |
case 'Darwin': |
case 'DragonFly': |
case 'FreeBSD': |
case 'HI-UX/MPP': |
case 'Haiku': |
case 'Minix': |
case 'NetBSD': |
case 'OpenBSD': |
case 'QNX': |
case 'SunOS': |
$this->error->addError("__construct()", "OS ".$this->_ostype. " is not supported via SSH"); |
break; |
case 'GNU': |
case 'Linux': |
break; |
default: |
if ($this->getSystemStatus() !== '') { |
$this->_ostype = 'FortiOS'; |
$this->sys->setOS('Linux'); |
} elseif ($this->getSysVerSysteminfo() !== '') { |
$this->_ostype = 'DrayOS'; |
$this->sys->setOS('DrayOS'); |
} |
} |
} |
/** |
* get os specific encoding |
* |
* @see PSI_Interface_OS::getEncoding() |
* |
* @return string |
*/ |
public function getEncoding() |
{ |
// if (($this->_ostype === 'FortiOS') || ($this->_ostype === 'DrayOS') || ($this->_ostype === 'SSH')) { |
// return 'UTF-8'; |
// } |
//return null; |
} |
/** |
* get os specific language |
* |
* @see PSI_Interface_OS::getLanguage() |
* |
* @return string |
*/ |
public function getLanguage() |
{ |
//return null; |
} |
private function getSystemStatus() |
{ |
if ($this->_sysstatus === null) { |
if (CommonFunctions::executeProgram('get', 'system status', $resulte, false) && ($resulte !== "") |
&& preg_match('/^(.*[\$#]\s*)/', $resulte, $resulto, PREG_OFFSET_CAPTURE)) { |
$this->_sysstatus = substr($resulte, strlen($resulto[1][0])); |
} else { |
$this->_sysstatus = ''; |
} |
} |
return $this->_sysstatus; |
} |
private function getSystemPerformance() |
{ |
if ($this->_sysperformance === null) { |
if (CommonFunctions::executeProgram('get', 'system performance status', $resulte, false) && ($resulte !== "") |
&& preg_match('/^(.*[\$#]\s*)/', $resulte, $resulto, PREG_OFFSET_CAPTURE)) { |
$this->_sysperformance = substr($resulte, strlen($resulto[1][0])); |
} else { |
$this->_sysperformance = ''; |
} |
} |
return $this->_sysperformance; |
} |
private function getSysVerSysteminfo() |
{ |
if ($this->_sysversysteminfo === null) { |
if (CommonFunctions::executeProgram('sys', 'ver systeminfo', $resulte, false, PSI_EXEC_TIMEOUT_INT, '>') && ($resulte !== "") |
&& preg_match('/([\s\S]+> sys ver systeminfo)/', $resulte, $resulto, PREG_OFFSET_CAPTURE)) { |
$this->_sysversysteminfo = substr($resulte, strlen($resulto[1][0])); |
} else { |
$this->_sysversysteminfo = ''; |
} |
} |
return $this->_sysversysteminfo; |
} |
private function getShowStatus() |
{ |
if ($this->_showstatus === null) { |
if (CommonFunctions::executeProgram('show', 'status', $resulte, false, PSI_EXEC_TIMEOUT_INT, '>') && ($resulte !== "") |
&& preg_match('/([\s\S]+> show status)/', $resulte, $resulto, PREG_OFFSET_CAPTURE)) { |
$this->_showstatus = substr($resulte, strlen($resulto[1][0])); |
} else { |
$this->_showstatus = ''; |
} |
} |
return $this->_showstatus; |
} |
/** |
* Physical memory information and Swap Space information |
* |
* @return void |
*/ |
protected function _memory($mbuf = null, $sbuf = null) |
{ |
switch ($this->_ostype) { |
case 'FortiOS': |
if (CommonFunctions::executeProgram('get', 'hardware memory', $resulte, false) && ($resulte !== "") |
&& preg_match('/^(.*[\$#]\s*)/', $resulte, $resulto, PREG_OFFSET_CAPTURE)) { |
parent::_memory(substr($resulte, strlen($resulto[1][0]))); |
} |
break; |
case 'DrayOS': |
if (($sysstat = $this->getSysVerSysteminfo()) !== '') { |
$machine= ''; |
if (preg_match("/ Total memory usage : \d+ % \((\d+)K\/(\d+)K\)/", $sysstat, $buf)) { |
$this->sys->setMemTotal($buf[2]*1024); |
$this->sys->setMemUsed($buf[1]*1024); |
$this->sys->setMemFree(($buf[2]-$buf[1])*1024); |
} |
} |
break; |
case 'GNU': |
case 'Linux': |
if (!CommonFunctions::executeProgram('cat', '/proc/meminfo', $mbuf, false) || ($mbuf === "")) { |
$mbuf = null; |
} |
if (!CommonFunctions::executeProgram('cat', '/proc/swaps', $sbuf, false) || ($sbuf === "")) { |
$sbuf = null; |
} |
if (($mbuf !== null) || ($sbuf !== null)) { |
parent::_memory($mbuf, $sbuf); |
} |
} |
} |
/** |
* USB devices |
* |
* @return void |
*/ |
protected function _usb($bufu = null) |
{ |
switch ($this->_ostype) { |
case 'FortiOS': |
$bufr = ''; |
if (CommonFunctions::executeProgram('fnsysctl', 'cat /proc/bus/usb/devices', $resulte, false) && ($resulte !== "") |
&& preg_match('/^(.*[\$#]\s*)/', $resulte, $resulto, PREG_OFFSET_CAPTURE)) { |
$resulti = substr($resulte, strlen($resulto[1][0])); |
if (preg_match('/(\n.*[\$#])$/', $resulti, $resulto, PREG_OFFSET_CAPTURE)) { |
$bufr = substr($resulti, 0, $resulto[1][1]); |
if (count(preg_split('/\n/', $bufr, -1, PREG_SPLIT_NO_EMPTY)) >= 2) { |
parent::_usb($bufr); |
} |
} |
} |
break; |
case 'GNU': |
case 'Linux': |
parent::_usb(); |
} |
} |
/** |
* Network devices |
* includes also rx/tx bytes |
* |
* @return void |
*/ |
protected function _network($bufr = null) |
{ |
switch ($this->_ostype) { |
case 'FortiOS': |
$bufr = ''; |
if (CommonFunctions::executeProgram('fnsysctl', 'ifconfig', $resulte, false) && ($resulte !== "") |
&& preg_match('/^(.*[\$#]\s*)/', $resulte, $resulto, PREG_OFFSET_CAPTURE)) { |
$resulti = substr($resulte, strlen($resulto[1][0])); |
if (preg_match('/(\n.*[\$#])$/', $resulti, $resulto, PREG_OFFSET_CAPTURE)) { |
$bufr = substr($resulti, 0, $resulto[1][1]); |
if (count(preg_split('/\n/', $bufr, -1, PREG_SPLIT_NO_EMPTY)) < 2) { |
$bufr = ''; |
} |
} |
} |
if ($bufr !== '') { |
parent::_network($bufr); |
} else { |
$netdevs = array(); |
if (CommonFunctions::executeProgram('diagnose', 'ip address list', $resulte, false) && ($resulte !== "") |
&& preg_match('/^(.*[\$#]\s*)/', $resulte, $resulto, PREG_OFFSET_CAPTURE)) { |
$strBuf = substr($resulte, strlen($resulto[1][0])); |
$lines = preg_split('/\n/', $strBuf, -1, PREG_SPLIT_NO_EMPTY); |
foreach ($lines as $line) if (preg_match('/^IP=(\S+)->.+ devname=(\S+)$/', $line, $buf)) { |
if (!isset($netdevs[$buf[2]])) { |
$netdevs[$buf[2]] = $buf[1]; |
} else { |
$netdevs[$buf[2]] .= ';'.$buf[1]; |
} |
} |
} |
if (CommonFunctions::executeProgram('diagnose', 'ipv6 address list', $resulte, false) && ($resulte !== "") |
&& preg_match('/^(.*[\$#]\s*)/', $resulte, $resulto, PREG_OFFSET_CAPTURE)) { |
$strBuf = substr($resulte, strlen($resulto[1][0])); |
$lines = preg_split('/\n/', $strBuf, -1, PREG_SPLIT_NO_EMPTY); |
foreach ($lines as $line) if (preg_match('/ devname=(\S+) .+ addr=(\S+)/', $line, $buf)) { |
if (!preg_match('/^fe80::/i', $buf[2])) { |
if (!isset($netdevs[$buf[1]])) { |
$netdevs[$buf[1]] = $buf[2]; |
} else { |
$netdevs[$buf[1]] .= ';'.$buf[2]; |
} |
} |
} |
} |
foreach ($netdevs as $netname=>$netinfo) { |
if (!preg_match('/^vsys_/i', $netname)) { |
$dev = new NetDevice(); |
// if ($netname === 'root') { |
// $dev->setName('lo'); |
// } else { |
$dev->setName($netname); |
// } |
$this->sys->setNetDevices($dev); |
$dev->setInfo($netinfo); |
} |
} |
} |
break; |
case 'DrayOS': |
$macarray = array(); |
if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS) && (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR)) { |
if (CommonFunctions::executeProgram('sys', 'iface', $resulte, false, PSI_EXEC_TIMEOUT_INT, '>') && ($resulte !== "") |
&& preg_match('/([\s\S]+> sys iface)/', $resulte, $resulto, PREG_OFFSET_CAPTURE)) { |
$lines = preg_split("/\n/", substr($resulte, strlen($resulto[1][0])), -1, PREG_SPLIT_NO_EMPTY); |
$ipaddr = 'LAN'; |
foreach ($lines as $line) { |
if (preg_match("/^IP Address:\s+([\d\.]+)\s/", trim($line), $ar_buf)) { |
if ($ipaddr === false) { |
$ipaddr = $ar_buf[1]; |
} |
} elseif (preg_match("/^MAC:\s+([\d\-A-F]+)/", trim($line), $ar_buf)) { |
if ($ipaddr !== '0.0.0.0') { |
$macarray[$ipaddr] = $ar_buf[1]; |
} |
$ipaddr = false; |
} |
} |
} |
} |
$lantxrate = false; |
$lanrxrate = false; |
if (defined('PSI_SHOW_NETWORK_ACTIVE_SPEED') && PSI_SHOW_NETWORK_ACTIVE_SPEED) { |
if ((($bufr = $this->getShowStatus()) !== '') && preg_match('/IP Address:[\d\.]+[ ]+Tx Rate:(\d+)[ ]+Rx Rate:(\d+)/m', $bufr, $ar_buf)) { |
$lantxrate = $ar_buf[1]; |
$lanrxrate = $ar_buf[2]; |
} |
} |
$notwaslan = true; |
if (CommonFunctions::executeProgram('show', 'lan', $resulte, false, PSI_EXEC_TIMEOUT_INT, '>') && ($resulte !== "") |
&& preg_match('/([\s\S]+> show lan)/', $resulte, $resulto, PREG_OFFSET_CAPTURE)) { |
$lines = preg_split("/\n/", substr($resulte, strlen($resulto[1][0])), -1, PREG_SPLIT_NO_EMPTY); |
foreach ($lines as $line) { |
if (preg_match("/^\[V\](\S+)\s+([\d\.]+)\s/", trim($line), $ar_buf)) { |
$dev = new NetDevice(); |
$dev->setName($ar_buf[1]); |
if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS)) { |
$dev->setInfo($ar_buf[2]); |
if (isset($macarray['LAN'])) { |
$dev->setInfo($macarray['LAN'].';'.$ar_buf[2]); |
} else { |
$dev->setInfo($ar_buf[2]); |
} |
} |
if ($lantxrate !== false) { |
$dev->setTxRate($lantxrate); |
} |
if ($lanrxrate !== false) { |
$dev->setRxRate($lanrxrate); |
} |
$this->sys->setNetDevices($dev); |
if (preg_match('/^LAN/', $ar_buf[1])) { |
$notwaslan = false; |
} |
} |
} |
} |
if (($bufr = $this->getShowStatus()) !== '') { |
$lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY); |
$last = false; |
$dev = null; |
foreach ($lines as $line) { |
if (preg_match("/^(.+) Status/", trim($line), $ar_buf)) { |
if (($last !== false) && (($last !== 'LAN') || $notwaslan)) { |
$this->sys->setNetDevices($dev); |
} |
$dev = new NetDevice(); |
$last = preg_replace('/\s+/', '', $ar_buf[1]); |
$dev->setName($last); |
} else { |
if ($last !== false) { |
if (preg_match('/ IP:([\d\.]+)[ ]+GW/', $line, $ar_buf) || preg_match('/IP Address:([\d\.]+)[ ]+Tx/', $line, $ar_buf)) { |
if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS)) { |
if ($last === 'LAN') { |
if (isset($macarray['LAN'])) { |
$dev->setInfo($macarray['LAN'].';'.$ar_buf[1]); |
} |
if ($lantxrate !== false) { |
$dev->setTxRate($lantxrate); |
} |
if ($lanrxrate !== false) { |
$dev->setRxRate($lanrxrate); |
} |
} elseif (isset($macarray[$ar_buf[1]])) { |
$dev->setInfo($macarray[$ar_buf[1]].';'.$ar_buf[1]); |
} else { |
$dev->setInfo($ar_buf[1]); |
} |
} |
} elseif (preg_match('/TX Packets:\d+[ ]+TX Rate\(bps\):(\d+)[ ]+RX Packets:\d+[ ]+RX Rate\(bps\):(\d+)/', $line, $ar_buf)) { |
if (defined('PSI_SHOW_NETWORK_ACTIVE_SPEED') && PSI_SHOW_NETWORK_ACTIVE_SPEED) { |
$dev->setTxRate($ar_buf[1]); |
$dev->setRxRate($ar_buf[2]); |
} |
} |
} |
} |
} |
if (($last !== false) && (($last !== 'LAN') || $notwaslan)) { |
$this->sys->setNetDevices($dev); |
} |
} |
break; |
case 'GNU': |
case 'Linux': |
parent::_network(); |
} |
} |
/** |
* CPU information |
* All of the tags here are highly architecture dependant. |
* |
* @return void |
*/ |
protected function _cpuinfo($bufr = null) |
{ |
switch ($this->_ostype) { |
case 'FortiOS': |
if (CommonFunctions::executeProgram('get', 'hardware cpu', $resulte, false) && ($resulte !== "") |
&& preg_match('/^(.*[\$#]\s*)/', $resulte, $resulto, PREG_OFFSET_CAPTURE)) { |
parent::_cpuinfo(substr($resulte, strlen($resulto[1][0]))); |
} |
break; |
case 'DrayOS': |
if (preg_match_all("/CPU(\d+) speed:[ ]*(\d+) MHz/m", $sysinfo = $this->getSysVerSysteminfo(), $bufarr)) { |
foreach ($bufarr[1] as $index=>$nr) { |
$dev = new CpuDevice(); |
$dev->setModel('CPU'.$nr); |
$dev->setCpuSpeed($bufarr[2][$index]); |
if (PSI_LOAD_BAR) { |
$dev->setLoad($this->_parseProcStat('cpu'.$nr)); |
} |
$this->sys->setCpus($dev); |
} |
// $this->_cpu_loads['cpu'] = $buf[1]; |
// if (preg_match("/CPU1 speed/", $sysinfo)) { |
// $this->_cpu_loads['cpu0'] = $buf[1]; |
// } |
} |
break; |
case 'GNU': |
case 'Linux': |
if (CommonFunctions::executeProgram('cat', '/proc/cpuinfo', $resulte, false) && ($resulte !== "")) { |
parent::_cpuinfo($resulte); |
} |
} |
} |
/** |
* Machine |
* |
* @return void |
*/ |
protected function _machine() |
{ |
switch ($this->_ostype) { |
case 'FortiOS': |
if (($sysstat = $this->getSystemStatus()) !== '') { |
$machine= ''; |
if (preg_match("/^Version: (\S+) v/", $sysstat, $buf)) { |
$machine = $buf[1]; |
} |
if (preg_match("/\nSystem Part-Number: (\S+)\n/", $sysstat, $buf)) { |
$machine .= ' '.$buf[1]; |
} |
if (preg_match("/\nBIOS version: (\S+)\n/", $sysstat, $buf)) { |
if (trim($machine) !== '') { |
$machine .= ', BIOS '.$buf[1]; |
} else { |
$machine = 'BIOS '.$buf[1]; |
} |
} |
$machine = trim($machine); |
if ($machine !== '') { |
$this->sys->setMachine($machine); |
} |
} |
break; |
case 'DrayOS': |
if (($sysstat = $this->getSysVerSysteminfo()) !== '') { |
$machine= ''; |
if (preg_match("/[\r\n]Router Model: (\S+) /", $sysstat, $buf)) { |
$machine = $buf[1]; |
} |
if (preg_match("/[\r\n]Revision: (.+)[\r\n]/", $sysstat, $buf)) { |
$machine .= ' '.$buf[1]; |
} |
$machine = trim($machine); |
if ($machine !== '') { |
$this->sys->setMachine($machine); |
} |
} |
break; |
case 'GNU': |
case 'Linux': |
parent::_machine(); |
} |
} |
/** |
* Hostname |
* |
* @return void |
*/ |
protected function _hostname() |
{ |
switch ($this->_ostype) { |
case 'FortiOS': |
// $hostname = PSI_EMU_HOSTNAME; |
if (preg_match("/\nHostname: ([^\n]+)\n/", $this->getSystemStatus(), $buf)) { |
$this->sys->setHostname(trim($buf[1])); |
// $hostname = trim($buf[1]); |
} |
// $ip = gethostbyname($hostname); |
// if ($ip != $hostname) { |
// $this->sys->setHostname(gethostbyaddr($ip)); |
// } else { |
// $this->sys->setHostname($hostname); |
// } |
break; |
case 'DrayOS': |
if (preg_match("/[\r\n]Router Name: ([^\n\r]+)[\r\n]/", $this->getSysVerSysteminfo(), $buf)) { |
$this->sys->setHostname(trim($buf[1])); |
} |
break; |
case 'GNU': |
case 'Linux': |
parent::_hostname(); |
} |
} |
/** |
* filesystem information |
* |
* @return void |
*/ |
protected function _filesystems() |
{ |
switch ($this->_ostype) { |
case 'FortiOS': |
if (CommonFunctions::executeProgram('fnsysctl', 'df -k', $resulte, false) && ($resulte !== "") |
&& preg_match('/^(.*[\$#]\s*)/', $resulte, $resulto, PREG_OFFSET_CAPTURE)) { |
$resulti = substr($resulte, $resulto[1][1]); |
$df = preg_split("/\n/", $resulti, -1, PREG_SPLIT_NO_EMPTY); |
foreach ($df as $df_line) { |
$df_buf1 = preg_split("/(\%\s)/", $df_line, 3); |
if (count($df_buf1) != 2) { |
continue; |
} |
if (preg_match("/(.*)(\s+)(([0-9]+)(\s+)([0-9]+)(\s+)([\-0-9]+)(\s+)([0-9]+)$)/", $df_buf1[0], $df_buf2)) { |
$df_buf = array($df_buf2[1], $df_buf2[4], $df_buf2[6], $df_buf2[8], $df_buf2[10], $df_buf1[1]); |
if (count($df_buf) == 6) { |
$df_buf[5] = trim($df_buf[5]); |
$dev = new DiskDevice(); |
$dev->setName(trim($df_buf[0])); |
if ($df_buf[2] < 0) { |
$dev->setTotal($df_buf[3] * 1024); |
$dev->setUsed($df_buf[3] * 1024); |
} else { |
$dev->setTotal($df_buf[1] * 1024); |
$dev->setUsed($df_buf[2] * 1024); |
if ($df_buf[3]>0) { |
$dev->setFree($df_buf[3] * 1024); |
} |
} |
if (PSI_SHOW_MOUNT_POINT) $dev->setMountPoint($df_buf[5]); |
$dev->setFsType('unknown'); |
$this->sys->setDiskDevices($dev); |
} |
} |
} |
} |
break; |
case 'DrayOS': |
if (CommonFunctions::executeProgram('nand', 'usage', $resulte, false, PSI_EXEC_TIMEOUT_INT, '>') && ($resulte !== "") |
&& preg_match('/([\s\S]+> nand usage)/', $resulte, $resulto, PREG_OFFSET_CAPTURE)) { |
$df = substr($resulte, strlen($resulto[1][0])); |
if (preg_match('/Usecfg/', $df)) { // fix for Vigor2135ac v4.4.2 |
$df = preg_replace("/(cfg|bin)/", "\n$1", substr($resulte, strlen($resulto[1][0]))); |
$percent = ''; |
} else { |
$percent = '%'; |
} |
$df = preg_split("/\n/", $df, -1, PREG_SPLIT_NO_EMPTY); |
foreach ($df as $df_line) { |
if (preg_match("/^(\S+)[ ]+(\d+)[ ]+(\d+)[ ]+(\d+)[ ]+(\d+)".$percent."/", trim($df_line), $df_buf)) { |
$dev = new DiskDevice(); |
$dev->setName($df_buf[1]); |
$dev->setTotal($df_buf[2]); |
$dev->setUsed($df_buf[3]); |
$dev->setFree($df_buf[4]); |
$dev->setFsType('NAND'); |
$this->sys->setDiskDevices($dev); |
} |
} |
} |
break; |
case 'GNU': |
case 'Linux': |
parent::_filesystems(); |
} |
} |
/** |
* Distribution |
* |
* @return void |
*/ |
protected function _distro() |
{ |
switch ($this->_ostype) { |
case 'FortiOS': |
if (preg_match("/^Version: \S+ (v[^\n]+)\n/", $this->getSystemStatus(), $buf)) { |
$this->sys->setDistribution('FortiOS '.trim($buf[1])); |
} |
$this->sys->setDistributionIcon('FortiOS.png'); |
break; |
case 'DrayOS': |
if (preg_match("/ Version: ([^\n]+)\n/", $this->getSysVerSysteminfo(), $buf)) { |
$this->sys->setDistribution('DrayOS '.trim($buf[1])); |
} |
$this->sys->setDistributionIcon('DrayOS.png'); |
break; |
case 'GNU': |
case 'Linux': |
parent::_distro(); |
} |
// if ($this->_ostype !== null) { |
// $this->sys->setDistributionIcon($this->_ostype); |
// } |
} |
/** |
* fill the load for a individual cpu, through parsing /proc/stat for the specified cpu |
* |
* @param String $cpuline cpu for which load should be meassured |
* |
* @return int |
*/ |
protected function _parseProcStat($cpuline) |
{ |
if ($this->_cpu_loads === null) { |
$this->_cpu_loads = array(); |
switch ($this->_ostype) { |
case 'FortiOS': |
if (($strBuf = $this->getSystemPerformance()) !== '') { |
$lines = preg_split('/\n/', $strBuf, -1, PREG_SPLIT_NO_EMPTY); |
foreach ($lines as $line) if (preg_match('/^CPU(\d*) states: \d+% user \d+% system \d+% nice (\d+)% idle /', $line, $buf)) { |
$this->_cpu_loads['cpu'.$buf[1]] = 100-$buf[2]; |
} |
} |
break; |
case 'DrayOS': |
if (preg_match("/CPU usage :[ ]*(\d+) %/", $sysinfo = $this->getSysVerSysteminfo(), $buf)) { |
$this->_cpu_loads['cpu'] = $buf[1]; |
if (preg_match("/CPU1 speed/", $sysinfo) && !preg_match("/CPU2 speed/", $sysinfo)) { //only one cpu |
$this->_cpu_loads['cpu1'] = $buf[1]; |
} |
} |
} |
} |
if (isset($this->_cpu_loads[$cpuline])) { |
return $this->_cpu_loads[$cpuline]; |
} else { |
return null; |
} |
} |
/** |
* Processor Load |
* optionally create a loadbar |
* |
* @return void |
*/ |
protected function _loadavg($bufr = null) |
{ |
switch ($this->_ostype) { |
case 'FortiOS': |
if (CommonFunctions::executeProgram('fnsysctl', 'cat /proc/loadavg', $resulte, false) && ($resulte !== "") |
&& preg_match('/^(.*[\$#]\s*)/', $resulte, $resulto, PREG_OFFSET_CAPTURE)) { |
parent::_loadavg(substr($resulte, strlen($resulto[1][0]))); |
} |
break; |
case 'DrayOS': |
if (PSI_LOAD_BAR) { |
$this->sys->setLoadPercent($this->_parseProcStat('cpu')); |
} |
break; |
case 'GNU': |
case 'Linux': |
parent::_loadavg(); |
} |
} |
/** |
* UpTime |
* time the system is running |
* |
* @return void |
*/ |
protected function _uptime($bufu = null) |
{ |
switch ($this->_ostype) { |
case 'FortiOS': |
if (preg_match("/\nUptime: ([^\n]+)\n/", $this->getSystemPerformance(), $buf)) { |
parent::_uptime('up '.trim($buf[1])); |
} |
break; |
case 'DrayOS': |
if (preg_match("/System Uptime:([\d:]+)/", $this->getShowStatus(), $buf)) { |
parent::_uptime('up '.trim($buf[1])); |
} |
break; |
case 'GNU': |
case 'Linux': |
if (CommonFunctions::executeProgram('cat', '/proc/uptime', $resulte, false) && ($resulte !== "")) { |
$ar_buf = preg_split('/ /', $resulte); |
$this->sys->setUptime(trim($ar_buf[0])); |
} else { |
parent::_uptime(); |
} |
} |
} |
/** |
* Kernel Version |
* |
* @return void |
*/ |
protected function _kernel() |
{ |
switch ($this->_ostype) { |
case 'FortiOS': |
if (CommonFunctions::executeProgram('fnsysctl', 'cat /proc/version', $resulte, false) && ($resulte !== "") |
&& preg_match('/^(.*[\$#]\s*)/', $resulte, $resulto, PREG_OFFSET_CAPTURE)) { |
$strBuf = substr($resulte, $resulto[1][1]); |
if (preg_match('/version\s+(\S+)/', $strBuf, $ar_buf)) { |
$verBuf = $ar_buf[1]; |
if (preg_match('/ SMP /', $strBuf)) { |
$verBuf .= ' (SMP)'; |
} |
$this->sys->setKernel($verBuf); |
} |
} |
break; |
case 'GNU': |
case 'Linux': |
parent::_kernel(); |
} |
} |
/** |
* get the information |
* |
* @return void |
*/ |
public function build() |
{ |
$this->error->addWarning("The SSH version of phpSysInfo is a work in progress, some things currently don't work"); |
switch ($this->_ostype) { |
case 'FortiOS': |
if (!$this->blockname || $this->blockname==='vitals') { |
$this->_distro(); |
$this->_hostname(); |
$this->_kernel(); |
$this->_uptime(); |
// $this->_users(); |
$this->_loadavg(); |
// $this->_processes(); |
} |
if (!$this->blockname || $this->blockname==='hardware') { |
$this->_machine(); |
$this->_cpuinfo(); |
//$this->_virtualizer(); |
// $this->_pci(); |
$this->_usb(); |
// $this->_i2c(); |
} |
if (!$this->blockname || $this->blockname==='memory') { |
$this->_memory(); |
} |
if (!$this->blockname || $this->blockname==='filesystem') { |
$this->_filesystems(); |
} |
if (!$this->blockname || $this->blockname==='network') { |
$this->_network(); |
} |
break; |
case 'DrayOS': |
if (!$this->blockname || $this->blockname==='vitals') { |
$this->_distro(); |
$this->_hostname(); |
// $this->_kernel(); |
$this->_uptime(); |
//// $this->_users(); |
$this->_loadavg(); |
//// $this->_processes(); |
} |
if (!$this->blockname || $this->blockname==='hardware') { |
$this->_machine(); |
$this->_cpuinfo(); |
// //$this->_virtualizer(); |
//// $this->_pci(); |
// $this->_usb(); |
//// $this->_i2c(); |
} |
if (!$this->blockname || $this->blockname==='memory') { |
$this->_memory(); |
} |
if (!$this->blockname || $this->blockname==='filesystem') { |
$this->_filesystems(); |
} |
if (!$this->blockname || $this->blockname==='network') { |
$this->_network(); |
} |
break; |
case 'GNU': |
case 'Linux': |
parent::build(); |
} |
} |
} |
/web/acc/phpsysinfo/includes/output/class.WebpageXML.inc.php |
---|
61,7 → 61,26 |
private function _prepare() |
{ |
if ($this->_pluginName === null) { |
if (((PSI_OS == 'WINNT') || (PSI_OS == 'Linux')) && defined('PSI_WMI_HOSTNAME')) { |
if ((PSI_OS == 'Linux') && defined('PSI_SSH_HOSTNAME') && defined('PSI_SSH_USER') && defined('PSI_SSH_PASSWORD')) { |
$fgthost = preg_split("/:/", PSI_SSH_HOSTNAME, -1, PREG_SPLIT_NO_EMPTY); |
define('PSI_EMU_HOSTNAME', trim($fgthost[0])); |
if (isset($fgthost[1]) && (trim($fgthost[1] !== ''))) { |
define('PSI_EMU_PORT', trim($fgthost[1])); |
} else { |
define('PSI_EMU_PORT', 22); |
} |
define('PSI_EMU_USER', PSI_SSH_USER); |
define('PSI_EMU_PASSWORD', PSI_SSH_PASSWORD); |
if (defined('PSI_SSH_ADD_PATHS')) { |
define('PSI_EMU_ADD_PATHS', PSI_SSH_ADD_PATHS); |
} |
if (defined('PSI_SSH_ADD_OPTIONS')) { |
define('PSI_EMU_ADD_OPTIONS', PSI_SSH_ADD_OPTIONS); |
} |
if (!file_exists(PSI_APP_ROOT.'/includes/os/class.Linux.inc.php')) { |
$this->error->addError("file_exists(class.Linux.inc.php)", "Linux is not currently supported"); |
} |
} elseif (((PSI_OS == 'WINNT') || (PSI_OS == 'Linux')) && defined('PSI_WMI_HOSTNAME')) { |
define('PSI_EMU_HOSTNAME', PSI_WMI_HOSTNAME); |
if (defined('PSI_WMI_USER') && defined('PSI_WMI_PASSWORD')) { |
define('PSI_EMU_USER', PSI_WMI_USER); |
141,7 → 160,23 |
} else { |
if ((PSI_OS == 'WINNT') || (PSI_OS == 'Linux')) { |
$plugname = strtoupper(trim($this->_pluginName)); |
if (defined('PSI_PLUGIN_'.$plugname.'_WMI_HOSTNAME')) { |
if ((PSI_OS == 'Linux') && defined('PSI_PLUGIN_'.$plugname.'_SSH_HOSTNAME') && defined('PSI_PLUGIN_'.$plugname.'_SSH_USER') && defined('PSI_PLUGIN_'.$plugname.'_SSH_PASSWORD')) { |
$fgthost = preg_split("/:/", constant('PSI_PLUGIN_'.$plugname.'_SSH_HOSTNAME'), -1, PREG_SPLIT_NO_EMPTY); |
define('PSI_EMU_HOSTNAME', trim($fgthost[0])); |
if (isset($fgthost[1]) && (trim($fgthost[1] !== ''))) { |
define('PSI_EMU_PORT', trim($fgthost[1])); |
} else { |
define('PSI_EMU_PORT', 22); |
} |
define('PSI_EMU_USER', constant('PSI_PLUGIN_'.$plugname.'_SSH_USER')); |
define('PSI_EMU_PASSWORD', constant('PSI_PLUGIN_'.$plugname.'_SSH_PASSWORD')); |
if (defined('PSI_PLUGIN_'.$plugname.'_SSH_ADD_PATHS')) { |
define('PSI_EMU_ADD_PATHS', constant('PSI_PLUGIN_'.$plugname.'_SSH_ADD_PATHS')); |
} |
if (defined('PSI_PLUGIN_'.$plugname.'_SSH_ADD_OPTIONS')) { |
define('PSI_EMU_ADD_OPTIONS', constant('PSI_PLUGIN_'.$plugname.'_SSH_ADD_OPTIONS')); |
} |
} elseif (defined('PSI_PLUGIN_'.$plugname.'_WMI_HOSTNAME')) { |
define('PSI_EMU_HOSTNAME', constant('PSI_PLUGIN_'.$plugname.'_WMI_HOSTNAME')); |
if (defined('PSI_PLUGIN_'.$plugname.'_WMI_USER') && defined('PSI_PLUGIN_'.$plugname.'_WMI_PASSWORD')) { |
define('PSI_EMU_USER', constant('PSI_PLUGIN_'.$plugname.'_WMI_USER')); |
150,6 → 185,22 |
define('PSI_EMU_USER', null); |
define('PSI_EMU_PASSWORD', null); |
} |
} elseif ((PSI_OS == 'Linux') && defined('PSI_SSH_HOSTNAME') && defined('PSI_SSH_USER') && defined('PSI_SSH_PASSWORD')) { |
$fgthost = preg_split("/:/", PSI_SSH_HOSTNAME, -1, PREG_SPLIT_NO_EMPTY); |
define('PSI_EMU_HOSTNAME', trim($fgthost[0])); |
if (isset($fgthost[1]) && (trim($fgthost[1] !== ''))) { |
define('PSI_EMU_PORT', trim($fgthost[1])); |
} else { |
define('PSI_EMU_PORT', 22); |
} |
define('PSI_EMU_USER', PSI_SSH_USER); |
define('PSI_EMU_PASSWORD', PSI_SSH_PASSWORD); |
if (defined('PSI_SSH_ADD_PATHS')) { |
define('PSI_EMU_ADD_PATHS', PSI_SSH_ADD_PATHS); |
} |
if (defined('PSI_SSH_ADD_OPTIONS')) { |
define('PSI_EMU_ADD_OPTIONS', PSI_SSH_ADD_OPTIONS); |
} |
} elseif (defined('PSI_WMI_HOSTNAME')) { |
define('PSI_EMU_HOSTNAME', PSI_WMI_HOSTNAME); |
if (defined('PSI_WMI_USER') && defined('PSI_WMI_PASSWORD')) { |
/web/acc/phpsysinfo/includes/to/class.System.inc.php |
---|
260,6 → 260,13 |
private $_virtualizer = array(); |
/** |
* operating system type |
* |
* @var string |
*/ |
private $_OS = ""; |
/** |
* remove duplicate Entries and Count |
* |
* @param array $arrDev list of HWDevices |
1281,4 → 1288,30 |
} |
} |
} |
/** |
* Returns $_OS. |
* |
* @see System::$_OS |
* |
* @return string |
*/ |
public function getOS() |
{ |
return $this->_OS; |
} |
/** |
* Sets $_OS. |
* |
* @param $os operating system type |
* |
* @see System::$_OS |
* |
* @return void |
*/ |
public function setOS($OS) |
{ |
$this->_OS = $OS; |
} |
} |
/web/acc/phpsysinfo/includes/to/device/class.NetDevice.inc.php |
---|
68,6 → 68,20 |
private $_info = null; |
/** |
* transmitted bytes rate |
* |
* @var int |
*/ |
private $_txRate = null; |
/** |
* received bytes rate |
* |
* @var int |
*/ |
private $_rxRate = null; |
/** |
* Returns $_drops. |
* |
* @see NetDevice::$_drops |
222,4 → 236,55 |
{ |
$this->_info = $info; |
} |
/** |
* Returns $_rxRate. |
* |
* @see NetDevice::$_rxRate |
* |
* @return int |
*/ |
public function getRxRate() |
{ |
return $this->_rxRate; |
} |
/** |
* Sets $_rxRate. |
* |
* @param int $rxRate received bytes rate |
* |
* @see NetDevice::$_rxRate |
* |
* @return void |
*/ |
public function setRxRate($rxRate) |
{ |
$this->_rxRate = $rxRate; |
} |
/** |
* Returns $_txRate. |
* |
* @see NetDevice::$_txRate |
* |
* @return int |
*/ |
public function getTxRate() |
{ |
return $this->_txRate; |
} |
/** |
* Sets $_txRate. |
* |
* @param int $txRate transmitted bytes rate |
* |
* @see NetDevice::$_txRate |
* |
* @return void |
*/ |
public function setTxRate($txRate) |
{ |
$this->_txRate = $txRate; |
} |
} |
/web/acc/phpsysinfo/includes/ups/class.apcupsd.inc.php |
---|
78,7 → 78,7 |
} |
} |
} else { //use default if address and port not defined |
if (!defined('PSI_EMU_HOSTNAME')) { |
if (!defined('PSI_EMU_HOSTNAME') || defined('PSI_EMU_PORT')) { |
CommonFunctions::executeProgram('apcaccess', 'status', $temp); |
} else { |
CommonFunctions::executeProgram('apcaccess', 'status '.PSI_EMU_HOSTNAME, $temp); |
/web/acc/phpsysinfo/includes/ups/class.nut.inc.php |
---|
84,7 → 84,7 |
} |
} |
} else { //use default if address and port not defined |
if (!defined('PSI_EMU_HOSTNAME')) { |
if (!defined('PSI_EMU_HOSTNAME') || defined('PSI_EMU_PORT')) { |
CommonFunctions::executeProgram('upsc', '-l', $output, PSI_DEBUG); |
} else { |
CommonFunctions::executeProgram('upsc', '-l '.PSI_EMU_HOSTNAME, $output, PSI_DEBUG); |
/web/acc/phpsysinfo/includes/xml/class.SimpleXMLExtended.inc.php |
---|
211,7 → 211,11 |
} |
} |
} else { |
return mb_convert_encoding($str, 'UTF-8'); |
if (function_exists('mb_convert_encoding')) { |
return mb_convert_encoding($str, 'UTF-8'); |
} else { |
return $str; |
} |
} |
} |
/web/acc/phpsysinfo/includes/xml/class.XML.inc.php |
---|
92,7 → 92,9 |
} else { |
$this->_complete_request = false; |
} |
if (defined('PSI_EMU_HOSTNAME')) { |
if (defined('PSI_EMU_PORT')) { |
$os = 'SSH'; |
} elseif (defined('PSI_EMU_HOSTNAME')) { |
$os = 'WINNT'; |
} else { |
$os = PSI_OS; |
161,10 → 163,12 |
} |
} |
if (defined('PSI_EMU_HOSTNAME')) { |
$vitals->addAttribute('OS', 'WINNT'); |
if (($os = $this->_sys->getOS()) == 'Android') { |
$vitals->addAttribute('OS', 'Linux'); |
} elseif ($os == 'GNU') { |
$vitals->addAttribute('OS', 'Hurd'); |
} else { |
$vitals->addAttribute('OS', (PSI_OS=='Android')?'Linux':PSI_OS); |
$vitals->addAttribute('OS', $os); |
} |
} |
203,8 → 207,28 |
if (!$hide) { |
$device = $network->addChild('NetDevice'); |
$device->addAttribute('Name', $dev->getName()); |
$device->addAttribute('RxBytes', $dev->getRxBytes()); |
$device->addAttribute('TxBytes', $dev->getTxBytes()); |
$rxbytes = $dev->getRxBytes(); |
$txbytes = $dev->getTxBytes(); |
$device->addAttribute('RxBytes', $rxbytes); |
$device->addAttribute('TxBytes', $txbytes); |
if (defined('PSI_SHOW_NETWORK_ACTIVE_SPEED') && PSI_SHOW_NETWORK_ACTIVE_SPEED) { |
if (($rxbytes == 0) && ($txbytes == 0)) { |
$rxrate = $dev->getRxRate(); |
$txrate = $dev->getTxRate(); |
if (($rxrate !== null) || ($txrate !== null)) { |
if ($rxrate !== null) { |
$device->addAttribute('RxRate', $rxrate); |
} else { |
$device->addAttribute('RxRate', 0); |
} |
if ($txrate !== null) { |
$device->addAttribute('TxRate', $txrate); |
} else { |
$device->addAttribute('TxRate', 0); |
} |
} |
} |
} |
$device->addAttribute('Err', $dev->getErrors()); |
$device->addAttribute('Drops', $dev->getDrops()); |
if (defined('PSI_SHOW_NETWORK_INFOS') && PSI_SHOW_NETWORK_INFOS && $dev->getInfo()) |
222,16 → 246,29 |
{ |
$hardware = $this->_xml->addChild('Hardware'); |
if (($machine = $this->_sys->getMachine()) != "") { |
if ((preg_match('/^(.* (.*\/.*\/.*))\/(.*\/.*\/.*)(, BIOS .*)$/', $machine, $mbuf) |
|| preg_match('/^(.* (.*\/.*))\/(.*\/.*)(, BIOS .*)$/', $machine, $mbuf) |
|| preg_match('/^(.* (.*))\/(.*)(, BIOS .*)$/', $machine, $mbuf) |
|| preg_match('/^((.*\/.*\/.*))\/(.*\/.*\/.*)(, BIOS .*)$/', $machine, $mbuf) |
|| preg_match('/^((.*\/.*))\/(.*\/.*)(, BIOS .*)$/', $machine, $mbuf) |
|| preg_match('/^((.*))\/(.*)(, BIOS .*)$/', $machine, $mbuf)) |
&& ($mbuf[2] === $mbuf[3])) { // find duplicates |
$machine = $mbuf[1].$mbuf[4]; // minimized machine name |
$machine = trim(preg_replace("/\s+/", " ", preg_replace("/^\s*[\/,]*/", "", preg_replace("/\/\s+,/", "/,", $machine)))); // remove leading slash or comma and unnecessary spaces |
if (preg_match('/, BIOS .*$/', $machine, $mbuf, PREG_OFFSET_CAPTURE)) { |
$comapos = $mbuf[0][1]; |
$endstr = $mbuf[0][0]; |
$offset = 0; |
while (($offset < $comapos) |
&& (($slashpos = strpos($machine, "/", $offset)) !== false) |
&& ($slashpos < $comapos)) { |
$len1 = $comapos - $slashpos - 1; |
$str1 = substr($machine, $slashpos + 1, $len1); |
$begstr = substr($machine, 0, $slashpos); |
if ($len1 > 0) { // no empty |
$str2 = substr($begstr, -$len1 - 1); |
} else { |
$str2 = " "; |
} |
if ((" ".$str1 === $str2) || ($str1 === $begstr)) { // duplicates |
$machine = $begstr.$endstr; |
break; |
} |
$offset = $slashpos + 1; |
} |
} |
$machine = trim(preg_replace("/^\s*\/?,?/", "", $machine)); // remove leading slash and comma |
if ($machine != "") { |
$hardware->addAttribute('Name', $machine); |
/web/acc/phpsysinfo/js/phpSysInfo/phpsysinfo.js |
---|
600,7 → 600,7 |
}); |
degree = parseFloat(degreeC); |
if (isNaN(degreeC)) { |
if (!isFinite(degreeC)) { |
return "---"; |
} else { |
switch (tempFormat) { |
775,7 → 775,7 |
var model = "", speed = 0, voltage = 0, bus = 0, cache = 0, bogo = 0, temp = 0, load = 0, speedmax = 0, speedmin = 0, cpucoreposition = 0, virt = "", manufacturer = ""; |
cpucount++; |
model = $(this).attr("Model"); |
voltage = $(this).attr("Voltage"); |
voltage = parseFloat($(this).attr("Voltage")); |
speed = parseInt($(this).attr("CpuSpeed"), 10); |
speedmax = parseInt($(this).attr("CpuSpeedMax"), 10); |
speedmin = parseInt($(this).attr("CpuSpeedMin"), 10); |
823,8 → 823,8 |
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(14) + ":</span></div></td><td>" + formatHertz(bus) + "</td></tr>\n"; |
tree.push(cpucoreposition); |
} |
if (!isNaN(voltage)) { |
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(52) + ":</span></div></td><td>" + round(voltage, 2) + " V</td></tr>\n"; |
if (isFinite(voltage)) { |
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(52) + ":</span></div></td><td>" + round(voltage, 2) + " " + genlang(82) + "</td></tr>\n"; |
tree.push(cpucoreposition); |
} |
if (!isNaN(bogo)) { |
903,8 → 903,8 |
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(129) + ":</span></div></td><td>" + ((type=="MEM")?formatMTps(speed):formatBPS(1000000*speed)) + "</td></tr>\n"; |
tree.push(devcoreposition); |
} |
if (!isNaN(voltage)) { |
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(52) + ":</span></div></td><td>" + round(voltage, 2) + " V</td></tr>\n"; |
if (isFinite(voltage)) { |
html += "<tr><td style=\"width:68%\"><div class=\"treediv\"><span class=\"treespan\">" + genlang(52) + ":</span></div></td><td>" + round(voltage, 2) + " " + genlang(82) + "</td></tr>\n"; |
tree.push(devcoreposition); |
} |
if (serial !== undefined) { |
1031,28 → 1031,46 |
} |
$("Network NetDevice", xml).each(function getDevice(id) { |
var name = "", rx = 0, tx = 0, er = 0, dr = 0, info = "", networkindex = 0, htmlrx = '', htmltx = ''; |
var name = "", rx = 0, tx = 0, er = 0, dr = 0, info = "", networkindex = 0, htmlrx = '', htmltx = '', rxr = 0, txr = 0; |
name = $(this).attr("Name"); |
rx = parseInt($(this).attr("RxBytes"), 10); |
tx = parseInt($(this).attr("TxBytes"), 10); |
er = parseInt($(this).attr("Err"), 10); |
dr = parseInt($(this).attr("Drops"), 10); |
rxr = parseInt($(this).attr("RxRate"), 10); |
txr = parseInt($(this).attr("TxRate"), 10); |
if (showNetworkActiveSpeed && ($.inArray(name, oldnetwork) >= 0)) { |
var diff, difftime; |
if (((diff = rx - oldnetwork[name].rx) > 0) && ((difftime = timestamp - oldnetwork[name].timestamp) > 0)) { |
if (showNetworkActiveSpeed) { |
if ((rx == 0) && !isNaN(rxr)) { |
if (showNetworkActiveSpeed == 2) { |
htmlrx ="<br><i>("+formatBPS(round(8*diff/difftime, 2))+")</i>"; |
htmlrx ="<br><i>("+formatBPS(round(rxr, 2))+")</i>"; |
} else { |
htmlrx ="<br><i>("+formatBytes(round(diff/difftime, 2), xml)+"/s)</i>"; |
htmlrx ="<br><i>("+formatBytes(round(rxr, 2), xml)+"/s)</i>"; |
} |
} else if ($.inArray(name, oldnetwork) >= 0) { |
var diff, difftime; |
if (((diff = rx - oldnetwork[name].rx) > 0) && ((difftime = timestamp - oldnetwork[name].timestamp) > 0)) { |
if (showNetworkActiveSpeed == 2) { |
htmlrx ="<br><i>("+formatBPS(round(8*diff/difftime, 2))+")</i>"; |
} else { |
htmlrx ="<br><i>("+formatBytes(round(diff/difftime, 2), xml)+"/s)</i>"; |
} |
} |
} |
if (((diff = tx - oldnetwork[name].tx) > 0) && (difftime > 0)) { |
if ((tx == 0) && !isNaN(txr)) { |
if (showNetworkActiveSpeed == 2) { |
htmltx ="<br><i>("+formatBPS(round(8*diff/difftime, 2))+")</i>"; |
htmltx ="<br><i>("+formatBPS(round(txr, 2))+")</i>"; |
} else { |
htmltx ="<br><i>("+formatBytes(round(diff/difftime, 2), xml)+"/s)</i>"; |
htmltx ="<br><i>("+formatBytes(round(txr, 2), xml)+"/s)</i>"; |
} |
} else if ($.inArray(name, oldnetwork) >= 0) { |
if (((diff = tx - oldnetwork[name].tx) > 0) && (difftime > 0)) { |
if (showNetworkActiveSpeed == 2) { |
htmltx ="<br><i>("+formatBPS(round(8*diff/difftime, 2))+")</i>"; |
} else { |
htmltx ="<br><i>("+formatBytes(round(diff/difftime, 2), xml)+"/s)</i>"; |
} |
} |
} |
} |
1391,7 → 1409,10 |
min = parseFloat($(this).attr("Min")); |
if (isFinite(min)) |
_min = round(min, 2) + " " + genlang(62); |
$("#voltageTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">" + round(value, 2) + " " + genlang(62) + "</td><td class=\"right\">" + _min + "</td><td class=\"right\">" + _max + "</td></tr>"); |
if (isFinite(value)) |
$("#voltageTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">" + round(value, 2) + " " + genlang(62) + "</td><td class=\"right\">" + _min + "</td><td class=\"right\">" + _max + "</td></tr>"); |
else |
$("#voltageTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">--- " + genlang(62) + "</td><td class=\"right\">" + _min + "</td><td class=\"right\">" + _max + "</td></tr>"); |
values = true; |
}); |
if (values) { |
1427,11 → 1448,17 |
if (unit === "%") { |
if (isFinite(min)) |
_min = round(min,0) + "%"; |
$("#fansTable tbody").append("<tr><td>" + label + "</td><td>" + createBar(round(value,0)) + "</td><td class=\"right\">" + _min + "</td></tr>"); |
if (isFinite(value)) |
$("#fansTable tbody").append("<tr><td>" + label + "</td><td>" + createBar(round(value,0)) + "</td><td class=\"right\">" + _min + "</td></tr>"); |
else |
$("#fansTable tbody").append("<tr><td>" + label + "</td><td>---%</td><td class=\"right\">" + _min + "</td></tr>"); |
} else { |
if (isFinite(min)) |
_min = round(min,0) + " " + genlang(63); |
$("#fansTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">" + round(value,0) + " " + genlang(63) + "</td><td class=\"right\">" + _min + "</td></tr>"); |
if (isFinite(value)) |
$("#fansTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">" + round(value,0) + " " + genlang(63) + "</td><td class=\"right\">" + _min + "</td></tr>"); |
else |
$("#fansTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">--- " + genlang(63) + "</td><td class=\"right\">" + _min + "</td></tr>"); |
} |
values = true; |
}); |
1459,7 → 1486,7 |
$("MBInfo Power Item", xml).each(function getPowers(id) { |
var label = "", value = "", event = "", limit = 0, _limit = ""; |
label = $(this).attr("Label"); |
value = $(this).attr("Value"); |
value = parseFloat($(this).attr("Value")); |
event = $(this).attr("Event"); |
if (event !== undefined) |
label += " <img style=\"vertical-align: middle; width:16px;\" src=\"./gfx/attention.gif\" alt=\"!\" title=\""+event+"\"/>"; |
1466,7 → 1493,10 |
limit = parseFloat($(this).attr("Max")); |
if (isFinite(limit)) |
_limit = round(limit, 2) + " " + genlang(103); |
$("#powerTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">" + round(value, 2) + " " + genlang(103) + "</td><td class=\"right\">" + _limit + "</td></tr>"); |
if (isFinite(value)) |
$("#powerTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">" + round(value, 2) + " " + genlang(103) + "</td><td class=\"right\">" + _limit + "</td></tr>"); |
else |
$("#powerTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">--- " + genlang(103) + "</td><td class=\"right\">" + _limit + "</td></tr>"); |
values = true; |
}); |
if (values) { |
1493,7 → 1523,7 |
$("MBInfo Current Item", xml).each(function getCurrents(id) { |
var label = "", value = "", event = "", min = 0, max = 0, _min = "", _max = ""; |
label = $(this).attr("Label"); |
value = $(this).attr("Value"); |
value = parseFloat($(this).attr("Value")); |
event = $(this).attr("Event"); |
if (event !== undefined) |
label += " <img style=\"vertical-align: middle; width:16px;\" src=\"./gfx/attention.gif\" alt=\"!\" title=\""+event+"\"/>"; |
1503,7 → 1533,10 |
min = parseFloat($(this).attr("Min")); |
if (isFinite(min)) |
_min = round(min, 2) + " " + genlang(106); |
$("#currentTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">" + round(value, 2) + " " + genlang(106) + "</td><td class=\"right\">" + _min + "</td><td class=\"right\">" + _max + "</td></tr>"); |
if (isFinite(value)) |
$("#currentTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">" + round(value, 2) + " " + genlang(106) + "</td><td class=\"right\">" + _min + "</td><td class=\"right\">" + _max + "</td></tr>"); |
else |
$("#currentTable tbody").append("<tr><td>" + label + "</td><td class=\"right\">--- " + genlang(106) + "</td><td class=\"right\">" + _min + "</td><td class=\"right\">" + _max + "</td></tr>"); |
values = true; |
}); |
if (values) { |
/web/acc/phpsysinfo/js/phpSysInfo/phpsysinfo_bootstrap.js |
---|
661,6 → 661,9 |
} |
}; |
if ((data.Vitals["@attributes"].LoadAvg === '') && (data.Vitals["@attributes"].CPULoad === undefined)) { |
$("#tr_LoadAvg").hide(); |
} |
if (data.Vitals["@attributes"].SysLang === undefined) { |
$("#tr_SysLang").hide(); |
} |
725,7 → 728,7 |
}, |
Voltage: { |
html: function() { |
return round(this.Voltage, 2) + ' V'; |
return round(this.Voltage, 2) + genlang(82); //V |
} |
}, |
Bogomips: { |
767,7 → 770,7 |
}, |
Voltage: { |
html: function() { |
return round(this.Voltage, 2) + ' V'; |
return round(this.Voltage, 2) + genlang(82); //V |
} |
}, |
Capacity: { |
1026,17 → 1029,17 |
html += '<div class="percent">' + 'Total: ' + this["@attributes"].Percent + '% ' + '<i>('; |
var not_first = false; |
if (this.Details["@attributes"].AppPercent !== undefined) { |
html += genlang(64) + ': '+ this.Details["@attributes"].AppPercent + '%'; //Kernel + apps |
html += '<span class="progress-bar-info"> </span> ' + genlang(64) + ': '+ this.Details["@attributes"].AppPercent + '%'; //Kernel + apps |
not_first = true; |
} |
if (this.Details["@attributes"].CachedPercent !== undefined) { |
if (not_first) html += ' - '; |
html += genlang(66) + ': ' + this.Details["@attributes"].CachedPercent + '%'; //Cache |
html += '<span class="progress-bar-warning"> </span> ' + genlang(66) + ': ' + this.Details["@attributes"].CachedPercent + '%'; //Cache |
not_first = true; |
} |
if (this.Details["@attributes"].BuffersPercent !== undefined) { |
if (not_first) html += ' - '; |
html += genlang(65) + ': ' + this.Details["@attributes"].BuffersPercent + '%'; //Buffers |
html += '<span class="progress-bar-danger"> </span> ' + genlang(65) + ': ' + this.Details["@attributes"].BuffersPercent + '%'; //Buffers |
} |
html += ')</i></div>'; |
return html; |
1200,13 → 1203,21 |
RxBytes: { |
html: function () { |
var htmladd = ''; |
if (showNetworkActiveSpeed && ($.inArray(this.Name, oldnetwork) >= 0)) { |
var diff, difftime; |
if (((diff = this.RxBytes - oldnetwork[this.Name].RxBytes) > 0) && ((difftime = data.Generation["@attributes"].timestamp - oldnetwork[this.Name].timestamp) > 0)) { |
if (showNetworkActiveSpeed) { |
if ((this.RxBytes == 0) && (this.RxRate !== undefined)) { |
if (showNetworkActiveSpeed == 2) { |
htmladd ="<br><i>("+formatBPS(round(8*diff/difftime, 2))+")</i>"; |
htmladd ="<br><i>("+formatBPS(round(this.RxRate, 2))+")</i>"; |
} else { |
htmladd ="<br><i>("+formatBytes(round(diff/difftime, 2), data.Options["@attributes"].byteFormat)+"/s)</i>"; |
htmladd ="<br><i>("+formatBytes(round(this.RxRate, 2), data.Options["@attributes"].byteFormat)+"/s)</i>"; |
} |
} else if ($.inArray(this.Name, oldnetwork) >= 0) { |
var diff, difftime; |
if (((diff = this.RxBytes - oldnetwork[this.Name].RxBytes) > 0) && ((difftime = data.Generation["@attributes"].timestamp - oldnetwork[this.Name].timestamp) > 0)) { |
if (showNetworkActiveSpeed == 2) { |
htmladd ="<br><i>("+formatBPS(round(8*diff/difftime, 2))+")</i>"; |
} else { |
htmladd ="<br><i>("+formatBytes(round(diff/difftime, 2), data.Options["@attributes"].byteFormat)+"/s)</i>"; |
} |
} |
} |
} |
1216,14 → 1227,22 |
TxBytes: { |
html: function () { |
var htmladd = ''; |
if (showNetworkActiveSpeed && ($.inArray(this.Name, oldnetwork) >= 0)) { |
var diff, difftime; |
if (((diff = this.TxBytes - oldnetwork[this.Name].TxBytes) > 0) && ((difftime = data.Generation["@attributes"].timestamp - oldnetwork[this.Name].timestamp) > 0)) { |
if (showNetworkActiveSpeed) { |
if ((this.TxBytes == 0) && (this.TxRate !== undefined)) { |
if (showNetworkActiveSpeed == 2) { |
htmladd ="<br><i>("+formatBPS(round(8*diff/difftime, 2))+")</i>"; |
htmladd ="<br><i>("+formatBPS(round(this.TxRate, 2))+")</i>"; |
} else { |
htmladd ="<br><i>("+formatBytes(round(diff/difftime, 2), data.Options["@attributes"].byteFormat)+"/s)</i>"; |
htmladd ="<br><i>("+formatBytes(round(this.TxRate, 2), data.Options["@attributes"].byteFormat)+"/s)</i>"; |
} |
} else if ($.inArray(this.Name, oldnetwork) >= 0) { |
var diff, difftime; |
if (((diff = this.TxBytes - oldnetwork[this.Name].TxBytes) > 0) && ((difftime = data.Generation["@attributes"].timestamp - oldnetwork[this.Name].timestamp) > 0)) { |
if (showNetworkActiveSpeed == 2) { |
htmladd ="<br><i>("+formatBPS(round(8*diff/difftime, 2))+")</i>"; |
} else { |
htmladd ="<br><i>("+formatBytes(round(diff/difftime, 2), data.Options["@attributes"].byteFormat)+"/s)</i>"; |
} |
} |
} |
} |
return formatBytes(this.TxBytes, data.Options["@attributes"].byteFormat) + htmladd; |
1720,7 → 1739,7 |
/** |
* format a celcius temperature to fahrenheit and also append the right suffix |
* @param {String} degreeC temperature in celvius |
* @param {jQuery} xml phpSysInfo-XML |
* @param {String} temperature format |
* @return {String} html string with no breaking spaces and translation statements |
*/ |
function formatTemp(degreeC, tempFormat) { |
1784,7 → 1803,7 |
* for binary and decimal output<br>user can specify a constant format for all byte outputs or the output is formated |
* automatically so that every value can be read in a user friendly way |
* @param {Number} bytes value that should be converted in the corespondenting format, which is specified in the phpsysinfo.ini |
* @param {jQuery} xml phpSysInfo-XML |
* @param {String} byte format |
* @param {parenths} if true then add parentheses |
* @return {String} string of the converted bytes with the translated unit expression |
*/ |
/web/acc/phpsysinfo/language/fa.xml |
---|
388,13 → 388,13 |
<exp>پونه سیستم عامل</exp> |
</expression> |
<expression id="128" name="no_memories"> |
<exp>Number of memory chips</exp> |
<exp>تعداد چیپهای حافظه</exp> |
</expression> |
<expression id="129" name="speed"> |
<exp>Speed</exp> |
<exp>سرعت</exp> |
</expression> |
<expression id="130" name="mem"> |
<exp>Memory Chips</exp> |
<exp>چیپهای حافظه</exp> |
</expression> |
<expression id="131" name="mtps"> |
<exp>MT/s</exp> |
403,9 → 403,9 |
<exp>GT/s</exp> |
</expression> |
<expression id="133" name="ups_beeper_status"> |
<exp>Beeper status</exp> |
<exp>وضعیت آلارم</exp> |
</expression> |
<expression id="134" name="virtualizer"> |
<exp>Virtualizer</exp> |
<exp>مجازیساز</exp> |
</expression> |
</tns:translation> |
/web/acc/phpsysinfo/phpsysinfo.ini |
---|
41,8 → 41,8 |
; |
ADD_PATHS=false |
; List of IP addresses of clients authorized to run |
; Example : ALLOWED="127.0.0.1,192.168.1.48" //allowed IP 127.0.0.1 and 192.168.1.48 |
; List of IP addresses (IPv4) of clients authorized to run |
; Example : ALLOWED="127.0.0.1,192.168.1.48,192.168.0.0/24" //allowed IP 127.0.0.1, 192.168.1.48 and 192.168.0.0/24 |
; ALLOWED=false //no IP checking |
; |
ALLOWED=false |
80,6 → 80,27 |
; |
;ROOTFS="/" |
; External Linux, GNU Hurd, DrayOS and FortiOS connection parameters via SSH |
; For safety reasons make sure that phpsysinfo.ini cannot be read by the network or other users! |
; These settings can also be entered for a specific plug-in so that only it connects to an external server |
; For safety reasons make sure that phpsysinfo.ini cannot be read by the network or other users! |
; |
;SSH_HOSTNAME="hostname:22" |
;SSH_USER="username" |
;SSH_PASSWORD="password" |
; |
; Additional paths where to look for installed programs |
; Example : SSH_ADD_PATHS="/sbin,/usr/sbin" |
; |
;SSH_ADD_PATHS=false |
; |
; Additional SSH options |
; Example : SSH_ADD_OPTIONS="KexAlgorithms=+diffie-hellman-group1-sha1,HostKeyAlgorithms=+ssh-dss,Ciphers=+3des-cbc" |
; |
;SSH_ADD_OPTIONS="" |
; External WinNT server connection parameters |
; Possibility available for WinNT and partly for LINUX (if wmic tool from wmic-linux or openvas-smb package is installed) |
; These settings can also be entered for a specific plug-in so that only it connects to an external server |
283,6 → 304,7 |
; - SpeedFan http://www.almico.com/speedfan.php (required tool packaged in: tools/speedfan/SpeedFanGet_bin.zip) (WinNT) |
; - Thinkpad No addon tool neded (Lenovo Thinkpad - Linux) |
; - NvidiaSMI Nvidia GPU drivers (FreeBSD/Linux/SunOS/WinNT) |
; - FortiSensor No addon tool neded (Fortinet devices - FortiOS) |
; |
; Example: If you want to use lmsensors : SENSOR_PROGRAM="LMSensors" |
; If you want to use lmsensors and IPMItool: SENSOR_PROGRAM="LMSensors,IPMItool" |
474,7 → 496,7 |
; - "data" for reading data from file data/upsapcupsd{ups_number}.tmp |
; content is the output from "apcaccess status" |
; |
UPS_APCUPSD_ACCESS=false |
UPS_APCUPSD_ACCESS="command" |
; Apcupsd has a CGI monitoring utility called apcupsd-cgi |
706,29 → 728,32 |
; - dmraid: command "dmraid -s -vv 2>&1" is run (on Linux only) |
; If access error try execute first: chmod 4755 /sbin/dmraid |
; This method is not recommended for safety reasons! |
; - megactl: command "megactl" (on Linux only) |
; downloaded from http://sourceforge.net/projects/megactl/ or http://github.com/hmage/megactl |
; - megactl: command "megactl -vv" is run (on Linux only) |
; downloaded from http://sourceforge.net/projects/megactl/ or http://github.com/hmage/megactl or http://github.com/namiltd/megactl |
; If permission error try execute first: chmod 4755 /usr/sbin/megactl |
; - megasasctl: command "megasasctl" (on Linux only) |
; downloaded from http://sourceforge.net/projects/megactl/ or http://github.com/hmage/megactl |
; - megasasctl: command "megasasctl -vv" is run (on Linux only) |
; downloaded from http://sourceforge.net/projects/megactl/ or http://github.com/hmage/megactl or http://github.com/namiltd/megactl |
; If permission error try execute first: chmod 4755 /usr/sbin/megasasctl |
; - megaclisas-status: command "megaclisas-status" (or "megaclisas-status.py" on WinNT) |
; downloaded from http://hwraid.le-vert.net or https://github.com/eLvErDe/hwraid (Python 2) or https://github.com/ElCoyote27/hwraid (Python 3) |
; - 3ware-status: command "3ware-status" (or 3ware-status.py" on WinNT) |
; - megaclisas-status: command "megaclisas-status" is run (or "megaclisas-status.py" on WinNT) |
; downloaded from http://hwraid.le-vert.net or https://github.com/eLvErDe/hwraid or https://github.com/ElCoyote27/hwraid |
; - 3ware-status: command "3ware-status" is run (or 3ware-status.py" on WinNT) |
; downloaded from http://hwraid.le-vert.net or https://github.com/eLvErDe/hwraid or https://github.com/ElCoyote27/hwraid |
; - graid: command "graid list" is run (on FreeBSD only) |
; - zpool: command "zpool status" is run |
; - storcli: command "storcli /call show all" or "storcli /call show all" is run |
; - perccli: command "perccli /call show all" or "perccli /call show all" is run |
; - idrac: command "snmpwalk -Ona -c public -v 1 -r 0 -t 3 {device} .1.3.6.1.4.1.674.10892.5.5.1.20" is run |
; - "php-snmp"- idrac: execute php snmprealwalk function (php-snmp module must be installed) |
; - for others the option is inactive (uses "command" instead) |
; - "data" (a file must be available in the data directory of the phpsysinfo installation |
; with the filename "raidmdstat.tmp" or "raiddmraid.tmp" or "raidmegactl.tmp" or "raidmegasasctl.tmp" |
; or "raidmegaclisas-status.tmp" or "raidgraid.tmp" or "raidzpool.tmp" or "raididrac{device_number}.tmp") |
; or "raidmegaclisas-status.tmp" or "raidgraid.tmp" or "raidzpool.tmp" or "raidstorcli.tmp" or "raidperccli.tmp" |
; or "raididrac{device_number}.tmp") |
; |
ACCESS="command" |
; define possible programs |
PROGRAM="mdstat,dmraid,megactl,megasasctl,megaclisas-status,3ware-status,graid,zpool,idrac" |
PROGRAM="mdstat,dmraid,megactl,megasasctl,megaclisas-status,3ware-status,graid,zpool,storcli,perccli,idrac" |
; Hide RAID devices |
; Example : HIDE_DEVICES="md127" |
/web/acc/phpsysinfo/read_config.php |
---|
3,7 → 3,7 |
/** |
* phpSysInfo version |
*/ |
define('PSI_VERSION', '3.4.1'); |
define('PSI_VERSION', '3.4.2'); |
/** |
* phpSysInfo configuration |
*/ |
32,10 → 32,10 |
} elseif (trim($value)==="1") { |
define($name_prefix.strtoupper($param), true); |
} else { |
if (strstr($value, ',')) { |
define($name_prefix.strtoupper($param), 'return '.var_export(preg_split('/\s*,\s*/', trim($value), -1, PREG_SPLIT_NO_EMPTY), 1).';'); |
if ((($paramup = strtoupper($param)) !== 'WMI_PASSWORD') && ($paramup !== 'SSH_PASSWORD') && strstr($value, ',')) { |
define($name_prefix.$paramup, 'return '.var_export(preg_split('/\s*,\s*/', trim($value), -1, PREG_SPLIT_NO_EMPTY), 1).';'); |
} else { |
define($name_prefix.strtoupper($param), trim($value)); |
define($name_prefix.$paramup, trim($value)); |
} |
} |
} |
60,10 → 60,33 |
} |
$ip = preg_replace("/^::ffff:/", "", strtolower($ip)); |
if (!in_array($ip, $allowed, true)) { |
echo "Client IP address not allowed"; |
$ip_decimal = ip2long($ip); |
if ($ip_decimal === false) { |
echo "Client IP wrong address (".$ip."). Client not allowed."; |
die(); |
} |
// code based on https://gist.github.com/tott/7684443 |
$was = false; |
foreach ($allowed as $allow) { |
if (strpos($allow, '/') === false) { |
$was = ($allow === $ip); |
} else { |
list($allow, $netmask) = explode('/', $allow, 2); |
$allow_decimal = ip2long($allow); |
$wildcard_decimal = pow(2, (32 - $netmask)) - 1; |
$netmask_decimal = ~$wildcard_decimal; |
$was = (($ip_decimal & $netmask_decimal) === ($allow_decimal & $netmask_decimal)); |
} |
if ($was) { |
break; |
} |
} |
if (!$was) { |
echo "Client IP address (".$ip.") not allowed."; |
die(); |
} |
} |
/* default error handler */ |
113,7 → 136,7 |
if (!defined('PSI_OS')) { //if not overloaded in phpsysinfo.ini |
/* get Linux code page */ |
if (PHP_OS == 'Linux') { |
if ((PHP_OS == 'Linux') || (PHP_OS == 'GNU')) { |
if (file_exists($fname = PSI_ROOT_FILESYSTEM.'/etc/sysconfig/i18n') |
|| file_exists($fname = PSI_ROOT_FILESYSTEM.'/etc/default/locale') |
|| file_exists($fname = PSI_ROOT_FILESYSTEM.'/etc/locale.conf') |
124,55 → 147,59 |
$contents = @file_get_contents($fname); |
} else { |
$contents = false; |
if (file_exists(PSI_ROOT_FILESYSTEM.'/system/build.prop')) { //Android |
define('PSI_OS', 'Android'); |
if ((PSI_ROOT_FILESYSTEM === '') && function_exists('exec') && @exec('uname -o 2>/dev/null', $unameo) && (sizeof($unameo)>0) && (($unameo0 = trim($unameo[0])) != "")) { |
define('PSI_UNAMEO', $unameo0); // is Android on Termux |
} |
if ((PSI_ROOT_FILESYSTEM === '') && !defined('PSI_MODE_POPEN')) { //if not overloaded in phpsysinfo.ini |
if (!function_exists("proc_open")) { //proc_open function test by executing 'pwd' bbbmand |
define('PSI_MODE_POPEN', true); //use popen() function - no stderr error handling (but with problems with timeout) |
} else { |
$out = ''; |
$err = ''; |
$pipes = array(); |
$descriptorspec = array(0=>array("pipe", "r"), 1=>array("pipe", "w"), 2=>array("pipe", "w")); |
$process = proc_open("pwd 2>/dev/null ", $descriptorspec, $pipes); |
if (!is_resource($process)) { |
define('PSI_MODE_POPEN', true); |
if (PHP_OS == 'Linux') { |
if (file_exists(PSI_ROOT_FILESYSTEM.'/system/build.prop')) { //Android |
define('PSI_OS', 'Android'); |
if ((PSI_ROOT_FILESYSTEM === '') && function_exists('exec') && @exec('uname -o 2>/dev/null', $unameo) && (sizeof($unameo)>0) && (($unameo0 = trim($unameo[0])) != "")) { |
define('PSI_UNAMEO', $unameo0); // is Android on Termux |
} |
if ((PSI_ROOT_FILESYSTEM === '') && !defined('PSI_MODE_POPEN')) { //if not overloaded in phpsysinfo.ini |
if (!function_exists("proc_open")) { //proc_open function test by executing 'pwd' bbbmand |
define('PSI_MODE_POPEN', true); //use popen() function - no stderr error handling (but with problems with timeout) |
} else { |
$w = null; |
$e = null; |
$out = ''; |
$err = ''; |
$pipes = array(); |
$descriptorspec = array(0=>array("pipe", "r"), 1=>array("pipe", "w"), 2=>array("pipe", "w")); |
$process = proc_open("pwd 2>/dev/null ", $descriptorspec, $pipes); |
if (!is_resource($process)) { |
define('PSI_MODE_POPEN', true); |
} else { |
$w = null; |
$e = null; |
while (!(feof($pipes[1]) && feof($pipes[2]))) { |
$read = array($pipes[1], $pipes[2]); |
while (!(feof($pipes[1]) && feof($pipes[2]))) { |
$read = array($pipes[1], $pipes[2]); |
$n = stream_select($read, $w, $e, 5); |
$n = stream_select($read, $w, $e, 5); |
if (($n === false) || ($n === 0)) { |
break; |
} |
if (($n === false) || ($n === 0)) { |
break; |
} |
foreach ($read as $r) { |
if ($r == $pipes[1]) { |
$out .= fread($r, 4096); |
} elseif (feof($pipes[1]) && ($r == $pipes[2])) {//read STDERR after STDOUT |
$err .= fread($r, 4096); |
foreach ($read as $r) { |
if ($r == $pipes[1]) { |
$out .= fread($r, 4096); |
} elseif (feof($pipes[1]) && ($r == $pipes[2])) {//read STDERR after STDOUT |
$err .= fread($r, 4096); |
} |
} |
} |
} |
if (($out === null) || (trim($out) == "") || (substr(trim($out), 0, 1) != "/")) { |
define('PSI_MODE_POPEN', true); |
if (($out === null) || (trim($out) == "") || (substr(trim($out), 0, 1) != "/")) { |
define('PSI_MODE_POPEN', true); |
} |
fclose($pipes[0]); |
fclose($pipes[1]); |
fclose($pipes[2]); |
// It is important that you close any pipes before calling |
// proc_close in order to avoid a deadlock |
proc_close($process); |
} |
fclose($pipes[0]); |
fclose($pipes[1]); |
fclose($pipes[2]); |
// It is important that you close any pipes before calling |
// proc_close in order to avoid a deadlock |
proc_close($process); |
} |
} |
} elseif (file_exists(PSI_ROOT_FILESYSTEM.'/var/mobile/Library/Cydia/metadata.cb0')) { //jailbroken iOS with Cydia |
define('PSI_OS', 'Darwin'); |
} |
} |
} |
183,7 → 210,7 |
if (!defined('PSI_SYSTEM_CODEPAGE')) { |
if (file_exists($vtfname = PSI_ROOT_FILESYSTEM.'/sys/module/vt/parameters/default_utf8') |
&& (trim(@file_get_contents($vtfname)) === "1")) { |
define('PSI_SYSTEM_CODEPAGE', 'UTF-8'); |
define('PSI_SYSTEM_CODEPAGE', 'UTF-8'); |
} elseif ((PSI_ROOT_FILESYSTEM === '') && function_exists('exec') && @exec($matches[1].' locale -k LC_CTYPE 2>/dev/null', $lines)) { //if not overloaded in phpsysinfo.ini |
foreach ($lines as $line) { |
if (preg_match('/^charmap="?([^"]*)/', $line, $matches2)) { |
237,7 → 264,7 |
} |
} |
} |
} elseif (PHP_OS == 'Darwin') { |
} elseif ((PHP_OS == 'Darwin') || (defined('PSI_OS') && (PSI_OS == 'Darwin'))){ |
if (!defined('PSI_SYSTEM_LANG') //if not overloaded in phpsysinfo.ini |
&& (PSI_ROOT_FILESYSTEM === '') && function_exists('exec') && @exec('defaults read /Library/Preferences/.GlobalPreferences AppleLocale 2>/dev/null', $lines)) { |
$lang = ""; |
/web/acc/phpsysinfo/templates/html/error_config.html |
---|
1,4 → 1,4 |
<?php echo"<?xml version=\"1.0\" encoding=\"utf-8\">"; ?> |
<?php echo"<?xml version=\"1.0\" encoding=\"utf-8\"?>"; ?> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml"> |
<head> |
/web/acc/phpsysinfo/templates/html/index_all.html |
---|
1,4 → 1,4 |
<?php echo "<?xml version=\"1.0\" encoding=\"utf-8\">"; ?> |
<?php echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>"; ?> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml"> |
<head> |
/web/acc/phpsysinfo/templates/html/index_bootstrap.html |
---|
139,7 → 139,7 |
<th><span class="lang_008">Current Users</span></th> |
<td><span data-bind="Users"></span></td> |
</tr> |
<tr> |
<tr id="tr_LoadAvg"> |
<th><span class="lang_009">Load Averages</span></th> |
<td><span data-bind="LoadAvg"></span></td> |
</tr> |