aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--conf/config.php2
-rw-r--r--host.php4
-rw-r--r--inc/collectd.inc.php13
3 files changed, 17 insertions, 2 deletions
diff --git a/conf/config.php b/conf/config.php
index b2fdc78..6755582 100644
--- a/conf/config.php
+++ b/conf/config.php
@@ -18,6 +18,8 @@ $CONFIG['rrdtool_opts'] = '';
18# default plugins to show on host page 18# default plugins to show on host page
19$CONFIG['overview'] = array('load', 'cpu', 'memory', 'swap'); 19$CONFIG['overview'] = array('load', 'cpu', 'memory', 'swap');
20 20
21$CONFIG['overview_filter']['interface'] = array('ti' => 'eth0', 't' => 'if_octets');
22
21# default plugins time range 23# default plugins time range
22$CONFIG['time_range']['default'] = 86400; 24$CONFIG['time_range']['default'] = 86400;
23$CONFIG['time_range']['uptime'] = 31536000; 25$CONFIG['time_range']['uptime'] = 31536000;
diff --git a/host.php b/host.php
index 71d786a..363e9d5 100644
--- a/host.php
+++ b/host.php
@@ -22,11 +22,13 @@ if(!$plugins) {
22 22
23plugins_list($host, $selected_plugins); 23plugins_list($host, $selected_plugins);
24 24
25$overview = empty($plugin) ? true : false;
26
25echo '<div class="graphs">'; 27echo '<div class="graphs">';
26foreach ($selected_plugins as $selected_plugin) { 28foreach ($selected_plugins as $selected_plugin) {
27 if (in_array($selected_plugin, $plugins)) { 29 if (in_array($selected_plugin, $plugins)) {
28 plugin_header($host, $selected_plugin); 30 plugin_header($host, $selected_plugin);
29 graphs_from_plugin($host, $selected_plugin); 31 graphs_from_plugin($host, $selected_plugin, $overview);
30 } 32 }
31} 33}
32echo '</div>'; 34echo '</div>';
diff --git a/inc/collectd.inc.php b/inc/collectd.inc.php
index 56c5a2d..e8f3662 100644
--- a/inc/collectd.inc.php
+++ b/inc/collectd.inc.php
@@ -147,14 +147,25 @@ function plugin_sort($data) {
147} 147}
148 148
149# generate graph url's for a plugin of a host 149# generate graph url's for a plugin of a host
150function graphs_from_plugin($host, $plugin) { 150function graphs_from_plugin($host, $plugin, $overview=false) {
151 global $CONFIG; 151 global $CONFIG;
152 152
153 $plugindata = collectd_plugindata($host, $plugin); 153 $plugindata = collectd_plugindata($host, $plugin);
154 $plugindata = group_plugindata($plugindata); 154 $plugindata = group_plugindata($plugindata);
155 $plugindata = plugin_sort($plugindata); 155 $plugindata = plugin_sort($plugindata);
156 156
157 $f = array();
158
159 if ($overview == true && isset($CONFIG['overview_filter'][$plugin])) {
160 $f = $CONFIG['overview_filter'][$plugin];
161 }
162
157 foreach ($plugindata as $items) { 163 foreach ($plugindata as $items) {
164
165 if (!empty($f) && ($f !== array_intersect_assoc($f, $items))) {
166 continue;
167 }
168
158 $items['h'] = $host; 169 $items['h'] = $host;
159 170
160 $time = array_key_exists($plugin, $CONFIG['time_range']) 171 $time = array_key_exists($plugin, $CONFIG['time_range'])