aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin
diff options
context:
space:
mode:
authorJulien Rottenberg2010-09-14 00:24:02 -0700
committerPim van den Berg2010-09-14 20:14:50 +0200
commitaa194a370b61ec8cb7cdfc32c23a349a7c536977 (patch)
tree64d4390e0b09c5b658da43db46e0d63497bce8ce /plugin
parentplugin: add netlink plugin (diff)
downloadapt-panopticon_cgp-aa194a370b61ec8cb7cdfc32c23a349a7c536977.zip
apt-panopticon_cgp-aa194a370b61ec8cb7cdfc32c23a349a7c536977.tar.gz
apt-panopticon_cgp-aa194a370b61ec8cb7cdfc32c23a349a7c536977.tar.bz2
apt-panopticon_cgp-aa194a370b61ec8cb7cdfc32c23a349a7c536977.tar.xz
plugin: add memcached plugin
Support all types of the memcached plugin
Diffstat (limited to 'plugin')
-rw-r--r--plugin/memcached.php190
1 files changed, 190 insertions, 0 deletions
diff --git a/plugin/memcached.php b/plugin/memcached.php
new file mode 100644
index 0000000..0236635
--- /dev/null
+++ b/plugin/memcached.php
@@ -0,0 +1,190 @@
1<?php
2
3# Collectd Memcached plugin
4
5# Details on http://github.com/octo/collectd/blob/master/src/memcached.c
6
7
8
9require_once 'conf/common.inc.php';
10require_once 'inc/collectd.inc.php';
11
12## LAYOUT
13# df-cache.rrd
14# memcached_command-(flush|get|set).rrd
15# memcached_connections-current.rrd
16# memcached_items-current.rrd
17# memcached_octets.rrd
18# memcached_ops-(evictions|hits|misses).rrd
19# percent-hitratio.rrd
20# ps_count.rrd
21# ps_cputime.rrd
22
23
24switch($_GET['t']) {
25# df-cache.rrd
26 case 'df':
27 require_once 'type/Default.class.php';
28 $obj = new Type_Default($CONFIG);
29 $obj->data_sources = array('used', 'free');
30 $obj->order = array('used', 'free');
31 $obj->ds_names = array(
32 'used' => 'Used ',
33 'free' => 'Free ',
34 );
35 $obj->colors = array(
36 'used' => '00e000',
37 'free' => '0000ff',
38
39 );
40 $obj->rrd_title = 'Memcached Memory Usage';
41 $obj->rrd_vertical = 'bytes';
42 break;
43
44# memcached_command-(flush|get|set).rrd
45 case 'memcached_command':
46 require_once 'type/GenericStacked.class.php';
47 $obj = new Type_GenericStacked($CONFIG);
48 $obj->order = array('flush', 'get', 'set');
49 $obj->ds_names = array(
50 'flush' => 'Flush ',
51 'get' => 'Get ',
52 'set' => 'Set ',
53 );
54 $obj->colors = array(
55 'flush' => '00e000',
56 'get' => '0000ff',
57 'set' => 'ffb000',
58 );
59 $obj->rrd_title = 'Memcached Commands';
60 $obj->rrd_vertical = 'Commands';
61 break;
62
63# memcached_connections-current.rrd
64 case 'memcached_connections':
65 require_once 'type/Default.class.php';
66 $obj = new Type_Default($CONFIG);
67 $obj->data_sources = array('value');
68 $obj->ds_names = array(
69 'value ' => 'Connections',
70 );
71 $obj->colors = array(
72 'percent' => '00b000',
73
74 );
75 $obj->rrd_title = 'Memcached Number of Connections';
76 $obj->rrd_vertical = 'Connections';
77 break;
78
79# memcached_items-current.rrd
80 case 'memcached_items':
81 require_once 'type/Default.class.php';
82 $obj = new Type_Default($CONFIG);
83 $obj->data_sources = array('value');
84 $obj->ds_names = array(
85 'value ' => 'Items',
86 );
87 $obj->colors = array(
88 'value' => '00b000',
89 );
90 $obj->rrd_title = 'Number of Items in Memcached';
91 $obj->rrd_vertical = 'Items';
92 break;
93
94# memcached_octets.rrd
95 case 'memcached_octets':
96 require_once 'type/Default.class.php';
97 $obj = new Type_Default($CONFIG);
98 $obj->data_sources = array('rx', 'tx');
99 $obj->order = array('rx', 'tx');
100 $obj->ds_names = array(
101 'rx' => 'Receive',
102 'tx' => 'Transmit ',
103 );
104 $obj->colors = array(
105 'rx' => '0000ff',
106 'tx' => '00b000',
107 );
108 $obj->rrd_title = 'Memcached Network Traffic';
109 $obj->rrd_vertical = 'Bytes';
110 break;
111# memcached_ops-(evictions|hits|misses).rrd
112 case 'memcached_ops':
113 require_once 'type/GenericStacked.class.php';
114 $obj = new Type_GenericStacked($CONFIG);
115 $obj->order = array('evictions', 'hits', 'misses');
116 $obj->ds_names = array(
117 'evictions' => 'Evictions ',
118 'hits' => 'Hits ',
119 'misses' => 'Misses ',
120 );
121 $obj->colors = array(
122 'evictions' => '00e000',
123 'hits' => '0000ff',
124 'misses' => 'ffb000',
125 );
126 $obj->rrd_title = 'Memcached Operations';
127 $obj->rrd_vertical = 'Commands';
128 break;
129
130# percent-hitratio.rrd
131 case 'percent':
132 require_once 'type/Default.class.php';
133 $obj = new Type_Default($CONFIG);
134 $obj->data_sources = array('percent');
135 $obj->ds_names = array(
136 'percent ' => 'Percentage',
137 );
138 $obj->colors = array(
139 'percent' => '00e000',
140
141 );
142 $obj->rrd_title = 'Memcached Hits/Gets Ratio';
143 $obj->rrd_vertical = 'Percent';
144 break;
145# ps_count.rrd
146 case 'ps_count':
147 require_once 'type/Default.class.php';
148 $obj = new Type_Default($CONFIG);
149 $obj->data_sources = array('threads');
150 $obj->order = array( 'threads');
151 $obj->ds_names = array(
152
153 'threads' => 'Threads ',
154 );
155 $obj->colors = array(
156
157 'threads' => '00b000',
158 );
159 $obj->rrd_title = 'Memcached number of Threads';
160 $obj->rrd_vertical = 'Threads';
161 break;
162
163# ps_cputime.rrd
164 case 'ps_cputime':
165 require_once 'type/Default.class.php';
166 $obj = new Type_Default($CONFIG);
167 $obj->data_sources = array('user', 'syst');
168 $obj->order = array( 'user', 'syst');
169 $obj->ds_names = array(
170 'user' => 'User ',
171 'syst' => 'System ',
172 );
173 $obj->colors = array(
174 'user' => '00e000',
175 'syst' => '0000ff',
176
177 );
178 $obj->rrd_title = 'CPU Time consumed by the memcached process';
179 $obj->rrd_vertical = 'Time';
180 break;
181}
182
183$obj->width = $width;
184$obj->heigth = $heigth;
185$obj->rrd_format = '%5.1lf%s';
186
187collectd_flush($obj->identifiers);
188$obj->rrd_graph();
189
190?>