diff options
author | Pim van den Berg | 2010-06-26 17:03:43 +0200 |
---|---|---|
committer | Pim van den Berg | 2010-06-26 17:03:43 +0200 |
commit | 84005a744d2d6073296ab3fe7d3aa670a0cfe61b (patch) | |
tree | 94787f0ffdf16db45904f77926780e575465b5c9 | |
parent | Fix typo: Celsius instead of Celius (diff) | |
download | apt-panopticon_cgp-84005a744d2d6073296ab3fe7d3aa670a0cfe61b.zip apt-panopticon_cgp-84005a744d2d6073296ab3fe7d3aa670a0cfe61b.tar.gz apt-panopticon_cgp-84005a744d2d6073296ab3fe7d3aa670a0cfe61b.tar.bz2 apt-panopticon_cgp-84005a744d2d6073296ab3fe7d3aa670a0cfe61b.tar.xz |
default graph time range is now configurable (not only for uptime)
Diffstat (limited to '')
-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) { |