From 5fecd645f6b0726a5763d68ca9c0042d62f1489c Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Sun, 16 Dec 2012 15:10:44 +0100 Subject: plugin/mysql: add support for cache_result, cache_size, threads, total_threads Requested-by: Philipp Hellmich --- plugin/mysql.php | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/plugin/mysql.php b/plugin/mysql.php index aac9e88..acab7ac 100644 --- a/plugin/mysql.php +++ b/plugin/mysql.php @@ -13,11 +13,35 @@ $obj->rrd_format = '%5.1lf%s'; switch($obj->args['type']) { + case 'cache_result': + $obj->ds_names = array( + 'qcache-not_cached' => 'Not Cached', + 'qcache-inserts' => 'Inserts', + 'qcache-hits' => 'Hits', + 'qcache-prunes' => 'Lowmem Prunes', + ); + $obj->colors = array( + 'qcache-not_cached' => 'f0a000', + 'qcache-inserts' => '0000ff', + 'qcache-hits' => '00e000', + 'qcache-prunes' => 'ff0000', + ); + $obj->rrd_title = sprintf('MySQL query cache (%s)', $obj->args['pinstance']); + $obj->rrd_vertical = 'Queries/s'; + break; + case 'cache_size': + $obj->ds_names = array( + 'qcache' => 'Queries', + ); + $obj->rrd_title = sprintf('MySQL query cache size (%s)', $obj->args['pinstance']); + $obj->rrd_vertical = 'Queries in cache'; + break; case 'mysql_commands': $obj->rrd_title = sprintf('MySQL commands (%s)', $obj->args['pinstance']); $obj->rrd_vertical = 'Issues/s'; break; case 'mysql_handler': + $obj->order = array('commit', 'delete', 'read_first', 'read_key', 'read_next', 'read_prev', 'read_rnd', 'read_rnd_next', 'update', 'write', 'rollback'); $obj->colors = array( 'commit' => 'ff0000', 'delete' => 'ff00e7', @@ -55,6 +79,28 @@ switch($obj->args['type']) $obj->rrd_title = sprintf('MySQL traffic (%s)', $obj->args['pinstance']); $obj->rrd_vertical = 'Bits per second'; break; + case 'threads': + $obj->ds_names = array( + 'cached' => 'Cached', + 'connected' => 'Connected', + 'running' => 'Running', + ); + $obj->colors = array( + 'cached' => '00e000', + 'connected' => '0000ff', + 'running' => 'ff0000', + ); + $obj->rrd_title = sprintf('MySQL threads (%s)', $obj->args['pinstance']); + $obj->rrd_vertical = 'Threads'; + break; + case 'total_threads': + $obj->ds_names = array( + 'created' => 'Created', + ); + $obj->rrd_title = sprintf('MySQL created threads (%s)', $obj->args['pinstance']); + $obj->rrd_vertical = 'Created Threads'; + break; + # mysql_qcache is removed since commit collectd-4.10.0-104-g9ae3541 case 'mysql_qcache': $obj->data_sources = array('not_cached', 'inserts', 'hits', 'lowmem_prunes', 'queries_in_cache'); $obj->ds_names = array( @@ -74,6 +120,7 @@ switch($obj->args['type']) $obj->rrd_title = sprintf('MySQL query cache (%s)', $obj->args['pinstance']); $obj->rrd_vertical = 'Queries/s'; break; + # mysql_threads is removed since commit collectd-4.10.0-105-g6c48fca case 'mysql_threads': $obj->data_sources = array('cached', 'connected', 'running', 'created'); $obj->ds_names = array( -- cgit v1.1