aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin/memory.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/memory.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/memory.php20
1 files changed, 3 insertions, 17 deletions
diff --git a/plugin/memory.php b/plugin/memory.php
index b0f6b73..ade242c 100644
--- a/plugin/memory.php
+++ b/plugin/memory.php
@@ -4,6 +4,7 @@
4 4
5require_once 'conf/common.inc.php'; 5require_once 'conf/common.inc.php';
6require_once 'type/GenericStacked.class.php'; 6require_once 'type/GenericStacked.class.php';
7require_once 'inc/collectd.inc.php';
7 8
8## LAYOUT 9## LAYOUT
9# memory/ 10# memory/
@@ -12,20 +13,7 @@ require_once 'type/GenericStacked.class.php';
12# memory/memory-free.rrd 13# memory/memory-free.rrd
13# memory/memory-used.rrd 14# memory/memory-used.rrd
14 15
15# grouped 16$obj = new Type_GenericStacked($CONFIG['datadir']);
16require_once 'inc/collectd.inc.php';
17$tinstance = collectd_plugindetail($host, $plugin, 'ti');
18
19$obj = new Type_GenericStacked;
20$obj->datadir = $CONFIG['datadir'];
21$obj->args = array(
22 'host' => $host,
23 'plugin' => $plugin,
24 'pinstance' => $pinstance,
25 'type' => $type,
26 'tinstance' => $tinstance,
27);
28$obj->data_sources = array('value');
29$obj->order = array('free', 'buffered', 'cached', 'used'); 17$obj->order = array('free', 'buffered', 'cached', 'used');
30$obj->ds_names = array( 18$obj->ds_names = array(
31 'free' => 'Free ', 19 'free' => 'Free ',
@@ -41,14 +29,12 @@ $obj->colors = array(
41); 29);
42$obj->width = $width; 30$obj->width = $width;
43$obj->heigth = $heigth; 31$obj->heigth = $heigth;
44$obj->seconds = $seconds;
45 32
46$obj->rrd_title = 'Physical memory utilization'; 33$obj->rrd_title = 'Physical memory utilization';
47$obj->rrd_vertical = 'Bytes'; 34$obj->rrd_vertical = 'Bytes';
48$obj->rrd_format = '%5.1lf%s'; 35$obj->rrd_format = '%5.1lf%s';
49 36
50collectd_flush(ident_from_args($obj->args)); 37collectd_flush($obj->identifiers);
51
52$obj->rrd_graph(); 38$obj->rrd_graph();
53 39
54?> 40?>