diff options
| -rw-r--r-- | conf/config.php | 3 | ||||
| -rw-r--r-- | inc/collectd.inc.php | 8 |
2 files changed, 7 insertions, 4 deletions
diff --git a/conf/config.php b/conf/config.php index cebdc39..fccd250 100644 --- a/conf/config.php +++ b/conf/config.php | |||
| @@ -19,7 +19,8 @@ $CONFIG['rrdtool_opts'] = ''; | |||
| 19 | $CONFIG['overview'] = array('load', 'cpu', 'memory', 'swap'); | 19 | $CONFIG['overview'] = array('load', 'cpu', 'memory', 'swap'); |
| 20 | 20 | ||
| 21 | # default plugins time range | 21 | # default plugins time range |
| 22 | $CONFIG['time_range'] = array('uptime' => 31536000); | 22 | $CONFIG['time_range']['default'] = 86400; |
| 23 | $CONFIG['time_range']['uptime'] = 31536000; | ||
| 23 | 24 | ||
| 24 | # show load averages on overview page | 25 | # show load averages on overview page |
| 25 | $CONFIG['showload'] = true; | 26 | $CONFIG['showload'] = true; |
diff --git a/inc/collectd.inc.php b/inc/collectd.inc.php index 4e5d0e4..f5769c0 100644 --- a/inc/collectd.inc.php +++ b/inc/collectd.inc.php | |||
| @@ -130,7 +130,7 @@ function graphs_from_plugin($host, $plugin) { | |||
| 130 | 130 | ||
| 131 | $time = array_key_exists($plugin, $CONFIG['time_range']) | 131 | $time = array_key_exists($plugin, $CONFIG['time_range']) |
| 132 | ? $CONFIG['time_range'][$plugin] | 132 | ? $CONFIG['time_range'][$plugin] |
| 133 | : 86400; | 133 | : $CONFIG['time_range']['default']; |
| 134 | 134 | ||
| 135 | printf('<a href="%s/%s"><img src="%s/%s"></a>'."\n", | 135 | printf('<a href="%s/%s"><img src="%s/%s"></a>'."\n", |
| 136 | $CONFIG['weburl'], | 136 | $CONFIG['weburl'], |
| @@ -144,12 +144,14 @@ function graphs_from_plugin($host, $plugin) { | |||
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | # generate an url with GET values from $items | 146 | # generate an url with GET values from $items |
| 147 | function build_url($base, $items, $s=86400) { | 147 | function build_url($base, $items, $s=NULL) { |
| 148 | global $CONFIG; | ||
| 149 | |||
| 148 | if (!is_array($items)) | 150 | if (!is_array($items)) |
| 149 | return false; | 151 | return false; |
| 150 | 152 | ||
| 151 | if (!is_numeric($s)) | 153 | if (!is_numeric($s)) |
| 152 | return false; | 154 | $s = $CONFIG['time_range']['default']; |
| 153 | 155 | ||
| 154 | $i=0; | 156 | $i=0; |
| 155 | foreach ($items as $key => $value) { | 157 | foreach ($items as $key => $value) { |
