diff options
author | Pim van den Berg | 2009-12-31 11:42:56 +0100 |
---|---|---|
committer | Pim van den Berg | 2009-12-31 13:07:13 +0100 |
commit | 95c70c919837f588389f525fe2cf4aba479e9f91 (patch) | |
tree | ef242a0273458ffcadf8357fd8dd4d64b2fb7105 /plugin/irq.php | |
parent | always show 'on $host' in the rrd title (diff) | |
download | apt-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/irq.php | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/plugin/irq.php b/plugin/irq.php index d6b1e72..ba0e7cb 100644 --- a/plugin/irq.php +++ b/plugin/irq.php | |||
@@ -4,38 +4,21 @@ | |||
4 | 4 | ||
5 | require_once 'conf/common.inc.php'; | 5 | require_once 'conf/common.inc.php'; |
6 | require_once 'type/GenericStacked.class.php'; | 6 | require_once 'type/GenericStacked.class.php'; |
7 | require_once 'inc/collectd.inc.php'; | ||
7 | 8 | ||
8 | ## LAYOUT | 9 | ## LAYOUT |
9 | # irq/ | 10 | # irq/ |
10 | # irq/irq-XX.rrd | 11 | # irq/irq-XX.rrd |
11 | 12 | ||
12 | # grouped | 13 | $obj = new Type_GenericStacked($CONFIG['datadir']); |
13 | require_once 'inc/collectd.inc.php'; | ||
14 | $tinstance = collectd_plugindetail($host, $plugin, 'ti'); | ||
15 | sort($tinstance); | ||
16 | |||
17 | $obj = new Type_GenericStacked; | ||
18 | $obj->datadir = $CONFIG['datadir']; | ||
19 | $obj->args = array( | ||
20 | 'host' => $host, | ||
21 | 'plugin' => $plugin, | ||
22 | 'pinstance' => $pinstance, | ||
23 | 'type' => $type, | ||
24 | 'tinstance' => $tinstance, | ||
25 | ); | ||
26 | $obj->data_sources = array('value'); | ||
27 | $obj->ds_names = NULL; | ||
28 | $obj->colors = NULL; | ||
29 | $obj->width = $width; | 14 | $obj->width = $width; |
30 | $obj->heigth = $heigth; | 15 | $obj->heigth = $heigth; |
31 | $obj->seconds = $seconds; | ||
32 | 16 | ||
33 | $obj->rrd_title = 'Interrupts'; | 17 | $obj->rrd_title = 'Interrupts'; |
34 | $obj->rrd_vertical = 'IRQs/s'; | 18 | $obj->rrd_vertical = 'IRQs/s'; |
35 | $obj->rrd_format = '%6.1lf'; | 19 | $obj->rrd_format = '%6.1lf'; |
36 | 20 | ||
37 | collectd_flush(ident_from_args($obj->args)); | 21 | collectd_flush($obj->identifiers); |
38 | |||
39 | $obj->rrd_graph(); | 22 | $obj->rrd_graph(); |
40 | 23 | ||
41 | ?> | 24 | ?> |