From 3099174fb5191b396ed00e246ec149686a8e0447 Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Mon, 14 Apr 2014 23:59:11 +0200 Subject: overview: disable showmem by default, add percent sign And change all spaces to tabs. --- conf/config.php | 2 +- inc/html.inc.php | 50 +++++++++++++++++++++++++------------------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/conf/config.php b/conf/config.php index 246d378..86b0870 100644 --- a/conf/config.php +++ b/conf/config.php @@ -28,7 +28,7 @@ $CONFIG['time_range']['uptime'] = 31536000; # show load averages and used memory on overview page $CONFIG['showload'] = true; -$CONFIG['showmem'] = true; +$CONFIG['showmem'] = false; $CONFIG['term'] = array( '2hour' => 3600 * 2, diff --git a/inc/html.inc.php b/inc/html.inc.php index c657f86..01e7328 100644 --- a/inc/html.inc.php +++ b/inc/html.inc.php @@ -219,31 +219,31 @@ function host_summary($cat, $hosts) { printf('%.2f', $class, $rrd_info[$info]); } } - } - - if ($CONFIG['showmem']) { - $rrd_info_mu = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/memory/memory-used.rrd'); - $rrd_info_mf = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/memory/memory-free.rrd'); - $rrd_info_bf = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/memory/memory-buffered.rrd'); - $rrd_info_ca = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/memory/memory-cached.rrd'); - - # ignore if file does not exist - if (!$rrd_info_mu || !$rrd_info_mf || !$rrd_info_bf || !$rrd_info_ca) - continue; - - $info='ds[value].last_ds'; - if (isset($rrd_info_mu[$info]) && isset($rrd_info_mf[$info]) && isset($rrd_info_bf[$info]) && isset($rrd_info_ca[$info]) ) { - $percent_mem = $rrd_info_mu[$info] * 100 / ($rrd_info_mu[$info] + $rrd_info_mf[$info] + $rrd_info_bf[$info] + $rrd_info_ca[$info]); - - $class = ''; - if ($percent_mem > 90) - $class = ' class="crit"'; - elseif ($percent_mem > 70) - $class = ' class="warn"'; - - printf('%d', $class, $percent_mem); - } - } + } + + if ($CONFIG['showmem']) { + $rrd_info_mu = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/memory/memory-used.rrd'); + $rrd_info_mf = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/memory/memory-free.rrd'); + $rrd_info_bf = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/memory/memory-buffered.rrd'); + $rrd_info_ca = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/memory/memory-cached.rrd'); + + # ignore if file does not exist + if (!$rrd_info_mu || !$rrd_info_mf || !$rrd_info_bf || !$rrd_info_ca) + continue; + + $info='ds[value].last_ds'; + if (isset($rrd_info_mu[$info]) && isset($rrd_info_mf[$info]) && isset($rrd_info_bf[$info]) && isset($rrd_info_ca[$info]) ) { + $percent_mem = $rrd_info_mu[$info] * 100 / ($rrd_info_mu[$info] + $rrd_info_mf[$info] + $rrd_info_bf[$info] + $rrd_info_ca[$info]); + + $class = ''; + if ($percent_mem > 90) + $class = ' class="crit"'; + elseif ($percent_mem > 70) + $class = ' class="warn"'; + + printf('%d%%', $class, $percent_mem); + } + } print "\n"; } -- cgit v1.1