10 use Fcntl (qw(:flock));
11 use Carp (qw(carp cluck confess croak));
13 our $Config = read_config ();
21 for (qw(Red Green Blue Yellow Cyan Magenta))
23 $Config->{'Colors'}{"Half$_"} = color_calculate_transparent ($Config->{'Colors'}{'Alpha'},
24 $Config->{'Colors'}{'Canvas'}, $Config->{'Colors'}{"Full$_"});
27 $Config->{'Colors'}{'HalfBlueGreen'} = color_calculate_transparent ($Config->{'Colors'}{'Alpha'},
28 $Config->{'Colors'}{'Canvas'}, $Config->{'Colors'}{'FullGreen'}, $Config->{'Colors'}{'FullBlue'});
29 $Config->{'Colors'}{'HalfRedBlue'} = color_calculate_transparent ($Config->{'Colors'}{'Alpha'},
30 $Config->{'Colors'}{'Canvas'}, $Config->{'Colors'}{'FullBlue'}, $Config->{'Colors'}{'FullRed'});
34 my $Alpha = $Config->{'Colors'}{'Alpha'};
35 my $Canvas = $Config->{'Colors'}{'Canvas'};
37 my $FullRed = $Config->{'Colors'}{'FullRed'};
38 my $FullGreen = $Config->{'Colors'}{'FullGreen'};
39 my $FullBlue = $Config->{'Colors'}{'FullBlue'};
40 my $FullYellow = $Config->{'Colors'}{'FullYellow'};
41 my $FullCyan = $Config->{'Colors'}{'FullCyan'};
42 my $FullMagenta= $Config->{'Colors'}{'FullMagenta'};
44 my $HalfRed = $Config->{'Colors'}{'HalfRed'};
45 my $HalfGreen = $Config->{'Colors'}{'HalfGreen'};
46 my $HalfBlue = $Config->{'Colors'}{'HalfBlue'};
47 my $HalfYellow = $Config->{'Colors'}{'HalfYellow'};
48 my $HalfCyan = $Config->{'Colors'}{'HalfCyan'};
49 my $HalfMagenta= $Config->{'Colors'}{'HalfMagenta'};
51 my $HalfBlueGreen = $Config->{'Colors'}{'HalfBlueGreen'};
52 my $HalfRedBlue = $Config->{'Colors'}{'HalfRedBlue'};
56 apache_bytes => ['DEF:min_raw={file}:count:MIN',
57 'DEF:avg_raw={file}:count:AVERAGE',
58 'DEF:max_raw={file}:count:MAX',
59 'CDEF:min=min_raw,8,*',
60 'CDEF:avg=avg_raw,8,*',
61 'CDEF:max=max_raw,8,*',
62 'CDEF:mytime=avg_raw,TIME,TIME,IF',
63 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
64 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
65 'CDEF:avg_sample=avg_raw,UN,0,avg_raw,IF,sample_len,*',
66 'CDEF:avg_sum=PREV,UN,0,PREV,IF,avg_sample,+',
68 "LINE1:avg#$FullBlue:Bit/s",
69 'GPRINT:min:MIN:%5.1lf%s Min,',
70 'GPRINT:avg:AVERAGE:%5.1lf%s Avg,',
71 'GPRINT:max:MAX:%5.1lf%s Max,',
72 'GPRINT:avg:LAST:%5.1lf%s Last',
73 'GPRINT:avg_sum:LAST:(ca. %5.1lf%sB Total)\l'
75 apache_requests => ['DEF:min={file}:count:MIN',
76 'DEF:avg={file}:count:AVERAGE',
77 'DEF:max={file}:count:MAX',
80 "LINE1:avg#$FullBlue:Requests/s",
81 'GPRINT:min:MIN:%6.2lf Min,',
82 'GPRINT:avg:AVERAGE:%6.2lf Avg,',
83 'GPRINT:max:MAX:%6.2lf Max,',
84 'GPRINT:avg:LAST:%6.2lf Last'
86 apache_scoreboard => ['DEF:min={file}:count:MIN',
87 'DEF:avg={file}:count:AVERAGE',
88 'DEF:max={file}:count:MAX',
91 "LINE1:avg#$FullBlue:Processes",
92 'GPRINT:min:MIN:%6.2lf Min,',
93 'GPRINT:avg:AVERAGE:%6.2lf Avg,',
94 'GPRINT:max:MAX:%6.2lf Max,',
95 'GPRINT:avg:LAST:%6.2lf Last'
98 'DEF:avg={file}:charge:AVERAGE',
99 'DEF:min={file}:charge:MIN',
100 'DEF:max={file}:charge:MAX',
101 "AREA:max#$HalfBlue",
103 "LINE1:avg#$FullBlue:Charge",
104 'GPRINT:min:MIN:%5.1lf%sAh Min,',
105 'GPRINT:avg:AVERAGE:%5.1lf%sAh Avg,',
106 'GPRINT:max:MAX:%5.1lf%sAh Max,',
107 'GPRINT:avg:LAST:%5.1lf%sAh Last\l'
109 cpu => ['DEF:user_avg={file}:user:AVERAGE',
110 'DEF:user_min={file}:user:MIN',
111 'DEF:user_max={file}:user:MAX',
112 'DEF:nice_avg={file}:nice:AVERAGE',
113 'DEF:nice_min={file}:nice:MIN',
114 'DEF:nice_max={file}:nice:MAX',
115 'DEF:syst_avg={file}:syst:AVERAGE',
116 'DEF:syst_min={file}:syst:MIN',
117 'DEF:syst_max={file}:syst:MAX',
118 'DEF:idle_avg={file}:idle:AVERAGE',
119 'DEF:idle_min={file}:idle:MIN',
120 'DEF:idle_max={file}:idle:MAX',
121 'DEF:wait_avg={file}:wait:AVERAGE',
122 'DEF:wait_min={file}:wait:MIN',
123 'DEF:wait_max={file}:wait:MAX',
124 'CDEF:user_avg_notnull=user_avg,UN,0,user_avg,IF',
125 'CDEF:nice_avg_notnull=nice_avg,UN,0,nice_avg,IF',
126 'CDEF:syst_avg_notnull=syst_avg,UN,0,syst_avg,IF',
127 'CDEF:idle_avg_notnull=idle_avg,UN,0,idle_avg,IF',
128 'CDEF:wait_avg_notnull=wait_avg,UN,0,wait_avg,IF',
129 'CDEF:totl_avg_notnull=user_avg_notnull,nice_avg_notnull,+,syst_avg_notnull,+,idle_avg_notnull,+,wait_avg_notnull,+',
130 'CDEF:user_avg_pct=user_avg_notnull,100,*,totl_avg_notnull,/',
131 'CDEF:nice_avg_pct=nice_avg_notnull,100,*,totl_avg_notnull,/',
132 'CDEF:syst_avg_pct=syst_avg_notnull,100,*,totl_avg_notnull,/',
133 'CDEF:wait_avg_pct=wait_avg_notnull,100,*,totl_avg_notnull,/',
134 'CDEF:nice_acc=syst_avg_pct,wait_avg_pct,user_avg_pct,nice_avg_pct,+,+,+',
135 'CDEF:user_acc=syst_avg_pct,wait_avg_pct,user_avg_pct,+,+',
136 'CDEF:wait_acc=syst_avg_pct,wait_avg_pct,+',
137 'CDEF:syst_acc=syst_avg_pct',
138 # 'CDEF:nice_acc=syst_avg_notnull,wait_avg_notnull,user_avg_notnull,nice_avg_notnull,+,+,+',
139 # 'CDEF:user_acc=syst_avg_notnull,wait_avg_notnull,user_avg_notnull,+,+',
140 # 'CDEF:wait_acc=syst_avg_notnull,wait_avg_notnull,+',
141 # 'CDEF:syst_acc=syst_avg_notnull',
142 "AREA:nice_acc#$HalfGreen",
143 "AREA:user_acc#$HalfBlue",
144 "AREA:wait_acc#$HalfYellow",
145 "AREA:syst_acc#$HalfRed",
146 "LINE1:nice_acc#$FullGreen:Nice ",
147 'GPRINT:nice_min:MIN:%5.1lf%% Min,',
148 'GPRINT:nice_avg:AVERAGE:%5.1lf%% Avg,',
149 'GPRINT:nice_max:MAX:%5.1lf%% Max,',
150 'GPRINT:nice_avg:LAST:%5.1lf%% Last\l',
151 "LINE1:user_acc#$FullBlue:User ",
152 'GPRINT:user_min:MIN:%5.1lf%% Min,',
153 'GPRINT:user_avg:AVERAGE:%5.1lf%% Avg,',
154 'GPRINT:user_max:MAX:%5.1lf%% Max,',
155 'GPRINT:user_avg:LAST:%5.1lf%% Last\l',
156 "LINE1:wait_acc#$FullYellow:Wait-IO",
157 'GPRINT:wait_min:MIN:%5.1lf%% Min,',
158 'GPRINT:wait_avg:AVERAGE:%5.1lf%% Avg,',
159 'GPRINT:wait_max:MAX:%5.1lf%% Max,',
160 'GPRINT:wait_avg:LAST:%5.1lf%% Last\l',
161 "LINE1:syst_acc#$FullRed:System ",
162 'GPRINT:syst_min:MIN:%5.1lf%% Min,',
163 'GPRINT:syst_avg:AVERAGE:%5.1lf%% Avg,',
164 'GPRINT:syst_max:MAX:%5.1lf%% Max,',
165 'GPRINT:syst_avg:LAST:%5.1lf%% Last\l'
168 'DEF:avg={file}:current:AVERAGE',
169 'DEF:min={file}:current:MIN',
170 'DEF:max={file}:current:MAX',
171 "AREA:max#$HalfBlue",
173 "LINE1:avg#$FullBlue:Current",
174 'GPRINT:min:MIN:%5.1lf%sA Min,',
175 'GPRINT:avg:AVERAGE:%5.1lf%sA Avg,',
176 'GPRINT:max:MAX:%5.1lf%sA Max,',
177 'GPRINT:avg:LAST:%5.1lf%sA Last\l'
180 'DEF:free_avg={file}:free:AVERAGE',
181 'DEF:free_min={file}:free:MIN',
182 'DEF:free_max={file}:free:MAX',
183 'DEF:used_avg={file}:used:AVERAGE',
184 'DEF:used_min={file}:used:MIN',
185 'DEF:used_max={file}:used:MAX',
186 'CDEF:total=free_avg,used_avg,+',
187 'CDEF:free_pct=100,free_avg,*,total,/',
188 'CDEF:used_pct=100,used_avg,*,total,/',
189 'CDEF:free_acc=free_pct,used_pct,+',
190 'CDEF:used_acc=used_pct',
191 "AREA:free_acc#$HalfGreen",
192 "AREA:used_acc#$HalfRed",
193 "LINE1:free_acc#$FullGreen:Free",
194 'GPRINT:free_min:MIN:%5.1lf%sB Min,',
195 'GPRINT:free_avg:AVERAGE:%5.1lf%sB Avg,',
196 'GPRINT:free_max:MAX:%5.1lf%sB Max,',
197 'GPRINT:free_avg:LAST:%5.1lf%sB Last\l',
198 "LINE1:used_acc#$FullRed:Used",
199 'GPRINT:used_min:MIN:%5.1lf%sB Min,',
200 'GPRINT:used_avg:AVERAGE:%5.1lf%sB Avg,',
201 'GPRINT:used_max:MAX:%5.1lf%sB Max,',
202 'GPRINT:used_avg:LAST:%5.1lf%sB Last\l'
205 'DEF:rtime_avg={file}:rtime:AVERAGE',
206 'DEF:rtime_min={file}:rtime:MIN',
207 'DEF:rtime_max={file}:rtime:MAX',
208 'DEF:wtime_avg={file}:wtime:AVERAGE',
209 'DEF:wtime_min={file}:wtime:MIN',
210 'DEF:wtime_max={file}:wtime:MAX',
211 'CDEF:rtime_avg_ms=rtime_avg,1000,/',
212 'CDEF:rtime_min_ms=rtime_min,1000,/',
213 'CDEF:rtime_max_ms=rtime_max,1000,/',
214 'CDEF:wtime_avg_ms=wtime_avg,1000,/',
215 'CDEF:wtime_min_ms=wtime_min,1000,/',
216 'CDEF:wtime_max_ms=wtime_max,1000,/',
217 'CDEF:total_avg_ms=rtime_avg_ms,wtime_avg_ms,+',
218 'CDEF:total_min_ms=rtime_min_ms,wtime_min_ms,+',
219 'CDEF:total_max_ms=rtime_max_ms,wtime_max_ms,+',
220 "AREA:total_max_ms#$HalfRed",
221 "AREA:total_min_ms#$Canvas",
222 "LINE1:wtime_avg_ms#$FullGreen:Write",
223 'GPRINT:wtime_min_ms:MIN:%5.1lf%s Min,',
224 'GPRINT:wtime_avg_ms:AVERAGE:%5.1lf%s Avg,',
225 'GPRINT:wtime_max_ms:MAX:%5.1lf%s Max,',
226 'GPRINT:wtime_avg_ms:LAST:%5.1lf%s Last\n',
227 "LINE1:rtime_avg_ms#$FullBlue:Read ",
228 'GPRINT:rtime_min_ms:MIN:%5.1lf%s Min,',
229 'GPRINT:rtime_avg_ms:AVERAGE:%5.1lf%s Avg,',
230 'GPRINT:rtime_max_ms:MAX:%5.1lf%s Max,',
231 'GPRINT:rtime_avg_ms:LAST:%5.1lf%s Last\n',
232 "LINE1:total_avg_ms#$FullRed:Total",
233 'GPRINT:total_min_ms:MIN:%5.1lf%s Min,',
234 'GPRINT:total_avg_ms:AVERAGE:%5.1lf%s Avg,',
235 'GPRINT:total_max_ms:MAX:%5.1lf%s Max,',
236 'GPRINT:total_avg_ms:LAST:%5.1lf%s Last'
239 'DEF:temp_avg={file}:value:AVERAGE',
240 'DEF:temp_min={file}:value:MIN',
241 'DEF:temp_max={file}:value:MAX',
242 "AREA:temp_max#$HalfBlue",
243 "AREA:temp_min#$Canvas",
244 "LINE1:temp_avg#$FullBlue:RPM",
245 'GPRINT:temp_min:MIN:%4.1lf Min,',
246 'GPRINT:temp_avg:AVERAGE:%4.1lf Avg,',
247 'GPRINT:temp_max:MAX:%4.1lf Max,',
248 'GPRINT:temp_avg:LAST:%4.1lf Last\l'
251 'DEF:temp_avg={file}:value:AVERAGE',
252 'DEF:temp_min={file}:value:MIN',
253 'DEF:temp_max={file}:value:MAX',
254 "AREA:temp_max#$HalfBlue",
255 "AREA:temp_min#$Canvas",
256 "LINE1:temp_avg#$FullBlue:Temperature",
257 'GPRINT:temp_min:MIN:%4.1lf Min,',
258 'GPRINT:temp_avg:AVERAGE:%4.1lf Avg,',
259 'GPRINT:temp_max:MAX:%4.1lf Max,',
260 'GPRINT:temp_avg:LAST:%4.1lf Last\l'
262 load => ['DEF:s_avg={file}:shortterm:AVERAGE',
263 'DEF:s_min={file}:shortterm:MIN',
264 'DEF:s_max={file}:shortterm:MAX',
265 'DEF:m_avg={file}:midterm:AVERAGE',
266 'DEF:m_min={file}:midterm:MIN',
267 'DEF:m_max={file}:midterm:MAX',
268 'DEF:l_avg={file}:longterm:AVERAGE',
269 'DEF:l_min={file}:longterm:MIN',
270 'DEF:l_max={file}:longterm:MAX',
271 "AREA:s_max#$HalfGreen",
272 "AREA:s_min#$Canvas",
273 "LINE1:s_avg#$FullGreen: 1m average",
274 'GPRINT:s_min:MIN:%4.2lf Min,',
275 'GPRINT:s_avg:AVERAGE:%4.2lf Avg,',
276 'GPRINT:s_max:MAX:%4.2lf Max,',
277 'GPRINT:s_avg:LAST:%4.2lf Last\n',
278 "LINE1:m_avg#$FullBlue: 5m average",
279 'GPRINT:m_min:MIN:%4.2lf Min,',
280 'GPRINT:m_avg:AVERAGE:%4.2lf Avg,',
281 'GPRINT:m_max:MAX:%4.2lf Max,',
282 'GPRINT:m_avg:LAST:%4.2lf Last\n',
283 "LINE1:l_avg#$FullRed:15m average",
284 'GPRINT:l_min:MIN:%4.2lf Min,',
285 'GPRINT:l_avg:AVERAGE:%4.2lf Avg,',
286 'GPRINT:l_max:MAX:%4.2lf Max,',
287 'GPRINT:l_avg:LAST:%4.2lf Last'
289 mails => ['DEF:rawgood={file}:good:AVERAGE',
290 'DEF:rawspam={file}:spam:AVERAGE',
291 'CDEF:good=rawgood,UN,0,rawgood,IF',
292 'CDEF:spam=rawspam,UN,0,rawspam,IF',
293 'CDEF:negspam=spam,-1,*',
294 "AREA:good#$HalfGreen",
295 "LINE1:good#$FullGreen:Good mails",
296 'GPRINT:good:AVERAGE:%4.1lf Avg,',
297 'GPRINT:good:MAX:%4.1lf Max,',
298 'GPRINT:good:LAST:%4.1lf Last\n',
299 "AREA:negspam#$HalfRed",
300 "LINE1:negspam#$FullRed:Spam mails",
301 'GPRINT:spam:AVERAGE:%4.1lf Avg,',
302 'GPRINT:spam:MAX:%4.1lf Max,',
303 'GPRINT:spam:LAST:%4.1lf Last',
306 'DEF:used_avg={file}:used:AVERAGE',
307 'DEF:free_avg={file}:free:AVERAGE',
308 'DEF:buffers_avg={file}:buffers:AVERAGE',
309 'DEF:cached_avg={file}:cached:AVERAGE',
310 'DEF:used_min={file}:used:MIN',
311 'DEF:free_min={file}:free:MIN',
312 'DEF:buffers_min={file}:buffers:MIN',
313 'DEF:cached_min={file}:cached:MIN',
314 'DEF:used_max={file}:used:MAX',
315 'DEF:free_max={file}:free:MAX',
316 'DEF:buffers_max={file}:buffers:MAX',
317 'DEF:cached_max={file}:cached:MAX',
318 'CDEF:cached_avg_nn=cached_avg,UN,0,cached_avg,IF',
319 'CDEF:buffers_avg_nn=buffers_avg,UN,0,buffers_avg,IF',
320 'CDEF:free_cached_buffers_used=free_avg,cached_avg_nn,+,buffers_avg_nn,+,used_avg,+',
321 'CDEF:cached_buffers_used=cached_avg,buffers_avg_nn,+,used_avg,+',
322 'CDEF:buffers_used=buffers_avg,used_avg,+',
323 "AREA:free_cached_buffers_used#$HalfGreen",
324 "AREA:cached_buffers_used#$HalfBlue",
325 "AREA:buffers_used#$HalfYellow",
326 "AREA:used_avg#$HalfRed",
327 "LINE1:free_cached_buffers_used#$FullGreen:Free ",
328 'GPRINT:free_min:MIN:%5.1lf%s Min,',
329 'GPRINT:free_avg:AVERAGE:%5.1lf%s Avg,',
330 'GPRINT:free_max:MAX:%5.1lf%s Max,',
331 'GPRINT:free_avg:LAST:%5.1lf%s Last\n',
332 "LINE1:cached_buffers_used#$FullBlue:Page cache ",
333 'GPRINT:cached_min:MIN:%5.1lf%s Min,',
334 'GPRINT:cached_avg:AVERAGE:%5.1lf%s Avg,',
335 'GPRINT:cached_max:MAX:%5.1lf%s Max,',
336 'GPRINT:cached_avg:LAST:%5.1lf%s Last\n',
337 "LINE1:buffers_used#$FullYellow:Buffer cache",
338 'GPRINT:buffers_min:MIN:%5.1lf%s Min,',
339 'GPRINT:buffers_avg:AVERAGE:%5.1lf%s Avg,',
340 'GPRINT:buffers_max:MAX:%5.1lf%s Max,',
341 'GPRINT:buffers_avg:LAST:%5.1lf%s Last\n',
342 "LINE1:used_avg#$FullRed:Used ",
343 'GPRINT:used_min:MIN:%5.1lf%s Min,',
344 'GPRINT:used_avg:AVERAGE:%5.1lf%s Avg,',
345 'GPRINT:used_max:MAX:%5.1lf%s Max,',
346 'GPRINT:used_avg:LAST:%5.1lf%s Last'
349 "DEF:val_avg={file}:value:AVERAGE",
350 "DEF:val_min={file}:value:MIN",
351 "DEF:val_max={file}:value:MAX",
352 "AREA:val_max#$HalfBlue",
353 "AREA:val_min#$Canvas",
354 "LINE1:val_avg#$FullBlue:{inst}",
355 'GPRINT:val_min:MIN:%5.2lf Min,',
356 'GPRINT:val_avg:AVERAGE:%5.2lf Avg,',
357 'GPRINT:val_max:MAX:%5.2lf Max,',
358 'GPRINT:val_avg:LAST:%5.2lf Last'
361 "DEF:val_avg={file}:value:AVERAGE",
362 "DEF:val_min={file}:value:MIN",
363 "DEF:val_max={file}:value:MAX",
364 "AREA:val_max#$HalfBlue",
365 "AREA:val_min#$Canvas",
366 "LINE1:val_avg#$FullBlue:{inst}",
367 'GPRINT:val_min:MIN:%5.2lf Min,',
368 'GPRINT:val_avg:AVERAGE:%5.2lf Avg,',
369 'GPRINT:val_max:MAX:%5.2lf Max,',
370 'GPRINT:val_avg:LAST:%5.2lf Last'
373 "DEF:hits_min={file}:hits:MIN",
374 "DEF:hits_avg={file}:hits:AVERAGE",
375 "DEF:hits_max={file}:hits:MAX",
376 "DEF:inserts_min={file}:inserts:MIN",
377 "DEF:inserts_avg={file}:inserts:AVERAGE",
378 "DEF:inserts_max={file}:inserts:MAX",
379 "DEF:not_cached_min={file}:not_cached:MIN",
380 "DEF:not_cached_avg={file}:not_cached:AVERAGE",
381 "DEF:not_cached_max={file}:not_cached:MAX",
382 "DEF:lowmem_prunes_min={file}:lowmem_prunes:MIN",
383 "DEF:lowmem_prunes_avg={file}:lowmem_prunes:AVERAGE",
384 "DEF:lowmem_prunes_max={file}:lowmem_prunes:MAX",
385 "DEF:queries_min={file}:queries_in_cache:MIN",
386 "DEF:queries_avg={file}:queries_in_cache:AVERAGE",
387 "DEF:queries_max={file}:queries_in_cache:MAX",
388 "CDEF:unknown=queries_avg,UNKN,+",
389 "CDEF:not_cached_agg=hits_avg,inserts_avg,+,not_cached_avg,+",
390 "CDEF:inserts_agg=hits_avg,inserts_avg,+",
391 "CDEF:hits_agg=hits_avg",
392 "AREA:not_cached_agg#$HalfYellow",
393 "AREA:inserts_agg#$HalfBlue",
394 "AREA:hits_agg#$HalfGreen",
395 "LINE1:not_cached_agg#$FullYellow:Not Cached ",
396 'GPRINT:not_cached_min:MIN:%5.2lf Min,',
397 'GPRINT:not_cached_avg:AVERAGE:%5.2lf Avg,',
398 'GPRINT:not_cached_max:MAX:%5.2lf Max,',
399 'GPRINT:not_cached_avg:LAST:%5.2lf Last\l',
400 "LINE1:inserts_agg#$FullBlue:Inserts ",
401 'GPRINT:inserts_min:MIN:%5.2lf Min,',
402 'GPRINT:inserts_avg:AVERAGE:%5.2lf Avg,',
403 'GPRINT:inserts_max:MAX:%5.2lf Max,',
404 'GPRINT:inserts_avg:LAST:%5.2lf Last\l',
405 "LINE1:hits_agg#$FullGreen:Hits ",
406 'GPRINT:hits_min:MIN:%5.2lf Min,',
407 'GPRINT:hits_avg:AVERAGE:%5.2lf Avg,',
408 'GPRINT:hits_max:MAX:%5.2lf Max,',
409 'GPRINT:hits_avg:LAST:%5.2lf Last\l',
410 "LINE1:lowmem_prunes_avg#$FullRed:Lowmem Prunes ",
411 'GPRINT:lowmem_prunes_min:MIN:%5.2lf Min,',
412 'GPRINT:lowmem_prunes_avg:AVERAGE:%5.2lf Avg,',
413 'GPRINT:lowmem_prunes_max:MAX:%5.2lf Max,',
414 'GPRINT:lowmem_prunes_avg:LAST:%5.2lf Last\l',
415 "LINE1:unknown#$Canvas:Queries in cache",
416 'GPRINT:queries_min:MIN:%5.0lf Min,',
417 'GPRINT:queries_avg:AVERAGE:%5.0lf Avg,',
418 'GPRINT:queries_max:MAX:%5.0lf Max,',
419 'GPRINT:queries_avg:LAST:%5.0lf Last\l'
422 "DEF:running_min={file}:running:MIN",
423 "DEF:running_avg={file}:running:AVERAGE",
424 "DEF:running_max={file}:running:MAX",
425 "DEF:connected_min={file}:connected:MIN",
426 "DEF:connected_avg={file}:connected:AVERAGE",
427 "DEF:connected_max={file}:connected:MAX",
428 "DEF:cached_min={file}:cached:MIN",
429 "DEF:cached_avg={file}:cached:AVERAGE",
430 "DEF:cached_max={file}:cached:MAX",
431 "DEF:created_min={file}:created:MIN",
432 "DEF:created_avg={file}:created:AVERAGE",
433 "DEF:created_max={file}:created:MAX",
434 "CDEF:unknown=created_avg,UNKN,+",
435 "CDEF:cached_agg=connected_avg,cached_avg,+",
436 "AREA:cached_agg#$HalfGreen",
437 "AREA:connected_avg#$HalfBlue",
438 "AREA:running_avg#$HalfRed",
439 "LINE1:cached_agg#$FullGreen:Cached ",
440 'GPRINT:cached_min:MIN:%5.1lf Min,',
441 'GPRINT:cached_avg:AVERAGE:%5.1lf Avg,',
442 'GPRINT:cached_max:MAX:%5.1lf Max,',
443 'GPRINT:cached_avg:LAST:%5.1lf Last\l',
444 "LINE1:connected_avg#$FullBlue:Connected",
445 'GPRINT:connected_min:MIN:%5.1lf Min,',
446 'GPRINT:connected_avg:AVERAGE:%5.1lf Avg,',
447 'GPRINT:connected_max:MAX:%5.1lf Max,',
448 'GPRINT:connected_avg:LAST:%5.1lf Last\l',
449 "LINE1:running_avg#$FullRed:Running ",
450 'GPRINT:running_min:MIN:%5.1lf Min,',
451 'GPRINT:running_avg:AVERAGE:%5.1lf Avg,',
452 'GPRINT:running_max:MAX:%5.1lf Max,',
453 'GPRINT:running_avg:LAST:%5.1lf Last\l',
454 "LINE1:unknown#$Canvas:Created ",
455 'GPRINT:created_min:MIN:%5.0lf Min,',
456 'GPRINT:created_avg:AVERAGE:%5.0lf Avg,',
457 'GPRINT:created_max:MAX:%5.0lf Max,',
458 'GPRINT:created_avg:LAST:%5.0lf Last\l'
461 "DEF:null_avg={file}:null:AVERAGE",
462 "DEF:getattr_avg={file}:getattr:AVERAGE",
463 "DEF:setattr_avg={file}:setattr:AVERAGE",
464 "DEF:lookup_avg={file}:lookup:AVERAGE",
465 "DEF:access_avg={file}:access:AVERAGE",
466 "DEF:readlink_avg={file}:readlink:AVERAGE",
467 "DEF:read_avg={file}:read:AVERAGE",
468 "DEF:write_avg={file}:write:AVERAGE",
469 "DEF:create_avg={file}:create:AVERAGE",
470 "DEF:mkdir_avg={file}:mkdir:AVERAGE",
471 "DEF:symlink_avg={file}:symlink:AVERAGE",
472 "DEF:mknod_avg={file}:mknod:AVERAGE",
473 "DEF:remove_avg={file}:remove:AVERAGE",
474 "DEF:rmdir_avg={file}:rmdir:AVERAGE",
475 "DEF:rename_avg={file}:rename:AVERAGE",
476 "DEF:link_avg={file}:link:AVERAGE",
477 "DEF:readdir_avg={file}:readdir:AVERAGE",
478 "DEF:readdirplus_avg={file}:readdirplus:AVERAGE",
479 "DEF:fsstat_avg={file}:fsstat:AVERAGE",
480 "DEF:fsinfo_avg={file}:fsinfo:AVERAGE",
481 "DEF:pathconf_avg={file}:pathconf:AVERAGE",
482 "DEF:commit_avg={file}:commit:AVERAGE",
483 "DEF:null_max={file}:null:MAX",
484 "DEF:getattr_max={file}:getattr:MAX",
485 "DEF:setattr_max={file}:setattr:MAX",
486 "DEF:lookup_max={file}:lookup:MAX",
487 "DEF:access_max={file}:access:MAX",
488 "DEF:readlink_max={file}:readlink:MAX",
489 "DEF:read_max={file}:read:MAX",
490 "DEF:write_max={file}:write:MAX",
491 "DEF:create_max={file}:create:MAX",
492 "DEF:mkdir_max={file}:mkdir:MAX",
493 "DEF:symlink_max={file}:symlink:MAX",
494 "DEF:mknod_max={file}:mknod:MAX",
495 "DEF:remove_max={file}:remove:MAX",
496 "DEF:rmdir_max={file}:rmdir:MAX",
497 "DEF:rename_max={file}:rename:MAX",
498 "DEF:link_max={file}:link:MAX",
499 "DEF:readdir_max={file}:readdir:MAX",
500 "DEF:readdirplus_max={file}:readdirplus:MAX",
501 "DEF:fsstat_max={file}:fsstat:MAX",
502 "DEF:fsinfo_max={file}:fsinfo:MAX",
503 "DEF:pathconf_max={file}:pathconf:MAX",
504 "DEF:commit_max={file}:commit:MAX",
505 "CDEF:other_avg=null_avg,readlink_avg,create_avg,mkdir_avg,symlink_avg,mknod_avg,remove_avg,rmdir_avg,rename_avg,link_avg,readdir_avg,readdirplus_avg,fsstat_avg,fsinfo_avg,pathconf_avg,+,+,+,+,+,+,+,+,+,+,+,+,+,+",
506 "CDEF:other_max=null_max,readlink_max,create_max,mkdir_max,symlink_max,mknod_max,remove_max,rmdir_max,rename_max,link_max,readdir_max,readdirplus_max,fsstat_max,fsinfo_max,pathconf_max,+,+,+,+,+,+,+,+,+,+,+,+,+,+",
507 "CDEF:stack_read=read_avg",
508 "CDEF:stack_getattr=stack_read,getattr_avg,+",
509 "CDEF:stack_access=stack_getattr,access_avg,+",
510 "CDEF:stack_lookup=stack_access,lookup_avg,+",
511 "CDEF:stack_write=stack_lookup,write_avg,+",
512 "CDEF:stack_commit=stack_write,commit_avg,+",
513 "CDEF:stack_setattr=stack_commit,setattr_avg,+",
514 "CDEF:stack_other=stack_setattr,other_avg,+",
515 "AREA:stack_other#$HalfRed",
516 "AREA:stack_setattr#$HalfGreen",
517 "AREA:stack_commit#$HalfYellow",
518 "AREA:stack_write#$HalfGreen",
519 "AREA:stack_lookup#$HalfBlue",
520 "AREA:stack_access#$HalfMagenta",
521 "AREA:stack_getattr#$HalfCyan",
522 "AREA:stack_read#$HalfBlue",
523 "LINE1:stack_other#$FullRed:Other ",
524 'GPRINT:other_max:MAX:%5.1lf Max,',
525 'GPRINT:other_avg:AVERAGE:%5.1lf Avg,',
526 'GPRINT:other_avg:LAST:%5.1lf Last\l',
527 "LINE1:stack_setattr#$FullGreen:setattr",
528 'GPRINT:setattr_max:MAX:%5.1lf Max,',
529 'GPRINT:setattr_avg:AVERAGE:%5.1lf Avg,',
530 'GPRINT:setattr_avg:LAST:%5.1lf Last\l',
531 "LINE1:stack_commit#$FullYellow:commit ",
532 'GPRINT:commit_max:MAX:%5.1lf Max,',
533 'GPRINT:commit_avg:AVERAGE:%5.1lf Avg,',
534 'GPRINT:commit_avg:LAST:%5.1lf Last\l',
535 "LINE1:stack_write#$FullGreen:write ",
536 'GPRINT:write_max:MAX:%5.1lf Max,',
537 'GPRINT:write_avg:AVERAGE:%5.1lf Avg,',
538 'GPRINT:write_avg:LAST:%5.1lf Last\l',
539 "LINE1:stack_lookup#$FullBlue:lookup ",
540 'GPRINT:lookup_max:MAX:%5.1lf Max,',
541 'GPRINT:lookup_avg:AVERAGE:%5.1lf Avg,',
542 'GPRINT:lookup_avg:LAST:%5.1lf Last\l',
543 "LINE1:stack_access#$FullMagenta:access ",
544 'GPRINT:access_max:MAX:%5.1lf Max,',
545 'GPRINT:access_avg:AVERAGE:%5.1lf Avg,',
546 'GPRINT:access_avg:LAST:%5.1lf Last\l',
547 "LINE1:stack_getattr#$FullCyan:getattr",
548 'GPRINT:getattr_max:MAX:%5.1lf Max,',
549 'GPRINT:getattr_avg:AVERAGE:%5.1lf Avg,',
550 'GPRINT:getattr_avg:LAST:%5.1lf Last\l',
551 "LINE1:stack_read#$FullBlue:read ",
552 'GPRINT:read_max:MAX:%5.1lf Max,',
553 'GPRINT:read_avg:AVERAGE:%5.1lf Avg,',
554 'GPRINT:read_avg:LAST:%5.1lf Last\l'
557 "DEF:rbyte_avg={file}:rbytes:AVERAGE",
558 "DEF:rbyte_min={file}:rbytes:MIN",
559 "DEF:rbyte_max={file}:rbytes:MAX",
560 "DEF:wbyte_avg={file}:wbytes:AVERAGE",
561 "DEF:wbyte_min={file}:wbytes:MIN",
562 "DEF:wbyte_max={file}:wbytes:MAX",
563 'CDEF:overlap=wbyte_avg,rbyte_avg,GT,rbyte_avg,wbyte_avg,IF',
564 "AREA:wbyte_avg#$HalfGreen",
565 "AREA:rbyte_avg#$HalfBlue",
566 "AREA:overlap#$HalfBlueGreen",
567 "LINE1:wbyte_avg#$FullGreen:Write",
568 'GPRINT:wbyte_min:MIN:%5.1lf%s Min,',
569 'GPRINT:wbyte_avg:AVERAGE:%5.1lf%s Avg,',
570 'GPRINT:wbyte_max:MAX:%5.1lf%s Max,',
571 'GPRINT:wbyte_avg:LAST:%5.1lf%s Last\l',
572 "LINE1:rbyte_avg#$FullBlue:Read ",
573 'GPRINT:rbyte_min:MIN:%5.1lf%s Min,',
574 'GPRINT:rbyte_avg:AVERAGE:%5.1lf%s Avg,',
575 'GPRINT:rbyte_max:MAX:%5.1lf%s Max,',
576 'GPRINT:rbyte_avg:LAST:%5.1lf%s Last\l'
578 ping => ['DEF:ping_avg={file}:ping:AVERAGE',
579 'DEF:ping_min={file}:ping:MIN',
580 'DEF:ping_max={file}:ping:MAX',
581 "AREA:ping_max#$HalfBlue",
582 "AREA:ping_min#$Canvas",
583 "LINE1:ping_avg#$FullBlue:Ping",
584 'GPRINT:ping_min:MIN:%4.1lf ms Min,',
585 'GPRINT:ping_avg:AVERAGE:%4.1lf ms Avg,',
586 'GPRINT:ping_max:MAX:%4.1lf ms Max,',
587 'GPRINT:ping_avg:LAST:%4.1lf ms Last'],
589 "DEF:running_avg={file}:running:AVERAGE",
590 "DEF:running_min={file}:running:MIN",
591 "DEF:running_max={file}:running:MAX",
592 "DEF:sleeping_avg={file}:sleeping:AVERAGE",
593 "DEF:sleeping_min={file}:sleeping:MIN",
594 "DEF:sleeping_max={file}:sleeping:MAX",
595 "DEF:zombies_avg={file}:zombies:AVERAGE",
596 "DEF:zombies_min={file}:zombies:MIN",
597 "DEF:zombies_max={file}:zombies:MAX",
598 "DEF:stopped_avg={file}:stopped:AVERAGE",
599 "DEF:stopped_min={file}:stopped:MIN",
600 "DEF:stopped_max={file}:stopped:MAX",
601 "DEF:paging_avg={file}:paging:AVERAGE",
602 "DEF:paging_min={file}:paging:MIN",
603 "DEF:paging_max={file}:paging:MAX",
604 "DEF:blocked_avg={file}:blocked:AVERAGE",
605 "DEF:blocked_min={file}:blocked:MIN",
606 "DEF:blocked_max={file}:blocked:MAX",
607 'CDEF:paging_acc=sleeping_avg,running_avg,stopped_avg,zombies_avg,blocked_avg,paging_avg,+,+,+,+,+',
608 'CDEF:blocked_acc=sleeping_avg,running_avg,stopped_avg,zombies_avg,blocked_avg,+,+,+,+',
609 'CDEF:zombies_acc=sleeping_avg,running_avg,stopped_avg,zombies_avg,+,+,+',
610 'CDEF:stopped_acc=sleeping_avg,running_avg,stopped_avg,+,+',
611 'CDEF:running_acc=sleeping_avg,running_avg,+',
612 'CDEF:sleeping_acc=sleeping_avg',
613 "AREA:paging_acc#$HalfYellow",
614 "AREA:blocked_acc#$HalfCyan",
615 "AREA:zombies_acc#$HalfRed",
616 "AREA:stopped_acc#$HalfMagenta",
617 "AREA:running_acc#$HalfGreen",
618 "AREA:sleeping_acc#$HalfBlue",
619 "LINE1:paging_acc#$FullYellow:Paging ",
620 'GPRINT:paging_min:MIN:%5.1lf Min,',
621 'GPRINT:paging_avg:AVERAGE:%5.1lf Average,',
622 'GPRINT:paging_max:MAX:%5.1lf Max,',
623 'GPRINT:paging_avg:LAST:%5.1lf Last\l',
624 "LINE1:blocked_acc#$FullCyan:Blocked ",
625 'GPRINT:blocked_min:MIN:%5.1lf Min,',
626 'GPRINT:blocked_avg:AVERAGE:%5.1lf Average,',
627 'GPRINT:blocked_max:MAX:%5.1lf Max,',
628 'GPRINT:blocked_avg:LAST:%5.1lf Last\l',
629 "LINE1:zombies_acc#$FullRed:Zombies ",
630 'GPRINT:zombies_min:MIN:%5.1lf Min,',
631 'GPRINT:zombies_avg:AVERAGE:%5.1lf Average,',
632 'GPRINT:zombies_max:MAX:%5.1lf Max,',
633 'GPRINT:zombies_avg:LAST:%5.1lf Last\l',
634 "LINE1:stopped_acc#$FullMagenta:Stopped ",
635 'GPRINT:stopped_min:MIN:%5.1lf Min,',
636 'GPRINT:stopped_avg:AVERAGE:%5.1lf Average,',
637 'GPRINT:stopped_max:MAX:%5.1lf Max,',
638 'GPRINT:stopped_avg:LAST:%5.1lf Last\l',
639 "LINE1:running_acc#$FullGreen:Running ",
640 'GPRINT:running_min:MIN:%5.1lf Min,',
641 'GPRINT:running_avg:AVERAGE:%5.1lf Average,',
642 'GPRINT:running_max:MAX:%5.1lf Max,',
643 'GPRINT:running_avg:LAST:%5.1lf Last\l',
644 "LINE1:sleeping_acc#$FullBlue:Sleeping",
645 'GPRINT:sleeping_min:MIN:%5.1lf Min,',
646 'GPRINT:sleeping_avg:AVERAGE:%5.1lf Average,',
647 'GPRINT:sleeping_max:MAX:%5.1lf Max,',
648 'GPRINT:sleeping_avg:LAST:%5.1lf Last\l'
651 'DEF:used_avg={file}:used:AVERAGE',
652 'DEF:used_min={file}:used:MIN',
653 'DEF:used_max={file}:used:MAX',
654 'DEF:free_avg={file}:free:AVERAGE',
655 'DEF:free_min={file}:free:MIN',
656 'DEF:free_max={file}:free:MAX',
657 'DEF:cach_avg={file}:cached:AVERAGE',
658 'DEF:cach_min={file}:cached:MIN',
659 'DEF:cach_max={file}:cached:MAX',
660 'DEF:resv_avg={file}:resv:AVERAGE',
661 'DEF:resv_min={file}:resv:MIN',
662 'DEF:resv_max={file}:resv:MAX',
663 'CDEF:cach_avg_notnull=cach_avg,UN,0,cach_avg,IF',
664 'CDEF:resv_avg_notnull=resv_avg,UN,0,resv_avg,IF',
665 'CDEF:used_acc=used_avg',
666 'CDEF:resv_acc=used_acc,resv_avg_notnull,+',
667 'CDEF:cach_acc=resv_acc,cach_avg_notnull,+',
668 'CDEF:free_acc=cach_acc,free_avg,+',
669 "AREA:free_acc#$HalfGreen",
670 "AREA:cach_acc#$HalfBlue",
671 "AREA:resv_acc#$HalfYellow",
672 "AREA:used_acc#$HalfRed",
673 "LINE1:free_acc#$FullGreen:Free ",
674 'GPRINT:free_min:MIN:%5.1lf%s Min,',
675 'GPRINT:free_avg:AVERAGE:%5.1lf%s Avg,',
676 'GPRINT:free_max:MAX:%5.1lf%s Max,',
677 'GPRINT:free_avg:LAST:%5.1lf%s Last\n',
678 "LINE1:cach_acc#$FullBlue:Cached ",
679 'GPRINT:cach_min:MIN:%5.1lf%s Min,',
680 'GPRINT:cach_avg:AVERAGE:%5.1lf%s Avg,',
681 'GPRINT:cach_max:MAX:%5.1lf%s Max,',
682 'GPRINT:cach_avg:LAST:%5.1lf%s Last\l',
683 "LINE1:resv_acc#$FullYellow:Reserved",
684 'GPRINT:resv_min:MIN:%5.1lf%s Min,',
685 'GPRINT:resv_avg:AVERAGE:%5.1lf%s Avg,',
686 'GPRINT:resv_max:MAX:%5.1lf%s Max,',
687 'GPRINT:resv_avg:LAST:%5.1lf%s Last\n',
688 "LINE1:used_acc#$FullRed:Used ",
689 'GPRINT:used_min:MIN:%5.1lf%s Min,',
690 'GPRINT:used_avg:AVERAGE:%5.1lf%s Avg,',
691 'GPRINT:used_max:MAX:%5.1lf%s Max,',
692 'GPRINT:used_avg:LAST:%5.1lf%s Last\l'
695 'DEF:temp_avg={file}:value:AVERAGE',
696 'DEF:temp_min={file}:value:MIN',
697 'DEF:temp_max={file}:value:MAX',
698 "AREA:temp_max#$HalfBlue",
699 "AREA:temp_min#$Canvas",
700 "LINE1:temp_avg#$FullBlue:Value",
701 'GPRINT:temp_min:MIN:%4.1lf Min,',
702 'GPRINT:temp_avg:AVERAGE:%4.1lf Avg,',
703 'GPRINT:temp_max:MAX:%4.1lf Max,',
704 'GPRINT:temp_avg:LAST:%4.1lf Last\l'
706 traffic => ['DEF:out_min_raw={file}:outgoing:MIN',
707 'DEF:out_avg_raw={file}:outgoing:AVERAGE',
708 'DEF:out_max_raw={file}:outgoing:MAX',
709 'DEF:inc_min_raw={file}:incoming:MIN',
710 'DEF:inc_avg_raw={file}:incoming:AVERAGE',
711 'DEF:inc_max_raw={file}:incoming:MAX',
712 'CDEF:out_min=out_min_raw,8,*',
713 'CDEF:out_avg=out_avg_raw,8,*',
714 'CDEF:out_max=out_max_raw,8,*',
715 'CDEF:inc_min=inc_min_raw,8,*',
716 'CDEF:inc_avg=inc_avg_raw,8,*',
717 'CDEF:inc_max=inc_max_raw,8,*',
718 'CDEF:overlap=out_avg,inc_avg,GT,inc_avg,out_avg,IF',
719 'CDEF:mytime=out_avg_raw,TIME,TIME,IF',
720 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
721 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
722 'CDEF:out_avg_sample=out_avg_raw,UN,0,out_avg_raw,IF,sample_len,*',
723 'CDEF:out_avg_sum=PREV,UN,0,PREV,IF,out_avg_sample,+',
724 'CDEF:inc_avg_sample=inc_avg_raw,UN,0,inc_avg_raw,IF,sample_len,*',
725 'CDEF:inc_avg_sum=PREV,UN,0,PREV,IF,inc_avg_sample,+',
726 "AREA:out_avg#$HalfGreen",
727 "AREA:inc_avg#$HalfBlue",
728 "AREA:overlap#$HalfBlueGreen",
729 "LINE1:out_avg#$FullGreen:Outgoing",
730 'GPRINT:out_avg:AVERAGE:%5.1lf%s Avg,',
731 'GPRINT:out_max:MAX:%5.1lf%s Max,',
732 'GPRINT:out_avg:LAST:%5.1lf%s Last',
733 'GPRINT:out_avg_sum:LAST:(ca. %5.1lf%sB Total)\l',
734 "LINE1:inc_avg#$FullBlue:Incoming",
735 #'GPRINT:inc_min:MIN:%5.1lf %s Min,',
736 'GPRINT:inc_avg:AVERAGE:%5.1lf%s Avg,',
737 'GPRINT:inc_max:MAX:%5.1lf%s Max,',
738 'GPRINT:inc_avg:LAST:%5.1lf%s Last',
739 'GPRINT:inc_avg_sum:LAST:(ca. %5.1lf%sB Total)\l'
742 'DEF:cpufreq_avg={file}:value:AVERAGE',
743 'DEF:cpufreq_min={file}:value:MIN',
744 'DEF:cpufreq_max={file}:value:MAX',
745 "AREA:cpufreq_max#$HalfBlue",
746 "AREA:cpufreq_min#$Canvas",
747 "LINE1:cpufreq_avg#$FullBlue:Frequency",
748 'GPRINT:cpufreq_min:MIN:%5.1lf%s Min,',
749 'GPRINT:cpufreq_avg:AVERAGE:%5.1lf%s Avg,',
750 'GPRINT:cpufreq_max:MAX:%5.1lf%s Max,',
751 'GPRINT:cpufreq_avg:LAST:%5.1lf%s Last\l'
754 'DEF:users_avg={file}:users:AVERAGE',
755 'DEF:users_min={file}:users:MIN',
756 'DEF:users_max={file}:users:MAX',
757 "AREA:users_max#$HalfBlue",
758 "AREA:users_min#$Canvas",
759 "LINE1:users_avg#$FullBlue:Users",
760 'GPRINT:users_min:MIN:%4.1lf Min,',
761 'GPRINT:users_avg:AVERAGE:%4.1lf Average,',
762 'GPRINT:users_max:MAX:%4.1lf Max,',
763 'GPRINT:users_avg:LAST:%4.1lf Last\l'
766 'DEF:avg={file}:voltage:AVERAGE',
767 'DEF:min={file}:voltage:MIN',
768 'DEF:max={file}:voltage:MAX',
769 "AREA:max#$HalfBlue",
771 "LINE1:avg#$FullBlue:Voltage",
772 'GPRINT:min:MIN:%5.1lf%sV Min,',
773 'GPRINT:avg:AVERAGE:%5.1lf%sV Avg,',
774 'GPRINT:max:MAX:%5.1lf%sV Max,',
775 'GPRINT:avg:LAST:%5.1lf%sV Last\l'
778 "DEF:total_avg={file}:total:AVERAGE",
779 "DEF:total_min={file}:total:MIN",
780 "DEF:total_max={file}:total:MAX",
781 "DEF:running_avg={file}:running:AVERAGE",
782 "DEF:running_min={file}:running:MIN",
783 "DEF:running_max={file}:running:MAX",
784 "DEF:uninterruptible_avg={file}:uninterruptible:AVERAGE",
785 "DEF:uninterruptible_min={file}:uninterruptible:MIN",
786 "DEF:uninterruptible_max={file}:uninterruptible:MAX",
787 "DEF:onhold_avg={file}:onhold:AVERAGE",
788 "DEF:onhold_min={file}:onhold:MIN",
789 "DEF:onhold_max={file}:onhold:MAX",
790 "LINE1:total_avg#$FullYellow:Total ",
791 'GPRINT:total_min:MIN:%5.1lf Min,',
792 'GPRINT:total_avg:AVERAGE:%5.1lf Avg.,',
793 'GPRINT:total_max:MAX:%5.1lf Max,',
794 'GPRINT:total_avg:LAST:%5.1lf Last\l',
795 "LINE1:running_avg#$FullRed:Running ",
796 'GPRINT:running_min:MIN:%5.1lf Min,',
797 'GPRINT:running_avg:AVERAGE:%5.1lf Avg.,',
798 'GPRINT:running_max:MAX:%5.1lf Max,',
799 'GPRINT:running_avg:LAST:%5.1lf Last\l',
800 "LINE1:uninterruptible_avg#$FullGreen:Unintr ",
801 'GPRINT:uninterruptible_min:MIN:%5.1lf Min,',
802 'GPRINT:uninterruptible_avg:AVERAGE:%5.1lf Avg.,',
803 'GPRINT:uninterruptible_max:MAX:%5.1lf Max,',
804 'GPRINT:uninterruptible_avg:LAST:%5.1lf Last\l',
805 "LINE1:onhold_avg#$FullBlue:Onhold ",
806 'GPRINT:onhold_min:MIN:%5.1lf Min,',
807 'GPRINT:onhold_avg:AVERAGE:%5.1lf Avg.,',
808 'GPRINT:onhold_max:MAX:%5.1lf Max,',
809 'GPRINT:onhold_avg:LAST:%5.1lf Last\l'
812 'DEF:vm_avg={file}:vm:AVERAGE',
813 'DEF:vm_min={file}:vm:MIN',
814 'DEF:vm_max={file}:vm:MAX',
815 'DEF:vml_avg={file}:vml:AVERAGE',
816 'DEF:vml_min={file}:vml:MIN',
817 'DEF:vml_max={file}:vml:MAX',
818 'DEF:rss_avg={file}:rss:AVERAGE',
819 'DEF:rss_min={file}:rss:MIN',
820 'DEF:rss_max={file}:rss:MAX',
821 'DEF:anon_avg={file}:anon:AVERAGE',
822 'DEF:anon_min={file}:anon:MIN',
823 'DEF:anon_max={file}:anon:MAX',
824 "LINE1:vm_avg#$FullYellow:VM ",
825 'GPRINT:vm_min:MIN:%5.1lf%s Min,',
826 'GPRINT:vm_avg:AVERAGE:%5.1lf%s Avg.,',
827 'GPRINT:vm_max:MAX:%5.1lf%s Avg.,',
828 'GPRINT:vm_avg:LAST:%5.1lf%s Last\l',
829 "LINE1:vml_avg#$FullRed:Locked ",
830 'GPRINT:vml_min:MIN:%5.1lf%s Min,',
831 'GPRINT:vml_avg:AVERAGE:%5.1lf%s Avg.,',
832 'GPRINT:vml_max:MAX:%5.1lf%s Avg.,',
833 'GPRINT:vml_avg:LAST:%5.1lf%s Last\l',
834 "LINE1:rss_avg#$FullGreen:RSS ",
835 'GPRINT:rss_min:MIN:%5.1lf%s Min,',
836 'GPRINT:rss_avg:AVERAGE:%5.1lf%s Avg.,',
837 'GPRINT:rss_max:MAX:%5.1lf%s Avg.,',
838 'GPRINT:rss_avg:LAST:%5.1lf%s Last\l',
839 "LINE1:anon_avg#$FullBlue:Anon. ",
840 'GPRINT:anon_min:MIN:%5.1lf%s Min,',
841 'GPRINT:anon_avg:AVERAGE:%5.1lf%s Avg.,',
842 'GPRINT:anon_max:MAX:%5.1lf%s Avg.,',
843 'GPRINT:anon_avg:LAST:%5.1lf%s Last\l',
846 'DEF:proc_avg={file}:total:AVERAGE',
847 'DEF:proc_min={file}:total:MIN',
848 'DEF:proc_max={file}:total:MAX',
849 "AREA:proc_max#$HalfBlue",
850 "AREA:proc_min#$Canvas",
851 "LINE1:proc_avg#$FullBlue:Processes",
852 'GPRINT:proc_min:MIN:%4.1lf Min,',
853 'GPRINT:proc_avg:AVERAGE:%4.1lf Avg.,',
854 'GPRINT:proc_max:MAX:%4.1lf Max,',
855 'GPRINT:proc_avg:LAST:%4.1lf Last\l'
858 $GraphDefs->{'disk'} = $GraphDefs->{'partition'};
859 $GraphDefs->{'meminfo'} = $GraphDefs->{'memory'};
860 $GraphDefs->{'sensors'} = $GraphDefs->{'temperature'};
865 apache_bytes => ['-t', 'apache traffic', '-v', 'Bit/s'],
866 apache_requests => ['-t', 'apache requests', '-v', 'Requests/s'],
867 apache_scoreboard => ['-t', 'apache scoreboard {inst}', '-v', 'Processes'],
868 charge => ['-t', '{host} charge', '-v', 'Ampere hours'],
869 cpu => ['-t', '{host} cpu{inst} usage', '-v', 'Percent', '-l', '0'],
870 cpufreq => ['-t', '{host} cpu{inst} usage', '-v', 'Mhz'],
871 current => ['-t', '{host} current', '-v', 'Ampere'],
872 #disk => ['-t', '{host} disk {inst} IO wait', '-v', 'Seconds'],
873 df => ['-t', '{host}:{inst} usage', '-v', 'Percent', '-l', '0'],
874 disk => ['-t', '{host} disk {inst} usage', '-v', 'Byte/s'],
875 fanspeed => ['-t', '{host} fanspeed {inst}', '-v', 'rpm'],
876 hddtemp => ['-t', '{host} hdd temperature {inst}', '-v', '°Celsius'],
877 load => ['-t', '{host} load average', '-v', 'System load', '-X', '0'],
878 mails => ['-t', '{host} mail count', '-v', 'Amount', '-X', '0'],
879 memory => ['-t', '{host} memory usage', '-v', 'Bytes', '-b', '1024', '-l', '0'],
880 mysql_commands => ['-t', 'mysql command {inst}', '-v', 'Issues/s' ],
881 mysql_handler => ['-t', 'mysql handler {inst}', '-v', 'Issues/s' ],
882 mysql_qcache => ['-t', 'mysql query cache', '-v', 'Queries/s' ],
883 mysql_threads => ['-t', 'mysql threads', '-v', 'Threads' ],
884 nfs3_procedures => ['-t', '{host} NFSv3 {inst} procedures', '-v', 'Procedures/s' ],
885 partition => ['-t', '{host} partition {inst} usage', '-v', 'Byte/s'],
886 ping => ['-t', '{host} ping to {inst}', '-v', 'ms'],
887 processes => ['-t', '{host} processes', '-v', 'Processes'],
888 sensors => ['-t', '{host} sensor {inst}', '-v', '°Celsius'],
889 swap => ['-t', '{host} swap usage', '-v', 'Bytes', '-b', '1024', '-l', '0'],
890 temperature => ['-t', '{host} temperature {inst}', '-v', '°Celsius'],
891 traffic => ['-t', '{host} {inst} traffic', '-v', 'Bit/s'],
892 users => ['-t', '{host} users', '-v', 'Users'],
893 voltage => ['-t', '{host} voltage', '-v', 'Volts'],
894 threads => ['-t', '{host} threads', '-v', 'Threads'],
895 vs_memory => ['-t', '{host} memory usage', '-v', 'Bytes'],
896 vs_processes => ['-t', '{host} processes', '-v', 'Processes'],
901 apache_scoreboard => \&output_graph_apache_scoreboard,
902 cpu => \&output_graph_cpu,
908 mysql_commands => \&output_graph_mysql_commands,
909 mysql_handler => \&output_graph_mysql_handler,
911 ping => \&output_graph_ping,
918 if (defined ($ENV{'GATEWAY_INTERFACE'}))
920 @Info = ($ENV{'PATH_INFO'} || '') =~ m#([\w\-\.]+)#g;
927 parse_pathinfo (@Info);
950 "DEF:user_avg_$_=$AbsDir/cpu-$_.rrd:user:AVERAGE",
951 "DEF:user_min_$_=$AbsDir/cpu-$_.rrd:user:MIN",
952 "DEF:user_max_$_=$AbsDir/cpu-$_.rrd:user:MAX",
953 "DEF:nice_avg_$_=$AbsDir/cpu-$_.rrd:nice:AVERAGE",
954 "DEF:nice_min_$_=$AbsDir/cpu-$_.rrd:nice:MIN",
955 "DEF:nice_max_$_=$AbsDir/cpu-$_.rrd:nice:MAX",
956 "DEF:syst_avg_$_=$AbsDir/cpu-$_.rrd:syst:AVERAGE",
957 "DEF:syst_min_$_=$AbsDir/cpu-$_.rrd:syst:MIN",
958 "DEF:syst_max_$_=$AbsDir/cpu-$_.rrd:syst:MAX",
959 "DEF:wait_avg_$_=$AbsDir/cpu-$_.rrd:wait:AVERAGE",
960 "DEF:wait_min_$_=$AbsDir/cpu-$_.rrd:wait:MIN",
961 "DEF:wait_max_$_=$AbsDir/cpu-$_.rrd:wait:MAX");
964 for (qw(user nice syst wait))
969 my $default_value = ($def eq 'user' or $def eq 'syst') ? 'UNKN' : '0';
971 for (qw(avg min max))
977 push (@ret, "CDEF:${def}_${cf}_notnull_${_}=${def}_${cf}_${_},UN,0,${def}_${cf}_${_},IF");
978 push (@ret, "CDEF:${def}_${cf}_defined_${_}=${def}_${cf}_${_},UN,0,1,IF");
981 $cdef = "CDEF:${def}_${cf}_num=" . join (',', map { "${def}_${cf}_defined_${_}" } (@inst));
982 $cdef .= ',+' x (scalar (@inst) - 1);
985 $cdef = "CDEF:${def}_${cf}=${def}_${cf}_num," . join (',', map { "${def}_${cf}_notnull_${_}" } (@inst));
986 $cdef .= ',+' x (scalar (@inst) - 1);
987 $cdef .= ",${def}_${cf}_num,${def}_${cf}_num,1,IF,/,$default_value,IF";
989 push (@ret, "CDEF:${def}_${cf}_notnull=${def}_${cf},UN,0,${def}_${cf},IF");
994 "CDEF:nice_acc=syst_avg_notnull,wait_avg_notnull,user_avg_notnull,nice_avg_notnull,+,+,+",
995 "CDEF:user_acc=syst_avg_notnull,wait_avg_notnull,user_avg_notnull,+,+",
996 "CDEF:wait_acc=syst_avg_notnull,wait_avg_notnull,+",
997 "CDEF:syst_acc=syst_avg_notnull");
999 push (@ret, grep { $_ !~ m/^C?DEF/ } (@{$GraphDefs->{'cpu'}}));
1004 sub output_graph_apache_scoreboard
1011 my @colors = get_n_colors (scalar (@inst));
1013 for (my $i = 0; $i < scalar (@inst); $i++)
1015 my $inst = $inst[$i];
1017 "DEF:avg_$i=$AbsDir/apache_scoreboard-$inst.rrd:count:AVERAGE",
1018 "DEF:min_$i=$AbsDir/apache_scoreboard-$inst.rrd:count:MIN",
1019 "DEF:max_$i=$AbsDir/apache_scoreboard-$inst.rrd:count:MAX");
1022 for (my $i = 0; $i < scalar (@inst); $i++)
1024 my $inst = $inst[$i];
1025 my $color = $colors[$i];
1027 if (length ($inst) > 15)
1029 $inst = substr ($inst, 0, 12) . '...';
1033 $inst = sprintf ('%-15s', $inst);
1037 "LINE1:avg_$i#$color:$inst",
1038 "GPRINT:min_$i:MIN:%6.2lf Min,",
1039 "GPRINT:avg_$i:AVERAGE:%6.2lf Avg,",
1040 "GPRINT:max_$i:MAX:%6.2lf Max,",
1041 "GPRINT:avg_$i:LAST:%6.2lf Last\\l");
1047 sub output_graph_ping
1054 my @colors = get_n_colors (scalar (@inst));
1056 for (my $i = 0; $i < scalar (@inst); $i++)
1058 my $inst = $inst[$i];
1060 "DEF:avg_$i=$AbsDir/ping-$inst.rrd:ping:AVERAGE",
1061 "DEF:min_$i=$AbsDir/ping-$inst.rrd:ping:MIN",
1062 "DEF:max_$i=$AbsDir/ping-$inst.rrd:ping:MAX");
1065 for (my $i = 0; $i < scalar (@inst); $i++)
1067 my $inst = $inst[$i];
1068 my $color = $colors[$i];
1070 if (length ($inst) > 15)
1072 $inst = substr ($inst, 0, 12) . '...';
1076 $inst = sprintf ('%-15s', $inst);
1080 "LINE1:avg_$i#$color:$inst",
1081 "GPRINT:min_$i:MIN:%4.1lf ms Min,",
1082 "GPRINT:avg_$i:AVERAGE:%4.1lf ms Avg,",
1083 "GPRINT:max_$i:MAX:%4.1lf ms Max,",
1084 "GPRINT:avg_$i:LAST:%4.1lf ms Last\\l");
1090 sub output_graph_mysql_commands
1097 my @colors = get_n_colors (scalar (@inst));
1099 for (my $i = 0; $i < scalar (@inst); $i++)
1101 my $inst = $inst[$i];
1103 "DEF:avg_$i=$AbsDir/mysql_commands-$inst.rrd:value:AVERAGE",
1104 "DEF:min_$i=$AbsDir/mysql_commands-$inst.rrd:value:MIN",
1105 "DEF:max_$i=$AbsDir/mysql_commands-$inst.rrd:value:MAX");
1108 for (my $i = 0; $i < scalar (@inst); $i++)
1110 my $inst = $inst[$i];
1111 my $color = $colors[$i];
1113 if (length ($inst) > 18)
1115 $inst = substr ($inst, 0, 15) . '...';
1119 $inst = sprintf ('%-18s', $inst);
1123 "LINE1:avg_$i#$color:$inst",
1124 "GPRINT:min_$i:MIN:%6.1lf Min,",
1125 "GPRINT:avg_$i:AVERAGE:%6.1lf Avg,",
1126 "GPRINT:max_$i:MAX:%6.1lf Max,",
1127 "GPRINT:avg_$i:LAST:%6.1lf Last\\l");
1133 sub output_graph_mysql_handler
1140 my @colors = get_n_colors (scalar (@inst));
1142 for (my $i = 0; $i < scalar (@inst); $i++)
1144 my $inst = $inst[$i];
1146 "DEF:avg_$i=$AbsDir/mysql_handler-$inst.rrd:value:AVERAGE",
1147 "DEF:min_$i=$AbsDir/mysql_handler-$inst.rrd:value:MIN",
1148 "DEF:max_$i=$AbsDir/mysql_handler-$inst.rrd:value:MAX");
1151 for (my $i = 0; $i < scalar (@inst); $i++)
1153 my $inst = $inst[$i];
1154 my $color = $colors[$i];
1156 if (length ($inst) > 18)
1158 $inst = substr ($inst, 0, 15) . '...';
1162 $inst = sprintf ('%-18s', $inst);
1166 "LINE1:avg_$i#$color:$inst",
1167 "GPRINT:min_$i:MIN:%6.1lf Min,",
1168 "GPRINT:avg_$i:AVERAGE:%6.1lf Avg,",
1169 "GPRINT:max_$i:MAX:%6.1lf Max,",
1170 "GPRINT:avg_$i:LAST:%6.1lf Last\\l");
1178 die unless (defined ($GraphDefs->{$Type}));
1182 my $file = $AbsDir . '/';
1183 my $files = get_all_files ($AbsDir);
1188 if ($RelDir =~ m#([^/]+)$#)
1194 $host = $Config->{'HostName'};
1200 if ($TimeSpan =~ m/(\d+)/)
1202 $TimeSpan = -1 * int ($1);
1206 my %t = (hour => -3600, day => -86400, week => -604800, month => -2678400, year => -31622400);
1207 die unless (defined ($t{$TimeSpan}));
1208 $TimeSpan = $t{$TimeSpan};
1211 if (scalar (@{$files->{$Type}}) == 1)
1213 $Inst = $files->{$Type}[0];
1216 #push (@cmd, '-', '-a', 'PNG', '-s', $TimeSpan, '-w', 800, '-h', 150);
1217 push (@cmd, '-', '-a', 'PNG', '-s', $TimeSpan);
1218 push (@cmd, @{$GraphArgs->{$Type}}) if (defined ($GraphArgs->{$Type}));
1220 for (qw(Back ShadeA ShadeB Font Canvas Grid MGrid Frame Arrow))
1222 push (@cmd, '-c', uc ($_) . '#' . $Config->{'Colors'}{$_});
1225 if ((length ($Inst) == 0) and (ref ($GraphMulti->{$Type}) eq 'CODE'))
1227 push (@cmd, $GraphMulti->{$Type}->(@{$files->{$Type}}));
1231 if (length ("$Inst"))
1233 $file .= "$Type-$Inst.rrd";
1237 $file .= "$Type.rrd";
1240 die ("File not found: $file") unless (-e $file);
1242 push (@cmd, @{$GraphDefs->{$Type}});
1247 $_ =~ s/{file}/$file/g;
1248 $_ =~ s/{host}/$host/g;
1249 $_ =~ s/{inst}/$Inst/g;
1250 $_ =~ s/{type}/$Type/g;
1255 print STDOUT <<HEADER if (defined ($ENV{'GATEWAY_INTERFACE'}));
1256 Content-Type: image/png
1257 Cache-Control: no-cache
1264 open ($fh, ">/tmp/collection.log") or die ("open: $!");
1265 flock ($fh, LOCK_EX) or die ("flock: $!");
1267 print $fh join ("\n\t", @cmd) . "\n";
1274 die ('RRDs::error: ' . RRDs::error ()) if (RRDs::error ());
1279 my $files = get_all_files ($AbsDir);
1280 my $dirs = get_all_dirs ($AbsDir);
1282 print STDOUT <<HEADER if (defined ($ENV{'GATEWAY_INTERFACE'}));
1283 Content-Type: text/html
1284 Cache-Control: no-cache
1288 <title>Collection: $RelDir</title>
1289 <style type="text/css">
1290 img { border: none; display: block; }
1297 my $MySelf = defined ($ENV{'GATEWAY_INTERFACE'}) ? $ENV{'SCRIPT_NAME'} : $0;
1299 if ((length ($Type) != 0) and (length ($Inst) == 0) and (ref ($GraphMulti->{$Type}) eq 'CODE') and (scalar (@{$files->{$Type}}) > 1))
1301 print qq(\t\t<div><a href="$MySelf$RelDir">Go up</a></div>\n);
1304 for (@{$files->{$Type}})
1306 print qq(\t\t\t<li><a href="$MySelf$RelDir/$Type/$_">$_</a></li>\n);
1312 <div><img src="$MySelf$RelDir/$Type/hour" /></div>
1314 <div><img src="$MySelf$RelDir/$Type/day" /></div>
1316 <div><img src="$MySelf$RelDir/$Type/week" /></div>
1318 <div><img src="$MySelf$RelDir/$Type/month" /></div>
1320 <div><img src="$MySelf$RelDir/$Type/year" /></div>
1323 elsif (length ($Type) != 0)
1325 my $ext = length ($Inst) ? "$Type/$Inst" : $Type;
1327 if ((ref ($GraphMulti->{$Type}) eq 'CODE') and (scalar (@{$files->{$Type}}) > 1))
1329 print qq(<div><a href="$MySelf$RelDir/$Type">Go up</a></div>\n);
1333 print qq(<div><a href="$MySelf$RelDir">Go up</a></div>\n);
1338 <div><img src="$MySelf$RelDir/$ext/hour" /></div>
1340 <div><img src="$MySelf$RelDir/$ext/day" /></div>
1342 <div><img src="$MySelf$RelDir/$ext/week" /></div>
1344 <div><img src="$MySelf$RelDir/$ext/month" /></div>
1346 <div><img src="$MySelf$RelDir/$ext/year" /></div>
1353 my ($up) = $RelDir =~ m#(.*)/[^/]+$#;
1354 print qq(\t\t<div><a href="$MySelf$up">Go up</a></div>\n);
1362 print qq(<li>$AbsDir/<a href="$MySelf$RelDir/$_">$_</a></li>\n);
1367 for (sort (keys %$files))
1371 if (ref ($GraphMulti->{$type}) eq 'CODE')
1373 print qq(\t\t<a href="$MySelf$RelDir/$type" />),
1374 qq(<img src="$MySelf$RelDir/$type/day" /></a>\n);
1378 for (@{$files->{$type}})
1384 print qq(\t\t<a href="$MySelf$RelDir/$type/$inst" />),
1385 qq(<img src="$MySelf$RelDir/$type/$inst/day" /></a>\n);
1389 print qq(\t\t<a href="$MySelf$RelDir/$type" />),
1390 qq(<img src="$MySelf$RelDir/$type/day" /></a>\n);
1396 print STDOUT <<FOOTER if (defined ($ENV{'GATEWAY_INTERFACE'}));
1404 my $files = get_all_files ();
1406 print STDOUT <<HEADER if (defined ($ENV{'GATEWAY_INTERFACE'}));
1407 Content-Type: text/xml
1408 Cache-Control: no-cache
1411 print STDOUT pl2xml ($files);
1416 my $file = @_ ? shift : '/etc/collection.conf';
1420 # if (open ($fh, "< $file"))
1428 # $conf = xml2pl ($xml);
1448 FullRed => 'FF0000',
1449 FullBlue => '0000FF',
1450 FullGreen => '00E000',
1451 FullYellow => 'F0A000',
1452 FullCyan => '00A0FF',
1453 FullMagenta => 'A000FF',
1455 HalfRed => 'F8B8B8',
1456 HalfBlue => 'B8B8F8',
1457 HalfGreen => 'B8F0B8',
1458 HalfYellow => 'F4F4B8'
1460 Directory => '/var/lib/collectd',
1461 HostName => (defined ($ENV{'SERVER_NAME'}) ? $ENV{'SERVER_NAME'} : 'localhost')
1474 $AbsDir = $Config->{'Directory'};
1477 while (@info and -d $AbsDir . '/' . $info[0])
1479 my $new = shift (@info);
1480 next if ($new =~ m/^\./);
1482 $AbsDir .= '/' . $new;
1483 $RelDir .= '/' . $new;
1490 confess ("parse_pathinfo: too many elements in pathinfo") if (scalar (@info) > 3);
1491 return unless (@info);
1493 $Type = shift (@info);
1494 return unless (@info);
1496 if ($info[-1] =~ m/^(hour|day|week|month|year)$/i)
1498 $TimeSpan = pop (@info);
1501 $Inst = shift (@info) if (@info);
1503 confess ("unrecognized elements in pathinfo") if (@info);
1508 my $dir = @_ ? shift : $Config->{'Directory'};
1512 if (opendir ($dh, $dir))
1514 while (my $thing = readdir ($dh))
1516 next if ($thing =~ m/^\./);
1521 if ($thing =~ m/^(\w+)-([\w\-\.]+)\.rrd$/)
1526 elsif ($thing =~ m/^(\w+)\.rrd$/)
1536 # Only load RRD files we can actually display..
1537 next unless (defined ($GraphDefs->{$type}));
1539 $hash->{$type} = [] unless (defined ($hash->{$type}));
1540 push (@{$hash->{$type}}, $inst);
1551 my $dir = @_ ? shift : $Config->{'Directory'};
1555 if (opendir ($dh, $dir))
1557 while (my $thing = readdir ($dh))
1559 next if ($thing =~ m/^\./);
1561 next if (!-d "$dir/$thing");
1563 push (@ret, $thing);
1569 return (@ret) if (wantarray ());
1577 my ($red, $green, $blue) = map { ord (pack ("H2", $_)) } ($color =~ m/([A-Fa-f0-9]{2})/g);
1578 #print STDERR "$color -> rgb($red,$green,$blue)\n";
1580 return ($red, $green, $blue);
1585 croak unless (scalar (@_) == 3);
1587 my ($red, $green, $blue) = @_;
1589 my $ret = sprintf ("%02X%02X%02X", $red, $green, $blue);
1590 #print STDERR "rgb($red,$green,$blue) -> $ret\n";
1595 sub color_calculate_transparent
1598 my $canvas = [color_hex2rgb (shift)];
1599 my @colors = map { [color_hex2rgb ($_)] } (@_);
1601 if (($alpha < 0.0) or ($alpha > 1.0))
1608 return (color_rgb2hex (@$canvas));
1612 return (color_rgb2hex (@{$colors[-1]}));
1615 my $ret = _color_calculate_transparent ($alpha, $canvas, @colors);
1617 return (color_rgb2hex (@$ret));
1620 sub _color_calculate_transparent
1625 my @colors = @_ ? shift : ();
1626 my $ret = [0, 0, 0];
1628 for (my $i = 0; $i < 3; $i++)
1630 $ret->[$i] = ($alpha * $color->[$i]) + ((1 - $alpha) * $canvas->[$i]);
1633 return (_color_calculate_transparent ($alpha, $ret, @colors)) if (@colors);
1642 for (my $i = 0; $i < $num; $i++)
1644 my $pos = 6 * $i / $num;
1685 push (@ret, sprintf ("%02x%02x%02x", $red, $green, $blue));