diff options
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/postgresql.php | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/plugin/postgresql.php b/plugin/postgresql.php new file mode 100644 index 0000000..bca39f9 --- /dev/null +++ b/plugin/postgresql.php | |||
@@ -0,0 +1,65 @@ | |||
1 | <?php | ||
2 | |||
3 | # Collectd Postgresql plugin | ||
4 | require_once 'modules/collectd.inc.php'; | ||
5 | |||
6 | ## LAYOUT | ||
7 | # postgresql-[instance]/pg_blks-heap_hit.rrd | ||
8 | # postgresql-[instance]/pg_blks-heap_read.rrd | ||
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 | |||
61 | } | ||
62 | |||
63 | |||
64 | collectd_flush($obj->identifiers); | ||
65 | $obj->rrd_graph(); | ||