diff options
author | Pim van den Berg | 2009-09-29 22:07:01 +0200 |
---|---|---|
committer | Pim van den Berg | 2009-09-29 22:07:01 +0200 |
commit | b1f866709a3ce30678e183e08d424247e761ca44 (patch) | |
tree | a52f5aea35f90c1a061929263ff8d0fb7db2542f | |
parent | prevent warning when no categories are defined (diff) | |
download | apt-panopticon_cgp-b1f866709a3ce30678e183e08d424247e761ca44.zip apt-panopticon_cgp-b1f866709a3ce30678e183e08d424247e761ca44.tar.gz apt-panopticon_cgp-b1f866709a3ce30678e183e08d424247e761ca44.tar.bz2 apt-panopticon_cgp-b1f866709a3ce30678e183e08d424247e761ca44.tar.xz |
make width and heigth of graphs configurable
These configuration options have been added:
- width
- heigth
- detail-width
- detail-heigth
-rw-r--r-- | conf/config.php | 7 | ||||
-rw-r--r-- | detail.php | 6 | ||||
-rw-r--r-- | graph.php | 4 | ||||
-rw-r--r-- | inc/collectd.inc.php | 4 |
4 files changed, 17 insertions, 4 deletions
diff --git a/conf/config.php b/conf/config.php index 16a2d34..cbddfb3 100644 --- a/conf/config.php +++ b/conf/config.php | |||
@@ -5,6 +5,13 @@ $CONFIG['datadir'] = '/var/lib/collectd/rrd'; | |||
5 | #$CONFIG['cat']['nethuis'] = array('pepper'); | 5 | #$CONFIG['cat']['nethuis'] = array('pepper'); |
6 | $CONFIG['overview'] = array('load', 'cpu', 'memory', 'swap'); | 6 | $CONFIG['overview'] = array('load', 'cpu', 'memory', 'swap'); |
7 | 7 | ||
8 | # default width/height of the graphs | ||
9 | $CONFIG['width'] = 400; | ||
10 | $CONFIG['heigth'] = 175; | ||
11 | # default width/height of detailed graphs | ||
12 | $CONFIG['detail-width'] = 800; | ||
13 | $CONFIG['detail-heigth'] = 350; | ||
14 | |||
8 | $CONFIG['groupby'] = array( | 15 | $CONFIG['groupby'] = array( |
9 | 'cpu' => 'type', | 16 | 'cpu' => 'type', |
10 | 'irq' => 'type', | 17 | 'irq' => 'type', |
@@ -4,6 +4,12 @@ require_once 'conf/common.inc.php'; | |||
4 | require_once 'inc/html.inc.php'; | 4 | require_once 'inc/html.inc.php'; |
5 | require_once 'inc/collectd.inc.php'; | 5 | require_once 'inc/collectd.inc.php'; |
6 | 6 | ||
7 | # use width/height from config if nothing is given | ||
8 | if (empty($_GET['x'])) | ||
9 | $_GET['x'] = $CONFIG['detail-width']; | ||
10 | if (empty($_GET['y'])) | ||
11 | $_GET['y'] = $CONFIG['detail-heigth']; | ||
12 | |||
7 | $host = $_GET['h']; | 13 | $host = $_GET['h']; |
8 | $plugin = $_GET['p']; | 14 | $plugin = $_GET['p']; |
9 | $pinstance = $_GET['pi']; | 15 | $pinstance = $_GET['pi']; |
@@ -7,8 +7,8 @@ $plugin = $_GET['p']; | |||
7 | $pinstance = $_GET['pi']; | 7 | $pinstance = $_GET['pi']; |
8 | $type = $_GET['t']; | 8 | $type = $_GET['t']; |
9 | $tinstance = $_GET['ti']; | 9 | $tinstance = $_GET['ti']; |
10 | $width = $_GET['x']; | 10 | $width = empty($_GET['x']) ? $CONFIG['width'] : $_GET['x']; |
11 | $heigth = $_GET['y']; | 11 | $heigth = empty($_GET['y']) ? $CONFIG['heigth'] : $_GET['y']; |
12 | $seconds = $_GET['s']; | 12 | $seconds = $_GET['s']; |
13 | 13 | ||
14 | if (!preg_match('/^[a-z]+$/', $plugin)) { | 14 | if (!preg_match('/^[a-z]+$/', $plugin)) { |
diff --git a/inc/collectd.inc.php b/inc/collectd.inc.php index 2724c05..306086a 100644 --- a/inc/collectd.inc.php +++ b/inc/collectd.inc.php | |||
@@ -123,7 +123,7 @@ function graphs_from_plugin($host, $plugin) { | |||
123 | ); | 123 | ); |
124 | printf('<a href="%s/%s"><img src="%s/%s"></a>'."\n", | 124 | printf('<a href="%s/%s"><img src="%s/%s"></a>'."\n", |
125 | $CONFIG['weburl'], | 125 | $CONFIG['weburl'], |
126 | build_url('detail.php', $items).'&x=800&y=350', | 126 | build_url('detail.php', $items), |
127 | $CONFIG['weburl'], | 127 | $CONFIG['weburl'], |
128 | build_url('graph.php', $items) | 128 | build_url('graph.php', $items) |
129 | ); | 129 | ); |
@@ -140,7 +140,7 @@ function graphs_from_plugin($host, $plugin) { | |||
140 | ); | 140 | ); |
141 | printf('<a href="%s/%s"><img src="%s/%s"></a>'."\n", | 141 | printf('<a href="%s/%s"><img src="%s/%s"></a>'."\n", |
142 | $CONFIG['weburl'], | 142 | $CONFIG['weburl'], |
143 | build_url('detail.php', $items).'&x=800&y=350', | 143 | build_url('detail.php', $items), |
144 | $CONFIG['weburl'], | 144 | $CONFIG['weburl'], |
145 | build_url('graph.php', $items) | 145 | build_url('graph.php', $items) |
146 | ); | 146 | ); |