From 5c7fccfe8b5aa792f4adafa0c1281c69a8453fbc Mon Sep 17 00:00:00 2001 From: David Severwright Date: Thu, 11 Dec 2014 15:12:46 +0000 Subject: Adding option to show time since last update on dashboard. Closes #110 --- conf/config.php | 1 + inc/html.inc.php | 13 +++++++++++++ layout/style.css | 5 +++++ 3 files changed, 19 insertions(+) diff --git a/conf/config.php b/conf/config.php index 157012a..ec55d30 100644 --- a/conf/config.php +++ b/conf/config.php @@ -32,6 +32,7 @@ $CONFIG['time_range']['uptime'] = 31536000; # show load averages and used memory on overview page $CONFIG['showload'] = true; $CONFIG['showmem'] = false; +$CONFIG['showtime'] = false; $CONFIG['term'] = array( '2hour' => 3600 * 2, diff --git a/inc/html.inc.php b/inc/html.inc.php index bc22ba3..a263a58 100644 --- a/inc/html.inc.php +++ b/inc/html.inc.php @@ -281,6 +281,19 @@ function host_summary($cat, $hosts) { } } + if ($CONFIG['showtime']) { + $rrd_info = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/load/load.rrd'); + $time = time() - $rrd_info['last_update']; + + $class = 'wide'; + if ($time > 300) + $class .= ' crit'; + elseif ($time > 60) + $class .= ' warn'; + + printf('%d seconds ago',$class, $time); + } + print "\n"; } diff --git a/layout/style.css b/layout/style.css index 19ec77e..1360b36 100644 --- a/layout/style.css +++ b/layout/style.css @@ -68,6 +68,11 @@ table.summary td { text-align: right; } +table.summary td.wide { + width: 200px; + text-align: right; +} + img { border: 0; } -- cgit v1.1