aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin/load.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 /plugin/load.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 '')
-rw-r--r--plugin/load.php14
1 files changed, 2 insertions, 12 deletions
diff --git a/plugin/load.php b/plugin/load.php
index 523f14c..44baf45 100644
--- a/plugin/load.php
+++ b/plugin/load.php
@@ -9,15 +9,7 @@ require_once 'inc/collectd.inc.php';
9## LAYOUT 9## LAYOUT
10# load/load.rrd 10# load/load.rrd
11 11
12$obj = new Type_Default; 12$obj = new Type_Default($CONFIG['datadir']);
13$obj->datadir = $CONFIG['datadir'];
14$obj->args = array(
15 'host' => $host,
16 'plugin' => $plugin,
17 'pinstance' => $pinstance,
18 'type' => $type,
19 'tinstance' => $tinstance,
20);
21$obj->data_sources = array('shortterm', 'midterm', 'longterm'); 13$obj->data_sources = array('shortterm', 'midterm', 'longterm');
22$obj->ds_names = array( 14$obj->ds_names = array(
23 'shortterm' => ' 1 min', 15 'shortterm' => ' 1 min',
@@ -31,13 +23,11 @@ $obj->colors = array(
31); 23);
32$obj->width = $width; 24$obj->width = $width;
33$obj->heigth = $heigth; 25$obj->heigth = $heigth;
34$obj->seconds = $seconds;
35$obj->rrd_title = 'System load'; 26$obj->rrd_title = 'System load';
36$obj->rrd_vertical = 'System load'; 27$obj->rrd_vertical = 'System load';
37$obj->rrd_format = '%.2lf'; 28$obj->rrd_format = '%.2lf';
38 29
39collectd_flush(ident_from_args($obj->args)); 30collectd_flush($obj->identifiers);
40
41$obj->rrd_graph(); 31$obj->rrd_graph();
42 32
43?> 33?>