Line 104... |
Line 104... |
104 |
}
|
104 |
}
|
105 |
} elseif (CommonFunctions::executeProgram('uptime', '', $buf, PSI_DEBUG) && preg_match("/,\s+(\d+)\s+user[s]?,/", $buf, $ar_buf)) {
|
105 |
} elseif (CommonFunctions::executeProgram('uptime', '', $buf, PSI_DEBUG) && preg_match("/,\s+(\d+)\s+user[s]?,/", $buf, $ar_buf)) {
|
106 |
//} elseif (CommonFunctions::executeProgram('uptime', '', $buf) && preg_match("/,\s+(\d+)\s+user[s]?,\s+load average[s]?:\s+(.*),\s+(.*),\s+(.*)$/", $buf, $ar_buf)) {
|
106 |
//} elseif (CommonFunctions::executeProgram('uptime', '', $buf) && preg_match("/,\s+(\d+)\s+user[s]?,\s+load average[s]?:\s+(.*),\s+(.*),\s+(.*)$/", $buf, $ar_buf)) {
|
107 |
$this->sys->setUsers($ar_buf[1]);
|
107 |
$this->sys->setUsers($ar_buf[1]);
|
108 |
} else {
|
108 |
} else {
|
109 |
$processlist = glob('/proc/*/cmdline', GLOB_NOSORT);
|
109 |
$processlist = CommonFunctions::findglob('/proc/*/cmdline', GLOB_NOSORT);
|
110 |
if (is_array($processlist) && (($total = count($processlist)) > 0)) {
|
110 |
if (is_array($processlist) && (($total = count($processlist)) > 0)) {
|
111 |
$count = 0;
|
111 |
$count = 0;
|
112 |
$buf = "";
|
112 |
$buf = "";
|
113 |
for ($i = 0; $i < $total; $i++) {
|
113 |
for ($i = 0; $i < $total; $i++) {
|
114 |
if (CommonFunctions::rfts($processlist[$i], $buf, 0, 4096, false)) {
|
114 |
if (CommonFunctions::rfts($processlist[$i], $buf, 0, 4096, false)) {
|
Line 130... |
Line 130... |
130 |
*
|
130 |
*
|
131 |
* @return void
|
131 |
* @return void
|
132 |
*/
|
132 |
*/
|
133 |
protected function _ip()
|
133 |
protected function _ip()
|
134 |
{
|
134 |
{
|
135 |
if ((PSI_USE_VHOST === true) && !defined('PSI_EMU_HOSTNAME')) {
|
135 |
if (PSI_USE_VHOST && !defined('PSI_EMU_HOSTNAME')) {
|
136 |
if ((CommonFunctions::readenv('SERVER_ADDR', $result) || CommonFunctions::readenv('LOCAL_ADDR', $result)) //is server address defined
|
136 |
if ((CommonFunctions::readenv('SERVER_ADDR', $result) || CommonFunctions::readenv('LOCAL_ADDR', $result)) //is server address defined
|
137 |
&& !strstr($result, '.') && strstr($result, ':')) { //is IPv6, quick version of preg_match('/\(([[0-9A-Fa-f\:]+)\)/', $result)
|
137 |
&& !strstr($result, '.') && strstr($result, ':')) { //is IPv6, quick version of preg_match('/\(([[0-9A-Fa-f\:]+)\)/', $result)
|
138 |
$dnsrec = dns_get_record($this->sys->getHostname(), DNS_AAAA);
|
138 |
$dnsrec = dns_get_record($this->sys->getHostname(), DNS_AAAA);
|
139 |
if (isset($dnsrec[0]['ipv6'])) { //is DNS IPv6 record
|
139 |
if (isset($dnsrec[0]['ipv6'])) { //is DNS IPv6 record
|
140 |
$this->sys->setIp($dnsrec[0]['ipv6']); //from DNS (avoid IPv6 NAT translation)
|
140 |
$this->sys->setIp($dnsrec[0]['ipv6']); //from DNS (avoid IPv6 NAT translation)
|
Line 163... |
Line 163... |
163 |
*
|
163 |
*
|
164 |
* @return void
|
164 |
* @return void
|
165 |
*/
|
165 |
*/
|
166 |
protected function _dmimeminfo()
|
166 |
protected function _dmimeminfo()
|
167 |
{
|
167 |
{
|
168 |
$banks = array();
|
- |
|
169 |
$buffer = '';
|
- |
|
170 |
if (defined('PSI_DMIDECODE_ACCESS') && (strtolower(PSI_DMIDECODE_ACCESS)=="data")) {
|
- |
|
171 |
CommonFunctions::rfts(PSI_APP_ROOT.'/data/dmidecode.txt', $buffer);
|
- |
|
172 |
} elseif (CommonFunctions::_findProgram('dmidecode')) {
|
168 |
$dmimd = CommonFunctions::readdmimemdata();
|
173 |
CommonFunctions::executeProgram('dmidecode', '-t 17', $buffer, PSI_DEBUG);
|
- |
|
174 |
}
|
- |
|
175 |
if (!empty($buffer)) {
|
169 |
if (!empty($dmimd)) {
|
176 |
$banks = preg_split('/^(?=Handle\s)/m', $buffer, -1, PREG_SPLIT_NO_EMPTY);
|
- |
|
177 |
foreach ($banks as $bank) if (preg_match('/^Handle\s/', $bank)) {
|
- |
|
178 |
$lines = preg_split("/\n/", $bank, -1, PREG_SPLIT_NO_EMPTY);
|
- |
|
179 |
$mem = array();
|
170 |
foreach ($dmimd as $mem) {
|
180 |
foreach ($lines as $line) if (preg_match('/^\s+([^:]+):(.+)/' ,$line, $params)) {
|
- |
|
181 |
if (preg_match('/^0x([A-F\d]+)/', $params2 = trim($params[2]), $buff)) {
|
- |
|
182 |
$mem[trim($params[1])] = trim($buff[1]);
|
- |
|
183 |
} elseif ($params2 != '') {
|
- |
|
184 |
$mem[trim($params[1])] = $params2;
|
- |
|
185 |
}
|
- |
|
186 |
}
|
- |
|
187 |
if (isset($mem['Size']) && preg_match('/^(\d+)\s(M|G)B$/', $mem['Size'], $size) && ($size[1] > 0)) {
|
171 |
if (isset($mem['Size']) && preg_match('/^(\d+)\s(M|G)B$/', $mem['Size'], $size) && ($size[1] > 0)) {
|
188 |
$dev = new HWDevice();
|
172 |
$dev = new HWDevice();
|
189 |
$name = '';
|
173 |
$name = '';
|
190 |
if (isset($mem['Part Number']) && !preg_match("/^PartNum\d+$/", $part = $mem['Part Number']) && ($part != 'None') && ($part != 'N/A') && ($part != 'Not Specified') && ($part != 'NOT AVAILABLE')) {
|
174 |
if (isset($mem['Part Number']) && !preg_match("/^PartNum\d+$/", $part = $mem['Part Number']) && ($part != 'None') && ($part != 'N/A') && ($part != 'Not Specified') && ($part != 'NOT AVAILABLE')) {
|
191 |
$name = $part;
|
175 |
$name = $part;
|
Line 219... |
Line 203... |
219 |
$dev->setCapacity($size[1]*1024*1024);
|
203 |
$dev->setCapacity($size[1]*1024*1024);
|
220 |
}
|
204 |
}
|
221 |
$memtype = '';
|
205 |
$memtype = '';
|
222 |
if (isset($mem['Type']) && (($type = $mem['Type']) != 'None') && ($type != 'N/A') && ($type != 'Not Specified') && ($type != 'Other') && ($type != 'Unknown') && ($type != '<OUT OF SPEC>')) {
|
206 |
if (isset($mem['Type']) && (($type = $mem['Type']) != 'None') && ($type != 'N/A') && ($type != 'Not Specified') && ($type != 'Other') && ($type != 'Unknown') && ($type != '<OUT OF SPEC>')) {
|
223 |
if (isset($mem['Speed']) && preg_match('/^(\d+)\s(MHz|MT\/s)/', $mem['Speed'], $speed) && ($speed[1] > 0) && (preg_match('/^(DDR\d*)(.*)/', $type, $dr) || preg_match('/^(SDR)AM(.*)/', $type, $dr))) {
|
207 |
if (isset($mem['Speed']) && preg_match('/^(\d+)\s(MHz|MT\/s)/', $mem['Speed'], $speed) && ($speed[1] > 0) && (preg_match('/^(DDR\d*)(.*)/', $type, $dr) || preg_match('/^(SDR)AM(.*)/', $type, $dr))) {
|
224 |
if (isset($mem['Minimum Voltage']) && isset($mem['Total Width']) &&
|
208 |
if (isset($mem['Minimum Voltage']) && isset($mem['Maximum Voltage']) &&
|
225 |
preg_match('/^([\d\.]+)\sV$/', $mem['Minimum Voltage'], $minv) && preg_match('/^([\d\.]+)\sV$/', $mem['Maximum Voltage'], $maxv) &&
|
209 |
preg_match('/^([\d\.]+)\sV$/', $mem['Minimum Voltage'], $minv) && preg_match('/^([\d\.]+)\sV$/', $mem['Maximum Voltage'], $maxv) &&
|
226 |
($minv[1] > 0) && ($maxv[1] >0) && ($minv[1] < $maxv[1])) {
|
210 |
($minv[1] > 0) && ($maxv[1] >0) && ($minv[1] < $maxv[1])) {
|
227 |
$lv = 'L';
|
211 |
$lv = 'L';
|
228 |
} else {
|
212 |
} else {
|
229 |
$lv = '';
|
213 |
$lv = '';
|