aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin
diff options
context:
space:
mode:
authorPim van den Berg2011-03-15 21:12:00 +0100
committerPim van den Berg2011-03-15 21:15:12 +0100
commit54145cacca8e99155c0bb328b8ac0c0e8737f8cd (patch)
treefbd4eb84d8babbe47a2fb4ebacb6ad4f3c631c32 /plugin
parentplugin/postgresql: create fallback for unknown types (diff)
downloadapt-panopticon_cgp-54145cacca8e99155c0bb328b8ac0c0e8737f8cd.zip
apt-panopticon_cgp-54145cacca8e99155c0bb328b8ac0c0e8737f8cd.tar.gz
apt-panopticon_cgp-54145cacca8e99155c0bb328b8ac0c0e8737f8cd.tar.bz2
apt-panopticon_cgp-54145cacca8e99155c0bb328b8ac0c0e8737f8cd.tar.xz
plugin/postgresql: support for all predefined queries
- pg_blks - pg_n_tup_c - pg_n_tup_g - pg_numbackends - pg_scan - pg_xact
Diffstat (limited to 'plugin')
-rw-r--r--plugin/postgresql.php92
1 files changed, 89 insertions, 3 deletions
diff --git a/plugin/postgresql.php b/plugin/postgresql.php
index 9680a4f..1eadc8d 100644
--- a/plugin/postgresql.php
+++ b/plugin/postgresql.php
@@ -27,6 +27,21 @@ $obj->heigth = $heigth;
27$obj->rrd_format = '%5.1lf%s'; 27$obj->rrd_format = '%5.1lf%s';
28 28
29switch($obj->args['type']) { 29switch($obj->args['type']) {
30 case 'pg_blks':
31 $obj->ds_names = array(
32 'heap_hit' => 'Heap hit',
33 'heap_read' => 'Heap read',
34 'idx_hit' => 'Index hit',
35 'idx_read' => 'Index read',
36 'tidx_hit' => 'Toast index hit',
37 'tidx_read' => 'Toast index read',
38 'toast_hit' => 'Toast hit',
39 'toast_read' => 'Toast read',
40 );
41 $obj->rrd_title = sprintf('PostgreSQL Disk I/O (%s)',
42 !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : '');
43 $obj->rrd_vertical = 'Blocks';
44 break;
30 case 'pg_db_size': 45 case 'pg_db_size':
31 $obj->ds_names = array( 46 $obj->ds_names = array(
32 'value' => 'Size', 47 'value' => 'Size',
@@ -34,13 +49,84 @@ switch($obj->args['type']) {
34 $obj->colors = array( 49 $obj->colors = array(
35 'value' => '0000ff', 50 'value' => '0000ff',
36 ); 51 );
37 $obj->rrd_title = sprintf('DB Size %s', 52 $obj->rrd_title = sprintf('PostgreSQL DB size (%s)',
53 !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : '');
54 $obj->rrd_vertical = 'Bytes';
55 break;
56 case 'pg_n_tup_c':
57 $obj->order = array(
58 'ins',
59 'upd',
60 'hot_upd',
61 'del',
62 );
63 $obj->ds_names = array(
64 'ins' => 'Insert',
65 'upd' => 'Update',
66 'hot_upd' => 'Hot Update',
67 'del' => 'Delete',
68 );
69 $obj->colors = array(
70 'ins' => '00ff00',
71 'upd' => 'ff7c00',
72 'hot_upd' => '0000ff',
73 'del' => 'ff0000',
74 );
75 $obj->rrd_title = sprintf('PostgreSQL Row actions (%s)',
76 !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : '');
77 $obj->rrd_vertical = 'Rows';
78 break;
79 case 'pg_n_tup_g':
80 $obj->order = array('live', 'dead');
81 $obj->ds_names = array(
82 'live' => 'Live',
83 'dead' => 'Dead',
84 );
85 $obj->colors = array(
86 'live' => '00ff00',
87 'dead' => 'ff0000',
88 );
89 $obj->rrd_title = sprintf('PostgreSQL Table states (%s)',
90 !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : '');
91 $obj->rrd_vertical = 'Rows';
92 break;
93 case 'pg_numbackends':
94 $obj->ds_names = array(
95 'value' => 'Backends',
96 );
97 $obj->colors = array(
98 'value' => '0000ff',
99 );
100 $obj->rrd_title = sprintf('PostgreSQL Backends (%s)',
101 !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : '');
102 $obj->rrd_vertical = 'Number';
103 break;
104 case 'pg_scan':
105 $obj->ds_names = array(
106 'seq' => 'Sequential',
107 'seq_tup_read' => 'Sequential rows',
108 'idx' => 'Index',
109 'idx_tup_fetch' => 'Index Rows',
110 );
111 $obj->rrd_title = sprintf('PostgreSQL Scans (%s)',
112 !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : '');
113 $obj->rrd_vertical = 'Scans / Rows';
114 break;
115 case 'pg_xact':
116 $obj->ds_names = array(
117 'commit' => 'Commit',
118 'rollback' => 'Rollback',
119 );
120 $obj->colors = array(
121 'commit' => '00ff00',
122 'rollback' => 'ff0000',
123 );
124 $obj->rrd_title = sprintf('PostgreSQL Transactions (%s)',
38 !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : ''); 125 !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : '');
39 $obj->rrd_vertical = 'Size'; 126 $obj->rrd_vertical = 'Transactions';
40 break; 127 break;
41 default: 128 default:
42 $obj->rrd_title = sprintf('%s/%s', $obj->args['pinstance'], $obj->args['type']); 129 $obj->rrd_title = sprintf('%s/%s', $obj->args['pinstance'], $obj->args['type']);
43 $obj->rrd_vertical = 'Ops per second';
44 break; 130 break;
45} 131}
46 132