diff options
author | Pim van den Berg | 2010-10-12 21:52:50 +0200 |
---|---|---|
committer | Pim van den Berg | 2010-10-12 21:52:50 +0200 |
commit | 2250a6eb776093178aa340c3b284c9363e51ac95 (patch) | |
tree | 6b77b804828040f1b035486d282b0aa02708382b | |
parent | plugin/sensors: fix layout example (diff) | |
download | apt-panopticon_cgp-2250a6eb776093178aa340c3b284c9363e51ac95.zip apt-panopticon_cgp-2250a6eb776093178aa340c3b284c9363e51ac95.tar.gz apt-panopticon_cgp-2250a6eb776093178aa340c3b284c9363e51ac95.tar.bz2 apt-panopticon_cgp-2250a6eb776093178aa340c3b284c9363e51ac95.tar.xz |
plugin: add mysql plugin
Diffstat (limited to '')
-rw-r--r-- | plugin/mysql.php | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/plugin/mysql.php b/plugin/mysql.php new file mode 100644 index 0000000..607e223 --- /dev/null +++ b/plugin/mysql.php | |||
@@ -0,0 +1,103 @@ | |||
1 | <?php | ||
2 | |||
3 | # Collectd MySQL plugin | ||
4 | |||
5 | require_once 'conf/common.inc.php'; | ||
6 | require_once 'type/GenericStacked.class.php'; | ||
7 | require_once 'inc/collectd.inc.php'; | ||
8 | |||
9 | $obj = new Type_GenericStacked($CONFIG); | ||
10 | $obj->width = $width; | ||
11 | $obj->heigth = $heigth; | ||
12 | |||
13 | switch($obj->args['type']) | ||
14 | { | ||
15 | case 'mysql_commands': | ||
16 | $obj->generate_colors(); | ||
17 | $obj->rrd_title = sprintf('MySQL commands (%s)', $obj->args['pinstance']); | ||
18 | $obj->rrd_vertical = 'Issues/s'; | ||
19 | $obj->rrd_format = '%5.1lf%s'; | ||
20 | break; | ||
21 | case 'mysql_handler': | ||
22 | $obj->colors = array( | ||
23 | 'commit' => 'ff0000', | ||
24 | 'delete' => 'ff00e7', | ||
25 | 'read_first' => 'cc00ff', | ||
26 | 'read_key' => '3200ff', | ||
27 | 'read_next' => '0065ff', | ||
28 | 'read_prev' => '00fff3', | ||
29 | 'read_rnd' => '00ff65', | ||
30 | 'read_rnd_next' => '33ff00', | ||
31 | 'update' => 'cbff00', | ||
32 | 'write' => 'ff9800', | ||
33 | 'rollback' => '000000', | ||
34 | ); | ||
35 | $obj->rrd_title = sprintf('MySQL handler (%s)', $obj->args['pinstance']); | ||
36 | $obj->rrd_vertical = 'Invocations'; | ||
37 | $obj->rrd_format = '%5.1lf%s'; | ||
38 | break; | ||
39 | case 'mysql_locks': | ||
40 | $obj->colors = array( | ||
41 | 'immediate' => 'ff0000', | ||
42 | 'waited' => '00ff00', | ||
43 | ); | ||
44 | $obj->rrd_title = sprintf('MySQL locks (%s)', $obj->args['pinstance']); | ||
45 | $obj->rrd_vertical = 'locks'; | ||
46 | $obj->rrd_format = '%5.1lf%s'; | ||
47 | break; | ||
48 | case 'mysql_octets': | ||
49 | $obj->data_sources = array('rx', 'tx'); | ||
50 | $obj->ds_names = array( | ||
51 | 'rx' => 'Receive', | ||
52 | 'tx' => 'Transmit', | ||
53 | ); | ||
54 | $obj->colors = array( | ||
55 | 'rx' => '0000ff', | ||
56 | 'tx' => '00b000', | ||
57 | ); | ||
58 | $obj->rrd_title = sprintf('MySQL traffic (%s)', $obj->args['pinstance']); | ||
59 | $obj->rrd_vertical = 'Bits per second'; | ||
60 | $obj->rrd_format = '%5.1lf%s'; | ||
61 | break; | ||
62 | case 'mysql_qcache': | ||
63 | $obj->data_sources = array('not_cached', 'inserts', 'hits', 'lowmem_prunes', 'queries_in_cache'); | ||
64 | $obj->ds_names = array( | ||
65 | 'not_cached' => 'Not Cached', | ||
66 | 'inserts' => 'Inserts', | ||
67 | 'hits' => 'Hits', | ||
68 | 'lowmem_prunes' => 'Lowmem Prunes', | ||
69 | 'queries_in_cache' => 'Queries in Cache', | ||
70 | ); | ||
71 | $obj->colors = array( | ||
72 | 'not_cached' => 'f0a000', | ||
73 | 'inserts' => '0000ff', | ||
74 | 'hits' => '00e000', | ||
75 | 'lowmem_prunes' => 'ff0000', | ||
76 | 'queries_in_cache' => 'cccccc', | ||
77 | ); | ||
78 | $obj->rrd_title = sprintf('MySQL query cache (%s)', $obj->args['pinstance']); | ||
79 | $obj->rrd_vertical = 'Queries/s'; | ||
80 | $obj->rrd_format = '%5.1lf%s'; | ||
81 | break; | ||
82 | case 'mysql_threads': | ||
83 | $obj->data_sources = array('cached', 'connected', 'running', 'created'); | ||
84 | $obj->ds_names = array( | ||
85 | 'cached' => 'Cached', | ||
86 | 'connected' => 'Connected', | ||
87 | 'running' => 'Running', | ||
88 | 'created' => 'Created', | ||
89 | ); | ||
90 | $obj->colors = array( | ||
91 | 'cached' => '00e000', | ||
92 | 'connected' => '0000ff', | ||
93 | 'running' => 'ff0000', | ||
94 | 'created' => 'cccccc', | ||
95 | ); | ||
96 | $obj->rrd_title = sprintf('MySQL threads (%s)', $obj->args['pinstance']); | ||
97 | $obj->rrd_vertical = 'Threads'; | ||
98 | $obj->rrd_format = '%5.1lf%s'; | ||
99 | break; | ||
100 | } | ||
101 | |||
102 | collectd_flush($obj->identifiers); | ||
103 | $obj->rrd_graph(); | ||