diff options
author | Pim van den Berg | 2011-03-10 20:14:21 +0100 |
---|---|---|
committer | Pim van den Berg | 2011-03-10 20:23:44 +0100 |
commit | e1ea1b6cbe03055cb32463d7046b21a2f9b0fbbd (patch) | |
tree | c599336e1c68d6e9b039c1ee1e35327d281014d8 /plugin | |
parent | plugin: add postgresql plugin (diff) | |
download | apt-panopticon_cgp-e1ea1b6cbe03055cb32463d7046b21a2f9b0fbbd.zip apt-panopticon_cgp-e1ea1b6cbe03055cb32463d7046b21a2f9b0fbbd.tar.gz apt-panopticon_cgp-e1ea1b6cbe03055cb32463d7046b21a2f9b0fbbd.tar.bz2 apt-panopticon_cgp-e1ea1b6cbe03055cb32463d7046b21a2f9b0fbbd.tar.xz |
plugin/postgresql: make postgresql plugin compatible with cgp
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/postgresql.php | 96 |
1 files changed, 40 insertions, 56 deletions
diff --git a/plugin/postgresql.php b/plugin/postgresql.php index bca39f9..596f590 100644 --- a/plugin/postgresql.php +++ b/plugin/postgresql.php | |||
@@ -1,65 +1,49 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | # Collectd Postgresql plugin | 3 | # Collectd Postgresql plugin |
4 | require_once 'modules/collectd.inc.php'; | ||
5 | 4 | ||
6 | ## LAYOUT | 5 | require_once 'conf/common.inc.php'; |
7 | # postgresql-[instance]/pg_blks-heap_hit.rrd | 6 | require_once 'type/GenericStacked.class.php'; |
8 | # postgresql-[instance]/pg_blks-heap_read.rrd | 7 | require_once 'inc/collectd.inc.php'; |
9 | # postgresql-[instance]/pg_blks-idx_hit.rrd | ||
10 | # postgresql-[instance]/pg_blks-idx_read.rrd | ||
11 | # postgresql-[instance]/pg_blks-tidx_hit.rrd | ||
12 | # postgresql-[instance]/pg_blks-tidx_read.rrd | ||
13 | # postgresql-[instance]/pg_blks-toast_hit.rrd | ||
14 | # postgresql-[instance]/pg_blks-toast_read.rrd | ||
15 | # postgresql-[instance]/pg_db_size.rrd | ||
16 | # postgresql-[instance]/pg_n_tup_c-del.rrd | ||
17 | # postgresql-[instance]/pg_n_tup_c-hot_upd.rrd | ||
18 | # postgresql-[instance]/pg_n_tup_c-ins.rrd | ||
19 | # postgresql-[instance]/pg_n_tup_c-upd.rrd | ||
20 | |||
21 | switch($_GET['t']) { | ||
22 | case 'pg_db_size': | ||
23 | require_once 'type/GenericStacked.class.php'; | ||
24 | $obj = new Type_GenericStacked($CONFIG); | ||
25 | $obj->width = $width; | ||
26 | $obj->heigth = $heigth; | ||
27 | $obj->ds_names = array( | ||
28 | 'value' => 'Size', | ||
29 | ); | ||
30 | $obj->colors = array( | ||
31 | 'value' => '0000ff', | ||
32 | ); | ||
33 | $obj->rrd_title = sprintf('DB Size %s', | ||
34 | !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : ''); | ||
35 | $obj->rrd_vertical = 'Size'; | ||
36 | $obj->rrd_format = '%5.1lf%s'; | ||
37 | break; | ||
38 | case 'pg_blks': | ||
39 | require_once 'type/GenericStacked.class.php'; | ||
40 | $obj = new Type_GenericStacked($CONFIG); | ||
41 | $obj->width = $width; | ||
42 | $obj->heigth = $heigth; | ||
43 | $obj->generate_colors(); | ||
44 | |||
45 | $obj->rrd_title = sprintf('%s/%s', $obj->args['pinstance'], $obj->args['type']); | ||
46 | $obj->rrd_vertical = 'Ops per second'; | ||
47 | $obj->rrd_format = '%5.1lf%s'; | ||
48 | break; | ||
49 | case 'pg_n_tup_c': | ||
50 | require_once 'type/GenericStacked.class.php'; | ||
51 | $obj = new Type_GenericStacked($CONFIG); | ||
52 | $obj->width = $width; | ||
53 | $obj->heigth = $heigth; | ||
54 | $obj->generate_colors(); | ||
55 | |||
56 | $obj->rrd_title = sprintf('%s/%s', $obj->args['pinstance'], $obj->args['type']); | ||
57 | $obj->rrd_vertical = 'Ops per second'; | ||
58 | $obj->rrd_format = '%5.1lf%s'; | ||
59 | break; | ||
60 | 8 | ||
9 | ## LAYOUT | ||
10 | # postgresql-X/pg_blks-heap_hit.rrd | ||
11 | # postgresql-X/pg_blks-heap_read.rrd | ||
12 | # postgresql-X/pg_blks-idx_hit.rrd | ||
13 | # postgresql-X/pg_blks-idx_read.rrd | ||
14 | # postgresql-X/pg_blks-tidx_hit.rrd | ||
15 | # postgresql-X/pg_blks-tidx_read.rrd | ||
16 | # postgresql-X/pg_blks-toast_hit.rrd | ||
17 | # postgresql-X/pg_blks-toast_read.rrd | ||
18 | # postgresql-X/pg_db_size.rrd | ||
19 | # postgresql-X/pg_n_tup_c-del.rrd | ||
20 | # postgresql-X/pg_n_tup_c-hot_upd.rrd | ||
21 | # postgresql-X/pg_n_tup_c-ins.rrd | ||
22 | # postgresql-X/pg_n_tup_c-upd.rrd | ||
23 | |||
24 | $obj = new Type_GenericStacked($CONFIG); | ||
25 | $obj->width = $width; | ||
26 | $obj->heigth = $heigth; | ||
27 | $obj->rrd_format = '%5.1lf%s'; | ||
28 | |||
29 | switch($obj->args['type']) { | ||
30 | case 'pg_db_size': | ||
31 | $obj->ds_names = array( | ||
32 | 'value' => 'Size', | ||
33 | ); | ||
34 | $obj->colors = array( | ||
35 | 'value' => '0000ff', | ||
36 | ); | ||
37 | $obj->rrd_title = sprintf('DB Size %s', | ||
38 | !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : ''); | ||
39 | $obj->rrd_vertical = 'Size'; | ||
40 | break; | ||
41 | case 'pg_blks': | ||
42 | case 'pg_n_tup_c': | ||
43 | $obj->rrd_title = sprintf('%s/%s', $obj->args['pinstance'], $obj->args['type']); | ||
44 | $obj->rrd_vertical = 'Ops per second'; | ||
45 | break; | ||
61 | } | 46 | } |
62 | 47 | ||
63 | |||
64 | collectd_flush($obj->identifiers); | 48 | collectd_flush($obj->identifiers); |
65 | $obj->rrd_graph(); | 49 | $obj->rrd_graph(); |