diff options
| -rw-r--r-- | conf/config.php | 3 | ||||
| -rw-r--r-- | inc/html.inc.php | 30 |
2 files changed, 19 insertions, 14 deletions
diff --git a/conf/config.php b/conf/config.php index b402b7f..d31b129 100644 --- a/conf/config.php +++ b/conf/config.php | |||
| @@ -15,6 +15,9 @@ $CONFIG['rrdtool'] = '/usr/bin/rrdtool'; | |||
| 15 | # default plugins to show on host page | 15 | # default plugins to show on host page |
| 16 | $CONFIG['overview'] = array('load', 'cpu', 'memory', 'swap'); | 16 | $CONFIG['overview'] = array('load', 'cpu', 'memory', 'swap'); |
| 17 | 17 | ||
| 18 | # show load averages on overview page | ||
| 19 | $CONFIG['showload'] = true; | ||
| 20 | |||
| 18 | # browser cache time for the graphs (in seconds) | 21 | # browser cache time for the graphs (in seconds) |
| 19 | $CONFIG['cache'] = 90; | 22 | $CONFIG['cache'] = 90; |
| 20 | 23 | ||
diff --git a/inc/html.inc.php b/inc/html.inc.php index c524e46..a05aab6 100644 --- a/inc/html.inc.php +++ b/inc/html.inc.php | |||
| @@ -67,24 +67,26 @@ function host_summary($hosts) { | |||
| 67 | echo "<table class=\"summary\">\n"; | 67 | echo "<table class=\"summary\">\n"; |
| 68 | 68 | ||
| 69 | foreach($hosts as $host) { | 69 | foreach($hosts as $host) { |
| 70 | collectd_flush(sprintf('%s/load/load', $host)); | ||
| 71 | $rrd_info = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/load/load.rrd'); | ||
| 72 | |||
| 73 | # ignore if file does not exist | ||
| 74 | if (!$rrd_info) | ||
| 75 | continue; | ||
| 76 | |||
| 77 | printf('<tr><th><a href="%s/host.php?h=%s">%s</a></th>', | 70 | printf('<tr><th><a href="%s/host.php?h=%s">%s</a></th>', |
| 78 | $CONFIG['weburl'],$host, $host); | 71 | $CONFIG['weburl'],$host, $host); |
| 79 | 72 | ||
| 80 | if (isset($rrd_info['ds[shortterm].last_ds']) && | 73 | if ($CONFIG['showload']) { |
| 81 | isset($rrd_info['ds[midterm].last_ds']) && | 74 | collectd_flush(sprintf('%s/load/load', $host)); |
| 82 | isset($rrd_info['ds[longterm].last_ds'])) { | 75 | $rrd_info = $rrd->rrd_info($CONFIG['datadir'].'/'.$host.'/load/load.rrd'); |
| 76 | |||
| 77 | # ignore if file does not exist | ||
| 78 | if (!$rrd_info) | ||
| 79 | continue; | ||
| 80 | |||
| 81 | if (isset($rrd_info['ds[shortterm].last_ds']) && | ||
| 82 | isset($rrd_info['ds[midterm].last_ds']) && | ||
| 83 | isset($rrd_info['ds[longterm].last_ds'])) { | ||
| 83 | 84 | ||
| 84 | printf('<td>%.2f</td><td>%.2f</td><td>%.2f</td>', | 85 | printf('<td>%.2f</td><td>%.2f</td><td>%.2f</td>', |
| 85 | $rrd_info['ds[shortterm].last_ds'], | 86 | $rrd_info['ds[shortterm].last_ds'], |
| 86 | $rrd_info['ds[midterm].last_ds'], | 87 | $rrd_info['ds[midterm].last_ds'], |
| 87 | $rrd_info['ds[longterm].last_ds']); | 88 | $rrd_info['ds[longterm].last_ds']); |
| 89 | } | ||
| 88 | } | 90 | } |
| 89 | 91 | ||
| 90 | print "</tr>\n"; | 92 | print "</tr>\n"; |
