Line 43... |
Line 43... |
43 |
} elseif (preg_match("/^: \"(.*)\"/", $cpu, $ar_buf)) {
|
43 |
} elseif (preg_match("/^: \"(.*)\"/", $cpu, $ar_buf)) {
|
44 |
$dev = new CpuDevice();
|
44 |
$dev = new CpuDevice();
|
45 |
$dev->setModel($ar_buf[1]);
|
45 |
$dev->setModel($ar_buf[1]);
|
46 |
$arrLines = preg_split("/\n/", $cpu, -1, PREG_SPLIT_NO_EMPTY);
|
46 |
$arrLines = preg_split("/\n/", $cpu, -1, PREG_SPLIT_NO_EMPTY);
|
47 |
foreach ($arrLines as $Line) {
|
47 |
foreach ($arrLines as $Line) {
|
48 |
if (preg_match("/^\s+Data TLB:\s+(.*)K-byte/", $Line, $Line_buf)) {
|
48 |
if (preg_match("/^\s+Data TLB:\s+(.*)K-byte/", $Line, $Line_buf) || preg_match("/^\s+L0 Data TLB:\s+(.*)K-byte/", $Line, $Line_buf)) {
|
49 |
$dev->setCache(max($Line_buf[1]*1024, $dev->getCache()));
|
49 |
$dev->setCache(max(intval($Line_buf[1])*1024, $dev->getCache()));
|
50 |
} elseif (preg_match("/^\s+Data TLB:\s+(.*)M-byte/", $Line, $Line_buf)) {
|
50 |
} elseif (preg_match("/^\s+Data TLB:\s+(.*)M-byte/", $Line, $Line_buf) || preg_match("/^\s+L0 Data TLB:\s+(.*)M-byte/", $Line, $Line_buf)) {
|
51 |
$dev->setCache(max($Line_buf[1]*1024*1024, $dev->getCache()));
|
51 |
$dev->setCache(max(intval($Line_buf[1])*1024*1024, $dev->getCache()));
|
52 |
} elseif (preg_match("/^\s+Data TLB:\s+(.*)G-byte/", $Line, $Line_buf)) {
|
52 |
} elseif (preg_match("/^\s+Data TLB:\s+(.*)G-byte/", $Line, $Line_buf) || preg_match("/^\s+L0 Data TLB:\s+(.*)G-byte/", $Line, $Line_buf)) {
|
53 |
$dev->setCache(max($Line_buf[1]*1024*1024*1024, $dev->getCache()));
|
53 |
$dev->setCache(max(intval($Line_buf[1])*1024*1024*1024, $dev->getCache()));
|
54 |
} elseif (preg_match("/\s+VMX/", $Line, $Line_buf)) {
|
54 |
} elseif (preg_match("/\s+VMX/", $Line, $Line_buf)) {
|
55 |
$dev->setVirt("vmx");
|
55 |
$dev->setVirt("vmx");
|
56 |
} elseif (preg_match("/\s+SVM/", $Line, $Line_buf)) {
|
56 |
} elseif (preg_match("/\s+SVM/", $Line, $Line_buf)) {
|
57 |
$dev->setVirt("svm");
|
57 |
$dev->setVirt("svm");
|
58 |
}
|
58 |
}
|
Line 154... |
Line 154... |
154 |
*
|
154 |
*
|
155 |
* @return void
|
155 |
* @return void
|
156 |
*/
|
156 |
*/
|
157 |
private function _uptime()
|
157 |
private function _uptime()
|
158 |
{
|
158 |
{
|
159 |
if (CommonFunctions::executeProgram('uptime', '-u', $buf)) {
|
159 |
if (CommonFunctions::executeProgram('uptime', '', $buf)) {
|
160 |
if (preg_match("/^up (\d+) minute[s]?/", $buf, $ar_buf)) {
|
160 |
if (preg_match("/up (\d+) day[s]?,[ ]+(\d+):(\d+),/", $buf, $ar_buf)) {
|
161 |
$min = $ar_buf[1];
|
161 |
$min = $ar_buf[3];
|
- |
|
162 |
$hours = $ar_buf[2];
|
- |
|
163 |
$days = $ar_buf[1];
|
162 |
$this->sys->setUptime($min * 60);
|
164 |
$this->sys->setUptime($days * 86400 + $hours * 3600 + $min * 60);
|
163 |
} elseif (preg_match("/^up (\d+) hour[s]?, (\d+) minute[s]?/", $buf, $ar_buf)) {
|
165 |
} elseif (preg_match("/up[ ]+(\d+):(\d+),/", $buf, $ar_buf)) {
|
164 |
$min = $ar_buf[2];
|
166 |
$min = $ar_buf[2];
|
165 |
$hours = $ar_buf[1];
|
167 |
$hours = $ar_buf[1];
|
166 |
$this->sys->setUptime($hours * 3600 + $min * 60);
|
168 |
$this->sys->setUptime($hours * 3600 + $min * 60);
|
167 |
} elseif (preg_match("/^up (\d+) day[s]?, (\d+) hour[s]?, (\d+) minute[s]?/", $buf, $ar_buf)) {
|
169 |
} elseif (preg_match("/up (\d+) day[s]?, (\d+) hour[s]?, (\d+) minute[s]?$/", $buf, $ar_buf)) {
|
168 |
$min = $ar_buf[3];
|
170 |
$min = $ar_buf[3];
|
169 |
$hours = $ar_buf[2];
|
171 |
$hours = $ar_buf[2];
|
170 |
$days = $ar_buf[1];
|
172 |
$days = $ar_buf[1];
|
171 |
$this->sys->setUptime($days * 86400 + $hours * 3600 + $min * 60);
|
173 |
$this->sys->setUptime($days * 86400 + $hours * 3600 + $min * 60);
|
- |
|
174 |
} elseif (preg_match("/up (\d+) hour[s]?, (\d+) minute[s]?$/", $buf, $ar_buf)) {
|
- |
|
175 |
$min = $ar_buf[2];
|
- |
|
176 |
$hours = $ar_buf[1];
|
- |
|
177 |
$this->sys->setUptime($hours * 3600 + $min * 60);
|
- |
|
178 |
} elseif (preg_match("/up (\d+) minute[s]?$/", $buf, $ar_buf)) {
|
- |
|
179 |
$min = $ar_buf[1];
|
- |
|
180 |
$this->sys->setUptime($min * 60);
|
172 |
}
|
181 |
}
|
173 |
}
|
182 |
}
|
174 |
}
|
183 |
}
|
175 |
|
184 |
|
176 |
/**
|
185 |
/**
|
Line 229... |
Line 238... |
229 |
{
|
238 |
{
|
230 |
if (CommonFunctions::executeProgram('sysinfo', '-mem', $bufr, PSI_DEBUG)) {
|
239 |
if (CommonFunctions::executeProgram('sysinfo', '-mem', $bufr, PSI_DEBUG)) {
|
231 |
if (preg_match("/(.*)bytes free\s+\(used\/max\s+(.*)\s+\/\s+(.*)\)\s*\n\s+\(cached\s+(.*)\)/", $bufr, $ar_buf)) {
|
240 |
if (preg_match("/(.*)bytes free\s+\(used\/max\s+(.*)\s+\/\s+(.*)\)\s*\n\s+\(cached\s+(.*)\)/", $bufr, $ar_buf)) {
|
232 |
$this->sys->setMemTotal($ar_buf[3]);
|
241 |
$this->sys->setMemTotal($ar_buf[3]);
|
233 |
$this->sys->setMemFree($ar_buf[1]);
|
242 |
$this->sys->setMemFree($ar_buf[1]);
|
234 |
$this->sys->setMemCache($ar_buf[4]);
|
243 |
$this->sys->setMemCache(min($ar_buf[4], $ar_buf[2]));
|
235 |
$this->sys->setMemUsed($ar_buf[2]);
|
244 |
$this->sys->setMemUsed($ar_buf[2]);
|
236 |
}
|
245 |
}
|
237 |
}
|
246 |
}
|
238 |
if (CommonFunctions::executeProgram('vmstat', '', $bufr, PSI_DEBUG)) {
|
247 |
if (CommonFunctions::executeProgram('vmstat', '', $bufr, PSI_DEBUG)) {
|
239 |
if (preg_match("/max swap space:\s+(.*)\nfree swap space:\s+(.*)\n/", $bufr, $ar_buf)) {
|
248 |
if (preg_match("/max swap space:\s+(.*)\nfree swap space:\s+(.*)\n/", $bufr, $ar_buf)) {
|