diff options
author | Benjamin Dupuis | 2011-03-10 20:11:11 +0100 |
---|---|---|
committer | Pim van den Berg | 2011-03-10 20:23:38 +0100 |
commit | 9f87fc57018373bdb304ca00427711d0e454a90f (patch) | |
tree | ffd5c819195c205efe800bf5d3d26421abac81dc /plugin | |
parent | fallback to non-annotated tags in version detection (diff) | |
download | apt-panopticon_cgp-9f87fc57018373bdb304ca00427711d0e454a90f.zip apt-panopticon_cgp-9f87fc57018373bdb304ca00427711d0e454a90f.tar.gz apt-panopticon_cgp-9f87fc57018373bdb304ca00427711d0e454a90f.tar.bz2 apt-panopticon_cgp-9f87fc57018373bdb304ca00427711d0e454a90f.tar.xz |
plugin: add postgresql plugin
Source: http://www.quake.fr/tmp/plugin_bdu.tar.gz
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(); | ||