CPU : changes on retrieving CPU information

Load Average and CPU : fix on recovery the number of CPU cores
Last login : the datas are retrieved differently
This commit is contained in:
ShevAbam
2015-01-16 18:14:07 +01:00
parent c3ec82dd6f
commit 3ed4c1d633
6 changed files with 42 additions and 26 deletions
+2 -4
View File
@@ -5,11 +5,10 @@ $Config = new Config();
$datas = array();
if (!(exec('/usr/bin/lastlog --time 365 | /usr/bin/awk \'{print $1","$3","$4" "$5" "$6" "$7" "$8}\'', $users)))
if (!(exec('/usr/bin/lastlog --time 365 | /usr/bin/awk -F\' \' \'{ print $1";"$5, $4, $8, $6}\'', $users)))
{
$datas[] = array(
'user' => 'N.A',
'host' => 'N.A',
'date' => 'N.A',
);
}
@@ -19,11 +18,10 @@ else
for ($i = 1; $i < count($users) && $i <= $max; $i++)
{
list($user, $host, $date) = explode(',', $users[$i]);
list($user, $date) = explode(';', $users[$i]);
$datas[] = array(
'user' => $user,
'host' => $host,
'date' => $date,
);
}