aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc')
-rw-r--r--inc/html.inc.php48
1 files changed, 23 insertions, 25 deletions
diff --git a/inc/html.inc.php b/inc/html.inc.php
index 98081ce..58813ea 100644
--- a/inc/html.inc.php
+++ b/inc/html.inc.php
@@ -243,11 +243,8 @@ function host_summary($cat, $hosts) {
243 243
244 $rrd_info = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/load/load.rrd'); 244 $rrd_info = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/load/load.rrd');
245 245
246 # ignore if file does not exist 246 if ($rrd_info &&
247 if (!$rrd_info) 247 isset($rrd_info['ds[shortterm].last_ds']) &&
248 continue;
249
250 if (isset($rrd_info['ds[shortterm].last_ds']) &&
251 isset($rrd_info['ds[midterm].last_ds']) && 248 isset($rrd_info['ds[midterm].last_ds']) &&
252 isset($rrd_info['ds[longterm].last_ds'])) { 249 isset($rrd_info['ds[longterm].last_ds'])) {
253 250
@@ -272,35 +269,36 @@ function host_summary($cat, $hosts) {
272 $rrd_info_ca = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/memory/memory-cached.rrd'); 269 $rrd_info_ca = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/memory/memory-cached.rrd');
273 270
274 # ignore if file does not exist 271 # ignore if file does not exist
275 if (!$rrd_info_mu || !$rrd_info_mf || !$rrd_info_bf || !$rrd_info_ca) 272 if ($rrd_info_mu && $rrd_info_mf && $rrd_info_bf && $rrd_info_ca) {
276 continue; 273 $info='ds[value].last_ds';
274 if (isset($rrd_info_mu[$info]) && isset($rrd_info_mf[$info]) && isset($rrd_info_bf[$info]) && isset($rrd_info_ca[$info]) ) {
275 $percent_mem = $rrd_info_mu[$info] * 100 / ($rrd_info_mu[$info] + $rrd_info_mf[$info] + $rrd_info_bf[$info] + $rrd_info_ca[$info]);
277 276
278 $info='ds[value].last_ds'; 277 $class = '';
279 if (isset($rrd_info_mu[$info]) && isset($rrd_info_mf[$info]) && isset($rrd_info_bf[$info]) && isset($rrd_info_ca[$info]) ) { 278 if ($percent_mem > 90)
280 $percent_mem = $rrd_info_mu[$info] * 100 / ($rrd_info_mu[$info] + $rrd_info_mf[$info] + $rrd_info_bf[$info] + $rrd_info_ca[$info]); 279 $class = ' class="crit"';
281 280 elseif ($percent_mem > 70)
282 $class = ''; 281 $class = ' class="warn"';
283 if ($percent_mem > 90)
284 $class = ' class="crit"';
285 elseif ($percent_mem > 70)
286 $class = ' class="warn"';
287 282
288 printf('<td%s>%d%%</td>', $class, $percent_mem); 283 printf('<td%s>%d%%</td>', $class, $percent_mem);
284 }
289 } 285 }
290 } 286 }
291 287
292 if ($CONFIG['showtime']) { 288 if ($CONFIG['showtime']) {
293 $rrd_info = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/load/load.rrd'); 289 $rrd_info = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/load/load.rrd');
294 $time = time() - $rrd_info['last_update']; 290 if ($rrd_info) {
291 $time = time() - $rrd_info['last_update'];
295 292
296 $class = 'wide'; 293 $class = 'wide';
297 if ($time > 300) 294 if ($time > 300)
298 $class .= ' crit'; 295 $class .= ' crit';
299 elseif ($time > 60) 296 elseif ($time > 60)
300 $class .= ' warn'; 297 $class .= ' warn';
301 298
302 printf('<td class="%s"><time class="timeago" datetime="%s">%d seconds ago</time></td>', 299 printf('<td class="%s"><time class="timeago" datetime="%s">%d seconds ago</time></td>',
303 $class, date('c', $rrd_info['last_update']), $time); 300 $class, date('c', $rrd_info['last_update']), $time);
301 }
304 } 302 }
305 303
306 print "</tr>\n"; 304 print "</tr>\n";