diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/html.inc.php | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/inc/html.inc.php b/inc/html.inc.php index b4d295a..c657f86 100644 --- a/inc/html.inc.php +++ b/inc/html.inc.php | |||
@@ -219,7 +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 | |||
224 | if ($CONFIG['showmem']) { | ||
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'); | ||
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'); | ||
229 | |||
230 | # ignore if file does not exist | ||
231 | if (!$rrd_info_mu || !$rrd_info_mf || !$rrd_info_bf || !$rrd_info_ca) | ||
232 | continue; | ||
233 | |||
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]) ) { | ||
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 | |||
238 | $class = ''; | ||
239 | if ($percent_mem > 90) | ||
240 | $class = ' class="crit"'; | ||
241 | elseif ($percent_mem > 70) | ||
242 | $class = ' class="warn"'; | ||
243 | |||
244 | printf('<td%s>%d</td>', $class, $percent_mem); | ||
245 | } | ||
246 | } | ||
223 | 247 | ||
224 | print "</tr>\n"; | 248 | print "</tr>\n"; |
225 | } | 249 | } |