diff options
author | Pim van den Berg | 2014-05-03 19:17:16 +0200 |
---|---|---|
committer | Pim van den Berg | 2014-05-12 21:32:24 +0200 |
commit | 0a547add2f4cc264380d2dab2c472efe5a1d7094 (patch) | |
tree | 55bb43a3e31c5814848d61eea92c8438e4a37886 /plugin/postgresql.php | |
parent | type/base: set default title to "Plugin Type (PluginInstance) (Category)" (diff) | |
download | apt-panopticon_cgp-0a547add2f4cc264380d2dab2c472efe5a1d7094.zip apt-panopticon_cgp-0a547add2f4cc264380d2dab2c472efe5a1d7094.tar.gz apt-panopticon_cgp-0a547add2f4cc264380d2dab2c472efe5a1d7094.tar.bz2 apt-panopticon_cgp-0a547add2f4cc264380d2dab2c472efe5a1d7094.tar.xz |
graph.php: use JSON plugins instead of including PHP plugin files
A couple of big changes here. A lot of logic moved to graph.php.
The PHP plugin files have been rewritten to JSON. In these JSON files
*everything* is optional. Also *NOT* having a JSON plugin file won't
block you from having a graph. The JSON will just make the graphs
prettier (by having a title, y-axis title, legend, colors, etc..).
The Collectd types.db file is parsed and used to determine RRD content.
When things are not defined in the JSON it will fallback to a default.
Diffstat (limited to '')
-rw-r--r-- | plugin/postgresql.php | 130 |
1 files changed, 0 insertions, 130 deletions
diff --git a/plugin/postgresql.php b/plugin/postgresql.php deleted file mode 100644 index 4cfae41..0000000 --- a/plugin/postgresql.php +++ /dev/null | |||
@@ -1,130 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | # Collectd Postgresql plugin | ||
4 | |||
5 | require_once 'conf/common.inc.php'; | ||
6 | require_once 'type/GenericStacked.class.php'; | ||
7 | |||
8 | ## LAYOUT | ||
9 | # postgresql-X/pg_blks-heap_hit.rrd | ||
10 | # postgresql-X/pg_blks-heap_read.rrd | ||
11 | # postgresql-X/pg_blks-idx_hit.rrd | ||
12 | # postgresql-X/pg_blks-idx_read.rrd | ||
13 | # postgresql-X/pg_blks-tidx_hit.rrd | ||
14 | # postgresql-X/pg_blks-tidx_read.rrd | ||
15 | # postgresql-X/pg_blks-toast_hit.rrd | ||
16 | # postgresql-X/pg_blks-toast_read.rrd | ||
17 | # postgresql-X/pg_db_size.rrd | ||
18 | # postgresql-X/pg_n_tup_c-del.rrd | ||
19 | # postgresql-X/pg_n_tup_c-hot_upd.rrd | ||
20 | # postgresql-X/pg_n_tup_c-ins.rrd | ||
21 | # postgresql-X/pg_n_tup_c-upd.rrd | ||
22 | |||
23 | $obj = new Type_GenericStacked($CONFIG, $_GET); | ||
24 | $obj->rrd_format = '%5.1lf%s'; | ||
25 | |||
26 | switch($obj->args['type']) { | ||
27 | case 'pg_blks': | ||
28 | $obj->legend = array( | ||
29 | 'heap_hit' => 'Heap hit', | ||
30 | 'heap_read' => 'Heap read', | ||
31 | 'idx_hit' => 'Index hit', | ||
32 | 'idx_read' => 'Index read', | ||
33 | 'tidx_hit' => 'Toast index hit', | ||
34 | 'tidx_read' => 'Toast index read', | ||
35 | 'toast_hit' => 'Toast hit', | ||
36 | 'toast_read' => 'Toast read', | ||
37 | ); | ||
38 | $obj->rrd_title = sprintf('PostgreSQL Disk I/O (%s)', | ||
39 | !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : ''); | ||
40 | $obj->rrd_vertical = 'Blocks'; | ||
41 | break; | ||
42 | case 'pg_db_size': | ||
43 | $obj->legend = array( | ||
44 | 'value' => 'Size', | ||
45 | ); | ||
46 | $obj->colors = array( | ||
47 | 'value' => '0000ff', | ||
48 | ); | ||
49 | $obj->rrd_title = sprintf('PostgreSQL DB size (%s)', | ||
50 | !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : ''); | ||
51 | $obj->rrd_vertical = 'Bytes'; | ||
52 | break; | ||
53 | case 'pg_n_tup_c': | ||
54 | $obj->order = array( | ||
55 | 'ins', | ||
56 | 'upd', | ||
57 | 'hot_upd', | ||
58 | 'del', | ||
59 | ); | ||
60 | $obj->legend = array( | ||
61 | 'ins' => 'Insert', | ||
62 | 'upd' => 'Update', | ||
63 | 'hot_upd' => 'Hot Update', | ||
64 | 'del' => 'Delete', | ||
65 | ); | ||
66 | $obj->colors = array( | ||
67 | 'ins' => '00ff00', | ||
68 | 'upd' => 'ff7c00', | ||
69 | 'hot_upd' => '0000ff', | ||
70 | 'del' => 'ff0000', | ||
71 | ); | ||
72 | $obj->rrd_title = sprintf('PostgreSQL Row actions (%s)', | ||
73 | !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : ''); | ||
74 | $obj->rrd_vertical = 'Rows'; | ||
75 | break; | ||
76 | case 'pg_n_tup_g': | ||
77 | $obj->order = array('live', 'dead'); | ||
78 | $obj->legend = array( | ||
79 | 'live' => 'Live', | ||
80 | 'dead' => 'Dead', | ||
81 | ); | ||
82 | $obj->colors = array( | ||
83 | 'live' => '00ff00', | ||
84 | 'dead' => 'ff0000', | ||
85 | ); | ||
86 | $obj->rrd_title = sprintf('PostgreSQL Table states (%s)', | ||
87 | !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : ''); | ||
88 | $obj->rrd_vertical = 'Rows'; | ||
89 | break; | ||
90 | case 'pg_numbackends': | ||
91 | $obj->legend = array( | ||
92 | 'value' => 'Backends', | ||
93 | ); | ||
94 | $obj->colors = array( | ||
95 | 'value' => '0000ff', | ||
96 | ); | ||
97 | $obj->rrd_title = sprintf('PostgreSQL Backends (%s)', | ||
98 | !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : ''); | ||
99 | $obj->rrd_vertical = 'Number'; | ||
100 | break; | ||
101 | case 'pg_scan': | ||
102 | $obj->legend = array( | ||
103 | 'seq' => 'Sequential', | ||
104 | 'seq_tup_read' => 'Sequential rows', | ||
105 | 'idx' => 'Index', | ||
106 | 'idx_tup_fetch' => 'Index Rows', | ||
107 | ); | ||
108 | $obj->rrd_title = sprintf('PostgreSQL Scans (%s)', | ||
109 | !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : ''); | ||
110 | $obj->rrd_vertical = 'Scans / Rows'; | ||
111 | break; | ||
112 | case 'pg_xact': | ||
113 | $obj->legend = array( | ||
114 | 'commit' => 'Commit', | ||
115 | 'rollback' => 'Rollback', | ||
116 | ); | ||
117 | $obj->colors = array( | ||
118 | 'commit' => '00ff00', | ||
119 | 'rollback' => 'ff0000', | ||
120 | ); | ||
121 | $obj->rrd_title = sprintf('PostgreSQL Transactions (%s)', | ||
122 | !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : ''); | ||
123 | $obj->rrd_vertical = 'Transactions'; | ||
124 | break; | ||
125 | default: | ||
126 | $obj->rrd_title = sprintf('%s/%s', $obj->args['pinstance'], $obj->args['type']); | ||
127 | break; | ||
128 | } | ||
129 | |||
130 | $obj->rrd_graph(); | ||