summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics
diff options
context:
space:
mode:
authorSimon Rettberg2017-12-01 23:07:06 +0100
committerSimon Rettberg2017-12-01 23:07:06 +0100
commitcfd181a3ee8025ac39886a8ba422fefd8545fb2c (patch)
tree5429814a5afddca3fdfd6c85884ae801199d62f8 /modules-available/statistics
parent[inc/Util] Add helper to pretty-print timestamp (diff)
downloadslx-admin-cfd181a3ee8025ac39886a8ba422fefd8545fb2c.tar.gz
slx-admin-cfd181a3ee8025ac39886a8ba422fefd8545fb2c.tar.xz
slx-admin-cfd181a3ee8025ac39886a8ba422fefd8545fb2c.zip
[syslog, statistics] Pretty print time, shorten CPU model in list
Diffstat (limited to 'modules-available/statistics')
-rw-r--r--modules-available/statistics/page.inc.php21
-rw-r--r--modules-available/statistics/templates/clientlist.html2
2 files changed, 8 insertions, 15 deletions
diff --git a/modules-available/statistics/page.inc.php b/modules-available/statistics/page.inc.php
index d80d4614..fafa7cd2 100644
--- a/modules-available/statistics/page.inc.php
+++ b/modules-available/statistics/page.inc.php
@@ -555,7 +555,7 @@ class Page_Statistics extends Page
$row['hostname'] = $row['clientip'];
}
$row['firstseen_int'] = $row['firstseen'];
- $row['firstseen'] = date('d.m. H:i', $row['firstseen']);
+ $row['firstseen'] = Util::prettyTime($row['firstseen']);
$row['gbram'] = round(round($row['mbram'] / 500) / 2, 1); // Trial and error until we got "expected" rounding..
$row['gbtmp'] = round($row['id44mb'] / 1024);
$row['ramclass'] = $this->ramColorClass($row['mbram']);
@@ -601,10 +601,10 @@ class Page_Statistics extends Page
$singleMachine = false;
}
$row['state_' . $row['state']] = true;
- //$row['firstseen'] = date('d.m.Y H:i', $row['firstseen']);
+ //$row['firstseen'] = Util::prettyTime($row['firstseen']);
$row['lastseen_int'] = $row['lastseen'];
- $row['lastseen'] = date('d.m. H:i', $row['lastseen']);
- //$row['lastboot'] = date('d.m. H:i', $row['lastboot']);
+ $row['lastseen'] = Util::prettyTime($row['lastseen']);
+ //$row['lastboot'] = Util::prettyTime($row['lastboot']);
$row['gbram'] = round(round($row['mbram'] / 500) / 2, 1); // Trial and error until we got "expected" rounding..
$row['gbtmp'] = round($row['id44mb'] / 1024);
$octets = explode('.', $row['clientip']);
@@ -623,6 +623,7 @@ class Page_Statistics extends Page
$row['nohdd'] = true;
}
}
+ $row['cpumodel'] = preg_replace('/\(R\)|\(TM\)|\bintel\b|\bamd\b|\bcpu\b|dual-core|\bdual\s+core\b|\bdual\b|\bprocessor\b/i', ' ', $row['cpumodel']);
$rows[] = $row;
}
if ($singleMachine !== false && $singleMachine !== 'none') {
@@ -882,7 +883,7 @@ class Page_Statistics extends Page
$row['data'] -= ($cutoff - $row['dateline']);
$row['dateline'] = $cutoff;
}
- $row['from'] = date('d.m. H:i', $row['dateline']);
+ $row['from'] = Util::prettyTime($row['dateline']);
$row['duration'] = floor($row['data'] / 86400) . 'd ' . gmdate('H:i', $row['data']);
if ($row['typeid'] === '~offline-length') {
$row['glyph'] = 'off';
@@ -933,21 +934,13 @@ class Page_Statistics extends Page
if (Module::get('syslog') !== false) {
$lres = Database::simpleQuery('SELECT logid, dateline, logtypeid, clientip, description, extra FROM clientlog'
. ' WHERE machineuuid = :uuid ORDER BY logid DESC LIMIT 25', array('uuid' => $client['machineuuid']));
- $today = date('d.m.Y');
- $yesterday = date('d.m.Y', time() - 86400);
$count = 0;
$log = array();
while ($row = $lres->fetch(PDO::FETCH_ASSOC)) {
if (substr($row['description'], -5) === 'on :0' && strpos($row['description'], 'root logged') === false) {
continue;
}
- $day = date('d.m.Y', $row['dateline']);
- if ($day === $today) {
- $day = Dictionary::translate('lang_today');
- } elseif ($day === $yesterday) {
- $day = Dictionary::translate('lang_yesterday');
- }
- $row['date'] = $day . date(' H:i', $row['dateline']);
+ $row['date'] = Util::prettyTime($row['dateline']);
$row['icon'] = $this->eventToIconName($row['logtypeid']);
$log[] = $row;
if (++$count === 10) {
diff --git a/modules-available/statistics/templates/clientlist.html b/modules-available/statistics/templates/clientlist.html
index 0b6fb37f..01ca82f1 100644
--- a/modules-available/statistics/templates/clientlist.html
+++ b/modules-available/statistics/templates/clientlist.html
@@ -63,7 +63,7 @@
{{#rmmodule}}<div class="small">{{lang_runMode}}: <a class="slx-bold" href="?do=runmode&amp;module={{rmmodule}}">{{rmmodule}}</a></div>{{/rmmodule}}
</td>
<td data-sort-value="{{clientip}}"><b><a href="?do=Statistics&amp;show=list&amp;filters=subnet={{subnet}}">{{subnet}}</a>{{lastoctet}}</b><br>{{macaddr}}</td>
- <td data-sort-value="{{lastseen_int}}" class="text-right">{{lastseen}}</td>
+ <td data-sort-value="{{lastseen_int}}" class="text-right text-nowrap">{{lastseen}}</td>
<td class="{{kvmclass}}">{{kvmstate}}</td>
<td data-sort-value="{{gbram}}" class="text-right {{ramclass}}">{{gbram}}&thinsp;GiB</td>
<td data-sort-value="{{gbtmp}}" class="text-right {{hddclass}}">