aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPim van den Berg2014-04-14 23:59:11 +0200
committerPim van den Berg2014-04-15 00:01:45 +0200
commit3099174fb5191b396ed00e246ec149686a8e0447 (patch)
tree2ed0ee8fae798d45edc357b1b4d368a57cda3e10
parentoverview: show used memory percentage (diff)
downloadapt-panopticon_cgp-3099174fb5191b396ed00e246ec149686a8e0447.zip
apt-panopticon_cgp-3099174fb5191b396ed00e246ec149686a8e0447.tar.gz
apt-panopticon_cgp-3099174fb5191b396ed00e246ec149686a8e0447.tar.bz2
apt-panopticon_cgp-3099174fb5191b396ed00e246ec149686a8e0447.tar.xz
overview: disable showmem by default, add percent sign
And change all spaces to tabs.
-rw-r--r--conf/config.php2
-rw-r--r--inc/html.inc.php50
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;
28 28
29# show load averages and used memory on overview page 29# show load averages and used memory on overview page
30$CONFIG['showload'] = true; 30$CONFIG['showload'] = true;
31$CONFIG['showmem'] = true; 31$CONFIG['showmem'] = false;
32 32
33$CONFIG['term'] = array( 33$CONFIG['term'] = array(
34 '2hour' => 3600 * 2, 34 '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) {
219 printf('<td%s>%.2f</td>', $class, $rrd_info[$info]); 219 printf('<td%s>%.2f</td>', $class, $rrd_info[$info]);
220 } 220 }
221 } 221 }
222 } 222 }
223 223
224 if ($CONFIG['showmem']) { 224 if ($CONFIG['showmem']) {
225 $rrd_info_mu = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/memory/memory-used.rrd'); 225 $rrd_info_mu = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/memory/memory-used.rrd');
226 $rrd_info_mf = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/memory/memory-free.rrd'); 226 $rrd_info_mf = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/memory/memory-free.rrd');
227 $rrd_info_bf = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/memory/memory-buffered.rrd'); 227 $rrd_info_bf = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/memory/memory-buffered.rrd');
228 $rrd_info_ca = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/memory/memory-cached.rrd'); 228 $rrd_info_ca = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/memory/memory-cached.rrd');
229 229
230 # ignore if file does not exist 230 # ignore if file does not exist
231 if (!$rrd_info_mu || !$rrd_info_mf || !$rrd_info_bf || !$rrd_info_ca) 231 if (!$rrd_info_mu || !$rrd_info_mf || !$rrd_info_bf || !$rrd_info_ca)
232 continue; 232 continue;
233 233
234 $info='ds[value].last_ds'; 234 $info='ds[value].last_ds';
235 if (isset($rrd_info_mu[$info]) && isset($rrd_info_mf[$info]) && isset($rrd_info_bf[$info]) && isset($rrd_info_ca[$info]) ) { 235 if (isset($rrd_info_mu[$info]) && isset($rrd_info_mf[$info]) && isset($rrd_info_bf[$info]) && isset($rrd_info_ca[$info]) ) {
236 $percent_mem = $rrd_info_mu[$info] * 100 / ($rrd_info_mu[$info] + $rrd_info_mf[$info] + $rrd_info_bf[$info] + $rrd_info_ca[$info]); 236 $percent_mem = $rrd_info_mu[$info] * 100 / ($rrd_info_mu[$info] + $rrd_info_mf[$info] + $rrd_info_bf[$info] + $rrd_info_ca[$info]);
237 237
238 $class = ''; 238 $class = '';
239 if ($percent_mem > 90) 239 if ($percent_mem > 90)
240 $class = ' class="crit"'; 240 $class = ' class="crit"';
241 elseif ($percent_mem > 70) 241 elseif ($percent_mem > 70)
242 $class = ' class="warn"'; 242 $class = ' class="warn"';
243 243
244 printf('<td%s>%d</td>', $class, $percent_mem); 244 printf('<td%s>%d%%</td>', $class, $percent_mem);
245 } 245 }
246 } 246 }
247 247
248 print "</tr>\n"; 248 print "</tr>\n";
249 } 249 }