aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/graph.php
diff options
context:
space:
mode:
authorPim van den Berg2009-12-31 11:42:56 +0100
committerPim van den Berg2009-12-31 13:07:13 +0100
commit95c70c919837f588389f525fe2cf4aba479e9f91 (patch)
treeef242a0273458ffcadf8357fd8dd4d64b2fb7105 /graph.php
parentalways show 'on $host' in the rrd title (diff)
downloadapt-panopticon_cgp-95c70c919837f588389f525fe2cf4aba479e9f91.zip
apt-panopticon_cgp-95c70c919837f588389f525fe2cf4aba479e9f91.tar.gz
apt-panopticon_cgp-95c70c919837f588389f525fe2cf4aba479e9f91.tar.bz2
apt-panopticon_cgp-95c70c919837f588389f525fe2cf4aba479e9f91.tar.xz
rewrite of type classes
A constructor is added to the Type_Default class. The constructor will parse GET values (such as host, plugin, pinstance, type, tinstance, seconds), create an array of all needed rrd files to generate a graph and substract identifiers from these rrd files. Because of the constructor (and related functions) it is not needed to define an array of tinstances to be grouped and shown in one graph. Also $obj->args don't have to be defined per plugin. This will result in smaller plugin files. The type classes are based on the fact that a plugin has multiple type instances OR multiple rrd data sources. This is called the source and is retrieved by rrd_get_sources in each rrd_gen_graph function. Also variables in function rrd_gen_graph have been renamed to better ones.
Diffstat (limited to 'graph.php')
-rw-r--r--graph.php14
1 files changed, 4 insertions, 10 deletions
diff --git a/graph.php b/graph.php
index cc3aeb1..77bfcb6 100644
--- a/graph.php
+++ b/graph.php
@@ -2,26 +2,20 @@
2 2
3require_once 'conf/common.inc.php'; 3require_once 'conf/common.inc.php';
4 4
5$host = $_GET['h'];
6$plugin = $_GET['p'];
7$pinstance = $_GET['pi'];
8$type = $_GET['t'];
9$tinstance = $_GET['ti'];
10$width = empty($_GET['x']) ? $CONFIG['width'] : $_GET['x']; 5$width = empty($_GET['x']) ? $CONFIG['width'] : $_GET['x'];
11$heigth = empty($_GET['y']) ? $CONFIG['heigth'] : $_GET['y']; 6$heigth = empty($_GET['y']) ? $CONFIG['heigth'] : $_GET['y'];
12$seconds = $_GET['s'];
13 7
14if (!preg_match('/^[a-z]+$/', $plugin)) { 8if (!preg_match('/^[a-z]+$/', $_GET['p'])) {
15 die_img('Error: plugin contains unknown characters.'); 9 die_img('Error: plugin contains unknown characters.');
16 exit; 10 exit;
17} 11}
18 12
19if (!file_exists($CONFIG['webdir']."/plugin/$plugin.php")) { 13if (!file_exists($CONFIG['webdir'].'/plugin/'.$_GET['p'].'.php')) {
20 die_img(sprintf('Error: plugin not available (%s).', $plugin)); 14 die_img(sprintf('Error: plugin not available (%s).', $_GET['p']));
21 exit; 15 exit;
22} 16}
23 17
24include $CONFIG['webdir']."/plugin/$plugin.php"; 18include $CONFIG['webdir'].'/plugin/'.$_GET['p'].'.php';
25 19
26 20
27function die_img($msg) { 21function die_img($msg) {