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/mysql.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 'plugin/mysql.php')
| -rw-r--r-- | plugin/mysql.php | 140 |
1 files changed, 0 insertions, 140 deletions
diff --git a/plugin/mysql.php b/plugin/mysql.php deleted file mode 100644 index 880b8c0..0000000 --- a/plugin/mysql.php +++ /dev/null | |||
| @@ -1,140 +0,0 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | # Collectd MySQL plugin | ||
| 4 | |||
| 5 | require_once 'conf/common.inc.php'; | ||
| 6 | require_once 'type/GenericStacked.class.php'; | ||
| 7 | |||
| 8 | $obj = new Type_GenericStacked($CONFIG, $_GET); | ||
| 9 | $obj->rrd_format = '%5.1lf%s'; | ||
| 10 | |||
| 11 | switch($obj->args['type']) | ||
| 12 | { | ||
| 13 | case 'cache_result': | ||
| 14 | $obj->legend = array( | ||
| 15 | 'qcache-not_cached' => 'Not Cached', | ||
| 16 | 'qcache-inserts' => 'Inserts', | ||
| 17 | 'qcache-hits' => 'Hits', | ||
| 18 | 'qcache-prunes' => 'Lowmem Prunes', | ||
| 19 | ); | ||
| 20 | $obj->colors = array( | ||
| 21 | 'qcache-not_cached' => 'f0a000', | ||
| 22 | 'qcache-inserts' => '0000ff', | ||
| 23 | 'qcache-hits' => '00e000', | ||
| 24 | 'qcache-prunes' => 'ff0000', | ||
| 25 | ); | ||
| 26 | $obj->rrd_title = sprintf('MySQL query cache (%s)', $obj->args['pinstance']); | ||
| 27 | $obj->rrd_vertical = 'Queries/s'; | ||
| 28 | break; | ||
| 29 | case 'cache_size': | ||
| 30 | $obj->legend = array( | ||
| 31 | 'qcache' => 'Queries', | ||
| 32 | ); | ||
| 33 | $obj->rrd_title = sprintf('MySQL query cache size (%s)', $obj->args['pinstance']); | ||
| 34 | $obj->rrd_vertical = 'Queries in cache'; | ||
| 35 | break; | ||
| 36 | case 'mysql_commands': | ||
| 37 | $obj->rrd_title = sprintf('MySQL commands (%s)', $obj->args['pinstance']); | ||
| 38 | $obj->rrd_vertical = 'Issues/s'; | ||
| 39 | break; | ||
| 40 | case 'mysql_handler': | ||
| 41 | $obj->order = array('commit', 'delete', 'read_first', 'read_key', 'read_next', 'read_prev', 'read_rnd', 'read_rnd_next', 'update', 'write', 'rollback'); | ||
| 42 | $obj->colors = array( | ||
| 43 | 'commit' => 'ff0000', | ||
| 44 | 'delete' => 'ff00e7', | ||
| 45 | 'read_first' => 'cc00ff', | ||
| 46 | 'read_key' => '3200ff', | ||
| 47 | 'read_next' => '0065ff', | ||
| 48 | 'read_prev' => '00fff3', | ||
| 49 | 'read_rnd' => '00ff65', | ||
| 50 | 'read_rnd_next' => '33ff00', | ||
| 51 | 'update' => 'cbff00', | ||
| 52 | 'write' => 'ff9800', | ||
| 53 | 'rollback' => '000000', | ||
| 54 | ); | ||
| 55 | $obj->rrd_title = sprintf('MySQL handler (%s)', $obj->args['pinstance']); | ||
| 56 | $obj->rrd_vertical = 'Invocations'; | ||
| 57 | break; | ||
| 58 | case 'mysql_locks': | ||
| 59 | $obj->colors = array( | ||
| 60 | 'immediate' => 'ff0000', | ||
| 61 | 'waited' => '00ff00', | ||
| 62 | ); | ||
| 63 | $obj->rrd_title = sprintf('MySQL locks (%s)', $obj->args['pinstance']); | ||
| 64 | $obj->rrd_vertical = 'locks'; | ||
| 65 | break; | ||
| 66 | case 'mysql_octets': | ||
| 67 | $obj->data_sources = array('rx', 'tx'); | ||
| 68 | $obj->legend = array( | ||
| 69 | 'rx' => 'Receive', | ||
| 70 | 'tx' => 'Transmit', | ||
| 71 | ); | ||
| 72 | $obj->colors = array( | ||
| 73 | 'rx' => '0000ff', | ||
| 74 | 'tx' => '00b000', | ||
| 75 | ); | ||
| 76 | $obj->rrd_title = sprintf('MySQL traffic (%s)', $obj->args['pinstance']); | ||
| 77 | $obj->rrd_vertical = 'Bits per second'; | ||
| 78 | break; | ||
| 79 | case 'threads': | ||
| 80 | $obj->legend = array( | ||
| 81 | 'cached' => 'Cached', | ||
| 82 | 'connected' => 'Connected', | ||
| 83 | 'running' => 'Running', | ||
| 84 | ); | ||
| 85 | $obj->colors = array( | ||
| 86 | 'cached' => '00e000', | ||
| 87 | 'connected' => '0000ff', | ||
| 88 | 'running' => 'ff0000', | ||
| 89 | ); | ||
| 90 | $obj->rrd_title = sprintf('MySQL threads (%s)', $obj->args['pinstance']); | ||
| 91 | $obj->rrd_vertical = 'Threads'; | ||
| 92 | break; | ||
| 93 | case 'total_threads': | ||
| 94 | $obj->legend = array( | ||
| 95 | 'created' => 'Created', | ||
| 96 | ); | ||
| 97 | $obj->rrd_title = sprintf('MySQL created threads (%s)', $obj->args['pinstance']); | ||
| 98 | $obj->rrd_vertical = 'Created Threads'; | ||
| 99 | break; | ||
| 100 | # mysql_qcache is removed since commit collectd-4.10.0-104-g9ae3541 | ||
| 101 | case 'mysql_qcache': | ||
| 102 | $obj->data_sources = array('not_cached', 'inserts', 'hits', 'lowmem_prunes', 'queries_in_cache'); | ||
| 103 | $obj->legend = array( | ||
| 104 | 'not_cached' => 'Not Cached', | ||
| 105 | 'inserts' => 'Inserts', | ||
| 106 | 'hits' => 'Hits', | ||
| 107 | 'lowmem_prunes' => 'Lowmem Prunes', | ||
| 108 | 'queries_in_cache' => 'Queries in Cache', | ||
| 109 | ); | ||
| 110 | $obj->colors = array( | ||
| 111 | 'not_cached' => 'f0a000', | ||
| 112 | 'inserts' => '0000ff', | ||
| 113 | 'hits' => '00e000', | ||
| 114 | 'lowmem_prunes' => 'ff0000', | ||
| 115 | 'queries_in_cache' => 'cccccc', | ||
| 116 | ); | ||
| 117 | $obj->rrd_title = sprintf('MySQL query cache (%s)', $obj->args['pinstance']); | ||
| 118 | $obj->rrd_vertical = 'Queries/s'; | ||
| 119 | break; | ||
| 120 | # mysql_threads is removed since commit collectd-4.10.0-105-g6c48fca | ||
| 121 | case 'mysql_threads': | ||
| 122 | $obj->data_sources = array('cached', 'connected', 'running', 'created'); | ||
| 123 | $obj->legend = array( | ||
| 124 | 'cached' => 'Cached', | ||
| 125 | 'connected' => 'Connected', | ||
| 126 | 'running' => 'Running', | ||
| 127 | 'created' => 'Created', | ||
| 128 | ); | ||
| 129 | $obj->colors = array( | ||
| 130 | 'cached' => '00e000', | ||
| 131 | 'connected' => '0000ff', | ||
| 132 | 'running' => 'ff0000', | ||
| 133 | 'created' => 'cccccc', | ||
| 134 | ); | ||
| 135 | $obj->rrd_title = sprintf('MySQL threads (%s)', $obj->args['pinstance']); | ||
| 136 | $obj->rrd_vertical = 'Threads'; | ||
| 137 | break; | ||
| 138 | } | ||
| 139 | |||
| 140 | $obj->rrd_graph(); | ||
