From 0a547add2f4cc264380d2dab2c472efe5a1d7094 Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Sat, 3 May 2014 19:17:16 +0200 Subject: 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. --- plugin/postgresql.php | 130 -------------------------------------------------- 1 file changed, 130 deletions(-) delete mode 100644 plugin/postgresql.php (limited to 'plugin/postgresql.php') 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 @@ -rrd_format = '%5.1lf%s'; - -switch($obj->args['type']) { - case 'pg_blks': - $obj->legend = array( - 'heap_hit' => 'Heap hit', - 'heap_read' => 'Heap read', - 'idx_hit' => 'Index hit', - 'idx_read' => 'Index read', - 'tidx_hit' => 'Toast index hit', - 'tidx_read' => 'Toast index read', - 'toast_hit' => 'Toast hit', - 'toast_read' => 'Toast read', - ); - $obj->rrd_title = sprintf('PostgreSQL Disk I/O (%s)', - !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : ''); - $obj->rrd_vertical = 'Blocks'; - break; - case 'pg_db_size': - $obj->legend = array( - 'value' => 'Size', - ); - $obj->colors = array( - 'value' => '0000ff', - ); - $obj->rrd_title = sprintf('PostgreSQL DB size (%s)', - !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : ''); - $obj->rrd_vertical = 'Bytes'; - break; - case 'pg_n_tup_c': - $obj->order = array( - 'ins', - 'upd', - 'hot_upd', - 'del', - ); - $obj->legend = array( - 'ins' => 'Insert', - 'upd' => 'Update', - 'hot_upd' => 'Hot Update', - 'del' => 'Delete', - ); - $obj->colors = array( - 'ins' => '00ff00', - 'upd' => 'ff7c00', - 'hot_upd' => '0000ff', - 'del' => 'ff0000', - ); - $obj->rrd_title = sprintf('PostgreSQL Row actions (%s)', - !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : ''); - $obj->rrd_vertical = 'Rows'; - break; - case 'pg_n_tup_g': - $obj->order = array('live', 'dead'); - $obj->legend = array( - 'live' => 'Live', - 'dead' => 'Dead', - ); - $obj->colors = array( - 'live' => '00ff00', - 'dead' => 'ff0000', - ); - $obj->rrd_title = sprintf('PostgreSQL Table states (%s)', - !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : ''); - $obj->rrd_vertical = 'Rows'; - break; - case 'pg_numbackends': - $obj->legend = array( - 'value' => 'Backends', - ); - $obj->colors = array( - 'value' => '0000ff', - ); - $obj->rrd_title = sprintf('PostgreSQL Backends (%s)', - !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : ''); - $obj->rrd_vertical = 'Number'; - break; - case 'pg_scan': - $obj->legend = array( - 'seq' => 'Sequential', - 'seq_tup_read' => 'Sequential rows', - 'idx' => 'Index', - 'idx_tup_fetch' => 'Index Rows', - ); - $obj->rrd_title = sprintf('PostgreSQL Scans (%s)', - !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : ''); - $obj->rrd_vertical = 'Scans / Rows'; - break; - case 'pg_xact': - $obj->legend = array( - 'commit' => 'Commit', - 'rollback' => 'Rollback', - ); - $obj->colors = array( - 'commit' => '00ff00', - 'rollback' => 'ff0000', - ); - $obj->rrd_title = sprintf('PostgreSQL Transactions (%s)', - !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : ''); - $obj->rrd_vertical = 'Transactions'; - break; - default: - $obj->rrd_title = sprintf('%s/%s', $obj->args['pinstance'], $obj->args['type']); - break; -} - -$obj->rrd_graph(); -- cgit v1.1