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'
110 'DEF:avg={file}:percent:AVERAGE',
111 'DEF:min={file}:percent:MIN',
112 'DEF:max={file}:percent:MAX',
113 "AREA:max#$HalfBlue",
115 "LINE1:avg#$FullBlue:Charge",
116 'GPRINT:min:MIN:%5.1lf%s%% Min,',
117 'GPRINT:avg:AVERAGE:%5.1lf%s%% Avg,',
118 'GPRINT:max:MAX:%5.1lf%s%% Max,',
119 'GPRINT:avg:LAST:%5.1lf%s%% Last\l'
121 cpu => ['DEF:user_avg={file}:user:AVERAGE',
122 'DEF:user_min={file}:user:MIN',
123 'DEF:user_max={file}:user:MAX',
124 'DEF:nice_avg={file}:nice:AVERAGE',
125 'DEF:nice_min={file}:nice:MIN',
126 'DEF:nice_max={file}:nice:MAX',
127 'DEF:syst_avg={file}:syst:AVERAGE',
128 'DEF:syst_min={file}:syst:MIN',
129 'DEF:syst_max={file}:syst:MAX',
130 'DEF:idle_avg={file}:idle:AVERAGE',
131 'DEF:idle_min={file}:idle:MIN',
132 'DEF:idle_max={file}:idle:MAX',
133 'DEF:wait_avg={file}:wait:AVERAGE',
134 'DEF:wait_min={file}:wait:MIN',
135 'DEF:wait_max={file}:wait:MAX',
136 'CDEF:user_avg_notnull=user_avg,UN,0,user_avg,IF',
137 'CDEF:nice_avg_notnull=nice_avg,UN,0,nice_avg,IF',
138 'CDEF:syst_avg_notnull=syst_avg,UN,0,syst_avg,IF',
139 'CDEF:idle_avg_notnull=idle_avg,UN,0,idle_avg,IF',
140 'CDEF:wait_avg_notnull=wait_avg,UN,0,wait_avg,IF',
141 'CDEF:totl_avg_notnull=user_avg_notnull,nice_avg_notnull,+,syst_avg_notnull,+,idle_avg_notnull,+,wait_avg_notnull,+',
142 'CDEF:user_avg_pct=user_avg_notnull,100,*,totl_avg_notnull,/',
143 'CDEF:nice_avg_pct=nice_avg_notnull,100,*,totl_avg_notnull,/',
144 'CDEF:syst_avg_pct=syst_avg_notnull,100,*,totl_avg_notnull,/',
145 'CDEF:wait_avg_pct=wait_avg_notnull,100,*,totl_avg_notnull,/',
146 'CDEF:nice_acc=syst_avg_pct,wait_avg_pct,user_avg_pct,nice_avg_pct,+,+,+',
147 'CDEF:user_acc=syst_avg_pct,wait_avg_pct,user_avg_pct,+,+',
148 'CDEF:wait_acc=syst_avg_pct,wait_avg_pct,+',
149 'CDEF:syst_acc=syst_avg_pct',
150 # 'CDEF:nice_acc=syst_avg_notnull,wait_avg_notnull,user_avg_notnull,nice_avg_notnull,+,+,+',
151 # 'CDEF:user_acc=syst_avg_notnull,wait_avg_notnull,user_avg_notnull,+,+',
152 # 'CDEF:wait_acc=syst_avg_notnull,wait_avg_notnull,+',
153 # 'CDEF:syst_acc=syst_avg_notnull',
154 "AREA:nice_acc#$HalfGreen",
155 "AREA:user_acc#$HalfBlue",
156 "AREA:wait_acc#$HalfYellow",
157 "AREA:syst_acc#$HalfRed",
158 "LINE1:nice_acc#$FullGreen:Nice ",
159 'GPRINT:nice_min:MIN:%5.1lf%% Min,',
160 'GPRINT:nice_avg:AVERAGE:%5.1lf%% Avg,',
161 'GPRINT:nice_max:MAX:%5.1lf%% Max,',
162 'GPRINT:nice_avg:LAST:%5.1lf%% Last\l',
163 "LINE1:user_acc#$FullBlue:User ",
164 'GPRINT:user_min:MIN:%5.1lf%% Min,',
165 'GPRINT:user_avg:AVERAGE:%5.1lf%% Avg,',
166 'GPRINT:user_max:MAX:%5.1lf%% Max,',
167 'GPRINT:user_avg:LAST:%5.1lf%% Last\l',
168 "LINE1:wait_acc#$FullYellow:Wait-IO",
169 'GPRINT:wait_min:MIN:%5.1lf%% Min,',
170 'GPRINT:wait_avg:AVERAGE:%5.1lf%% Avg,',
171 'GPRINT:wait_max:MAX:%5.1lf%% Max,',
172 'GPRINT:wait_avg:LAST:%5.1lf%% Last\l',
173 "LINE1:syst_acc#$FullRed:System ",
174 'GPRINT:syst_min:MIN:%5.1lf%% Min,',
175 'GPRINT:syst_avg:AVERAGE:%5.1lf%% Avg,',
176 'GPRINT:syst_max:MAX:%5.1lf%% Max,',
177 'GPRINT:syst_avg:LAST:%5.1lf%% Last\l'
180 'DEF:avg={file}:current:AVERAGE',
181 'DEF:min={file}:current:MIN',
182 'DEF:max={file}:current:MAX',
183 "AREA:max#$HalfBlue",
185 "LINE1:avg#$FullBlue:Current",
186 'GPRINT:min:MIN:%5.1lf%sA Min,',
187 'GPRINT:avg:AVERAGE:%5.1lf%sA Avg,',
188 'GPRINT:max:MAX:%5.1lf%sA Max,',
189 'GPRINT:avg:LAST:%5.1lf%sA Last\l'
192 'DEF:free_avg={file}:free:AVERAGE',
193 'DEF:free_min={file}:free:MIN',
194 'DEF:free_max={file}:free:MAX',
195 'DEF:used_avg={file}:used:AVERAGE',
196 'DEF:used_min={file}:used:MIN',
197 'DEF:used_max={file}:used:MAX',
198 'CDEF:total=free_avg,used_avg,+',
199 'CDEF:free_pct=100,free_avg,*,total,/',
200 'CDEF:used_pct=100,used_avg,*,total,/',
201 'CDEF:free_acc=free_pct,used_pct,+',
202 'CDEF:used_acc=used_pct',
203 "AREA:free_acc#$HalfGreen",
204 "AREA:used_acc#$HalfRed",
205 "LINE1:free_acc#$FullGreen:Free",
206 'GPRINT:free_min:MIN:%5.1lf%sB Min,',
207 'GPRINT:free_avg:AVERAGE:%5.1lf%sB Avg,',
208 'GPRINT:free_max:MAX:%5.1lf%sB Max,',
209 'GPRINT:free_avg:LAST:%5.1lf%sB Last\l',
210 "LINE1:used_acc#$FullRed:Used",
211 'GPRINT:used_min:MIN:%5.1lf%sB Min,',
212 'GPRINT:used_avg:AVERAGE:%5.1lf%sB Avg,',
213 'GPRINT:used_max:MAX:%5.1lf%sB Max,',
214 'GPRINT:used_avg:LAST:%5.1lf%sB Last\l'
217 'DEF:rtime_avg={file}:rtime:AVERAGE',
218 'DEF:rtime_min={file}:rtime:MIN',
219 'DEF:rtime_max={file}:rtime:MAX',
220 'DEF:wtime_avg={file}:wtime:AVERAGE',
221 'DEF:wtime_min={file}:wtime:MIN',
222 'DEF:wtime_max={file}:wtime:MAX',
223 'CDEF:rtime_avg_ms=rtime_avg,1000,/',
224 'CDEF:rtime_min_ms=rtime_min,1000,/',
225 'CDEF:rtime_max_ms=rtime_max,1000,/',
226 'CDEF:wtime_avg_ms=wtime_avg,1000,/',
227 'CDEF:wtime_min_ms=wtime_min,1000,/',
228 'CDEF:wtime_max_ms=wtime_max,1000,/',
229 'CDEF:total_avg_ms=rtime_avg_ms,wtime_avg_ms,+',
230 'CDEF:total_min_ms=rtime_min_ms,wtime_min_ms,+',
231 'CDEF:total_max_ms=rtime_max_ms,wtime_max_ms,+',
232 "AREA:total_max_ms#$HalfRed",
233 "AREA:total_min_ms#$Canvas",
234 "LINE1:wtime_avg_ms#$FullGreen:Write",
235 'GPRINT:wtime_min_ms:MIN:%5.1lf%s Min,',
236 'GPRINT:wtime_avg_ms:AVERAGE:%5.1lf%s Avg,',
237 'GPRINT:wtime_max_ms:MAX:%5.1lf%s Max,',
238 'GPRINT:wtime_avg_ms:LAST:%5.1lf%s Last\n',
239 "LINE1:rtime_avg_ms#$FullBlue:Read ",
240 'GPRINT:rtime_min_ms:MIN:%5.1lf%s Min,',
241 'GPRINT:rtime_avg_ms:AVERAGE:%5.1lf%s Avg,',
242 'GPRINT:rtime_max_ms:MAX:%5.1lf%s Max,',
243 'GPRINT:rtime_avg_ms:LAST:%5.1lf%s Last\n',
244 "LINE1:total_avg_ms#$FullRed:Total",
245 'GPRINT:total_min_ms:MIN:%5.1lf%s Min,',
246 'GPRINT:total_avg_ms:AVERAGE:%5.1lf%s Avg,',
247 'GPRINT:total_max_ms:MAX:%5.1lf%s Max,',
248 'GPRINT:total_avg_ms:LAST:%5.1lf%s Last'
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:RPM",
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 frequency_offset => [ # NTPd
263 'DEF:ppm_avg={file}:ppm:AVERAGE',
264 'DEF:ppm_min={file}:ppm:MIN',
265 'DEF:ppm_max={file}:ppm:MAX',
266 "AREA:ppm_max#$HalfBlue",
267 "AREA:ppm_min#$Canvas",
268 "LINE1:ppm_avg#$FullBlue:{inst}",
269 'GPRINT:ppm_min:MIN:%5.2lf Min,',
270 'GPRINT:ppm_avg:AVERAGE:%5.2lf Avg,',
271 'GPRINT:ppm_max:MAX:%5.2lf Max,',
272 'GPRINT:ppm_avg:LAST:%5.2lf Last'
275 'DEF:temp_avg={file}:value:AVERAGE',
276 'DEF:temp_min={file}:value:MIN',
277 'DEF:temp_max={file}:value:MAX',
278 "AREA:temp_max#$HalfBlue",
279 "AREA:temp_min#$Canvas",
280 "LINE1:temp_avg#$FullBlue:Temperature",
281 'GPRINT:temp_min:MIN:%4.1lf Min,',
282 'GPRINT:temp_avg:AVERAGE:%4.1lf Avg,',
283 'GPRINT:temp_max:MAX:%4.1lf Max,',
284 'GPRINT:temp_avg:LAST:%4.1lf Last\l'
286 load => ['DEF:s_avg={file}:shortterm:AVERAGE',
287 'DEF:s_min={file}:shortterm:MIN',
288 'DEF:s_max={file}:shortterm:MAX',
289 'DEF:m_avg={file}:midterm:AVERAGE',
290 'DEF:m_min={file}:midterm:MIN',
291 'DEF:m_max={file}:midterm:MAX',
292 'DEF:l_avg={file}:longterm:AVERAGE',
293 'DEF:l_min={file}:longterm:MIN',
294 'DEF:l_max={file}:longterm:MAX',
295 "AREA:s_max#$HalfGreen",
296 "AREA:s_min#$Canvas",
297 "LINE1:s_avg#$FullGreen: 1m average",
298 'GPRINT:s_min:MIN:%4.2lf Min,',
299 'GPRINT:s_avg:AVERAGE:%4.2lf Avg,',
300 'GPRINT:s_max:MAX:%4.2lf Max,',
301 'GPRINT:s_avg:LAST:%4.2lf Last\n',
302 "LINE1:m_avg#$FullBlue: 5m average",
303 'GPRINT:m_min:MIN:%4.2lf Min,',
304 'GPRINT:m_avg:AVERAGE:%4.2lf Avg,',
305 'GPRINT:m_max:MAX:%4.2lf Max,',
306 'GPRINT:m_avg:LAST:%4.2lf Last\n',
307 "LINE1:l_avg#$FullRed:15m average",
308 'GPRINT:l_min:MIN:%4.2lf Min,',
309 'GPRINT:l_avg:AVERAGE:%4.2lf Avg,',
310 'GPRINT:l_max:MAX:%4.2lf Max,',
311 'GPRINT:l_avg:LAST:%4.2lf Last'
314 'DEF:avg={file}:percent:AVERAGE',
315 'DEF:min={file}:percent:MIN',
316 'DEF:max={file}:percent:MAX',
317 "AREA:max#$HalfBlue",
319 "LINE1:avg#$FullBlue:Load",
320 'GPRINT:min:MIN:%5.1lf%s%% Min,',
321 'GPRINT:avg:AVERAGE:%5.1lf%s%% Avg,',
322 'GPRINT:max:MAX:%5.1lf%s%% Max,',
323 'GPRINT:avg:LAST:%5.1lf%s%% Last\l'
325 mails => ['DEF:rawgood={file}:good:AVERAGE',
326 'DEF:rawspam={file}:spam:AVERAGE',
327 'CDEF:good=rawgood,UN,0,rawgood,IF',
328 'CDEF:spam=rawspam,UN,0,rawspam,IF',
329 'CDEF:negspam=spam,-1,*',
330 "AREA:good#$HalfGreen",
331 "LINE1:good#$FullGreen:Good mails",
332 'GPRINT:good:AVERAGE:%4.1lf Avg,',
333 'GPRINT:good:MAX:%4.1lf Max,',
334 'GPRINT:good:LAST:%4.1lf Last\n',
335 "AREA:negspam#$HalfRed",
336 "LINE1:negspam#$FullRed:Spam mails",
337 'GPRINT:spam:AVERAGE:%4.1lf Avg,',
338 'GPRINT:spam:MAX:%4.1lf Max,',
339 'GPRINT:spam:LAST:%4.1lf Last',
342 'DEF:used_avg={file}:used:AVERAGE',
343 'DEF:free_avg={file}:free:AVERAGE',
344 'DEF:buffers_avg={file}:buffers:AVERAGE',
345 'DEF:cached_avg={file}:cached:AVERAGE',
346 'DEF:used_min={file}:used:MIN',
347 'DEF:free_min={file}:free:MIN',
348 'DEF:buffers_min={file}:buffers:MIN',
349 'DEF:cached_min={file}:cached:MIN',
350 'DEF:used_max={file}:used:MAX',
351 'DEF:free_max={file}:free:MAX',
352 'DEF:buffers_max={file}:buffers:MAX',
353 'DEF:cached_max={file}:cached:MAX',
354 'CDEF:cached_avg_nn=cached_avg,UN,0,cached_avg,IF',
355 'CDEF:buffers_avg_nn=buffers_avg,UN,0,buffers_avg,IF',
356 'CDEF:free_cached_buffers_used=free_avg,cached_avg_nn,+,buffers_avg_nn,+,used_avg,+',
357 'CDEF:cached_buffers_used=cached_avg,buffers_avg_nn,+,used_avg,+',
358 'CDEF:buffers_used=buffers_avg,used_avg,+',
359 "AREA:free_cached_buffers_used#$HalfGreen",
360 "AREA:cached_buffers_used#$HalfBlue",
361 "AREA:buffers_used#$HalfYellow",
362 "AREA:used_avg#$HalfRed",
363 "LINE1:free_cached_buffers_used#$FullGreen:Free ",
364 'GPRINT:free_min:MIN:%5.1lf%s Min,',
365 'GPRINT:free_avg:AVERAGE:%5.1lf%s Avg,',
366 'GPRINT:free_max:MAX:%5.1lf%s Max,',
367 'GPRINT:free_avg:LAST:%5.1lf%s Last\n',
368 "LINE1:cached_buffers_used#$FullBlue:Page cache ",
369 'GPRINT:cached_min:MIN:%5.1lf%s Min,',
370 'GPRINT:cached_avg:AVERAGE:%5.1lf%s Avg,',
371 'GPRINT:cached_max:MAX:%5.1lf%s Max,',
372 'GPRINT:cached_avg:LAST:%5.1lf%s Last\n',
373 "LINE1:buffers_used#$FullYellow:Buffer cache",
374 'GPRINT:buffers_min:MIN:%5.1lf%s Min,',
375 'GPRINT:buffers_avg:AVERAGE:%5.1lf%s Avg,',
376 'GPRINT:buffers_max:MAX:%5.1lf%s Max,',
377 'GPRINT:buffers_avg:LAST:%5.1lf%s Last\n',
378 "LINE1:used_avg#$FullRed:Used ",
379 'GPRINT:used_min:MIN:%5.1lf%s Min,',
380 'GPRINT:used_avg:AVERAGE:%5.1lf%s Avg,',
381 'GPRINT:used_max:MAX:%5.1lf%s Max,',
382 'GPRINT:used_avg:LAST:%5.1lf%s Last'
385 "DEF:val_avg={file}:value:AVERAGE",
386 "DEF:val_min={file}:value:MIN",
387 "DEF:val_max={file}:value:MAX",
388 "AREA:val_max#$HalfBlue",
389 "AREA:val_min#$Canvas",
390 "LINE1:val_avg#$FullBlue:{inst}",
391 'GPRINT:val_min:MIN:%5.2lf Min,',
392 'GPRINT:val_avg:AVERAGE:%5.2lf Avg,',
393 'GPRINT:val_max:MAX:%5.2lf Max,',
394 'GPRINT:val_avg:LAST:%5.2lf Last'
397 "DEF:val_avg={file}:value:AVERAGE",
398 "DEF:val_min={file}:value:MIN",
399 "DEF:val_max={file}:value:MAX",
400 "AREA:val_max#$HalfBlue",
401 "AREA:val_min#$Canvas",
402 "LINE1:val_avg#$FullBlue:{inst}",
403 'GPRINT:val_min:MIN:%5.2lf Min,',
404 'GPRINT:val_avg:AVERAGE:%5.2lf Avg,',
405 'GPRINT:val_max:MAX:%5.2lf Max,',
406 'GPRINT:val_avg:LAST:%5.2lf Last'
409 "DEF:hits_min={file}:hits:MIN",
410 "DEF:hits_avg={file}:hits:AVERAGE",
411 "DEF:hits_max={file}:hits:MAX",
412 "DEF:inserts_min={file}:inserts:MIN",
413 "DEF:inserts_avg={file}:inserts:AVERAGE",
414 "DEF:inserts_max={file}:inserts:MAX",
415 "DEF:not_cached_min={file}:not_cached:MIN",
416 "DEF:not_cached_avg={file}:not_cached:AVERAGE",
417 "DEF:not_cached_max={file}:not_cached:MAX",
418 "DEF:lowmem_prunes_min={file}:lowmem_prunes:MIN",
419 "DEF:lowmem_prunes_avg={file}:lowmem_prunes:AVERAGE",
420 "DEF:lowmem_prunes_max={file}:lowmem_prunes:MAX",
421 "DEF:queries_min={file}:queries_in_cache:MIN",
422 "DEF:queries_avg={file}:queries_in_cache:AVERAGE",
423 "DEF:queries_max={file}:queries_in_cache:MAX",
424 "CDEF:unknown=queries_avg,UNKN,+",
425 "CDEF:not_cached_agg=hits_avg,inserts_avg,+,not_cached_avg,+",
426 "CDEF:inserts_agg=hits_avg,inserts_avg,+",
427 "CDEF:hits_agg=hits_avg",
428 "AREA:not_cached_agg#$HalfYellow",
429 "AREA:inserts_agg#$HalfBlue",
430 "AREA:hits_agg#$HalfGreen",
431 "LINE1:not_cached_agg#$FullYellow:Not Cached ",
432 'GPRINT:not_cached_min:MIN:%5.2lf Min,',
433 'GPRINT:not_cached_avg:AVERAGE:%5.2lf Avg,',
434 'GPRINT:not_cached_max:MAX:%5.2lf Max,',
435 'GPRINT:not_cached_avg:LAST:%5.2lf Last\l',
436 "LINE1:inserts_agg#$FullBlue:Inserts ",
437 'GPRINT:inserts_min:MIN:%5.2lf Min,',
438 'GPRINT:inserts_avg:AVERAGE:%5.2lf Avg,',
439 'GPRINT:inserts_max:MAX:%5.2lf Max,',
440 'GPRINT:inserts_avg:LAST:%5.2lf Last\l',
441 "LINE1:hits_agg#$FullGreen:Hits ",
442 'GPRINT:hits_min:MIN:%5.2lf Min,',
443 'GPRINT:hits_avg:AVERAGE:%5.2lf Avg,',
444 'GPRINT:hits_max:MAX:%5.2lf Max,',
445 'GPRINT:hits_avg:LAST:%5.2lf Last\l',
446 "LINE1:lowmem_prunes_avg#$FullRed:Lowmem Prunes ",
447 'GPRINT:lowmem_prunes_min:MIN:%5.2lf Min,',
448 'GPRINT:lowmem_prunes_avg:AVERAGE:%5.2lf Avg,',
449 'GPRINT:lowmem_prunes_max:MAX:%5.2lf Max,',
450 'GPRINT:lowmem_prunes_avg:LAST:%5.2lf Last\l',
451 "LINE1:unknown#$Canvas:Queries in cache",
452 'GPRINT:queries_min:MIN:%5.0lf Min,',
453 'GPRINT:queries_avg:AVERAGE:%5.0lf Avg,',
454 'GPRINT:queries_max:MAX:%5.0lf Max,',
455 'GPRINT:queries_avg:LAST:%5.0lf Last\l'
458 "DEF:running_min={file}:running:MIN",
459 "DEF:running_avg={file}:running:AVERAGE",
460 "DEF:running_max={file}:running:MAX",
461 "DEF:connected_min={file}:connected:MIN",
462 "DEF:connected_avg={file}:connected:AVERAGE",
463 "DEF:connected_max={file}:connected:MAX",
464 "DEF:cached_min={file}:cached:MIN",
465 "DEF:cached_avg={file}:cached:AVERAGE",
466 "DEF:cached_max={file}:cached:MAX",
467 "DEF:created_min={file}:created:MIN",
468 "DEF:created_avg={file}:created:AVERAGE",
469 "DEF:created_max={file}:created:MAX",
470 "CDEF:unknown=created_avg,UNKN,+",
471 "CDEF:cached_agg=connected_avg,cached_avg,+",
472 "AREA:cached_agg#$HalfGreen",
473 "AREA:connected_avg#$HalfBlue",
474 "AREA:running_avg#$HalfRed",
475 "LINE1:cached_agg#$FullGreen:Cached ",
476 'GPRINT:cached_min:MIN:%5.1lf Min,',
477 'GPRINT:cached_avg:AVERAGE:%5.1lf Avg,',
478 'GPRINT:cached_max:MAX:%5.1lf Max,',
479 'GPRINT:cached_avg:LAST:%5.1lf Last\l',
480 "LINE1:connected_avg#$FullBlue:Connected",
481 'GPRINT:connected_min:MIN:%5.1lf Min,',
482 'GPRINT:connected_avg:AVERAGE:%5.1lf Avg,',
483 'GPRINT:connected_max:MAX:%5.1lf Max,',
484 'GPRINT:connected_avg:LAST:%5.1lf Last\l',
485 "LINE1:running_avg#$FullRed:Running ",
486 'GPRINT:running_min:MIN:%5.1lf Min,',
487 'GPRINT:running_avg:AVERAGE:%5.1lf Avg,',
488 'GPRINT:running_max:MAX:%5.1lf Max,',
489 'GPRINT:running_avg:LAST:%5.1lf Last\l',
490 "LINE1:unknown#$Canvas:Created ",
491 'GPRINT:created_min:MIN:%5.0lf Min,',
492 'GPRINT:created_avg:AVERAGE:%5.0lf Avg,',
493 'GPRINT:created_max:MAX:%5.0lf Max,',
494 'GPRINT:created_avg:LAST:%5.0lf Last\l'
497 "DEF:null_avg={file}:null:AVERAGE",
498 "DEF:getattr_avg={file}:getattr:AVERAGE",
499 "DEF:setattr_avg={file}:setattr:AVERAGE",
500 "DEF:lookup_avg={file}:lookup:AVERAGE",
501 "DEF:access_avg={file}:access:AVERAGE",
502 "DEF:readlink_avg={file}:readlink:AVERAGE",
503 "DEF:read_avg={file}:read:AVERAGE",
504 "DEF:write_avg={file}:write:AVERAGE",
505 "DEF:create_avg={file}:create:AVERAGE",
506 "DEF:mkdir_avg={file}:mkdir:AVERAGE",
507 "DEF:symlink_avg={file}:symlink:AVERAGE",
508 "DEF:mknod_avg={file}:mknod:AVERAGE",
509 "DEF:remove_avg={file}:remove:AVERAGE",
510 "DEF:rmdir_avg={file}:rmdir:AVERAGE",
511 "DEF:rename_avg={file}:rename:AVERAGE",
512 "DEF:link_avg={file}:link:AVERAGE",
513 "DEF:readdir_avg={file}:readdir:AVERAGE",
514 "DEF:readdirplus_avg={file}:readdirplus:AVERAGE",
515 "DEF:fsstat_avg={file}:fsstat:AVERAGE",
516 "DEF:fsinfo_avg={file}:fsinfo:AVERAGE",
517 "DEF:pathconf_avg={file}:pathconf:AVERAGE",
518 "DEF:commit_avg={file}:commit:AVERAGE",
519 "DEF:null_max={file}:null:MAX",
520 "DEF:getattr_max={file}:getattr:MAX",
521 "DEF:setattr_max={file}:setattr:MAX",
522 "DEF:lookup_max={file}:lookup:MAX",
523 "DEF:access_max={file}:access:MAX",
524 "DEF:readlink_max={file}:readlink:MAX",
525 "DEF:read_max={file}:read:MAX",
526 "DEF:write_max={file}:write:MAX",
527 "DEF:create_max={file}:create:MAX",
528 "DEF:mkdir_max={file}:mkdir:MAX",
529 "DEF:symlink_max={file}:symlink:MAX",
530 "DEF:mknod_max={file}:mknod:MAX",
531 "DEF:remove_max={file}:remove:MAX",
532 "DEF:rmdir_max={file}:rmdir:MAX",
533 "DEF:rename_max={file}:rename:MAX",
534 "DEF:link_max={file}:link:MAX",
535 "DEF:readdir_max={file}:readdir:MAX",
536 "DEF:readdirplus_max={file}:readdirplus:MAX",
537 "DEF:fsstat_max={file}:fsstat:MAX",
538 "DEF:fsinfo_max={file}:fsinfo:MAX",
539 "DEF:pathconf_max={file}:pathconf:MAX",
540 "DEF:commit_max={file}:commit:MAX",
541 "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,+,+,+,+,+,+,+,+,+,+,+,+,+,+",
542 "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,+,+,+,+,+,+,+,+,+,+,+,+,+,+",
543 "CDEF:stack_read=read_avg",
544 "CDEF:stack_getattr=stack_read,getattr_avg,+",
545 "CDEF:stack_access=stack_getattr,access_avg,+",
546 "CDEF:stack_lookup=stack_access,lookup_avg,+",
547 "CDEF:stack_write=stack_lookup,write_avg,+",
548 "CDEF:stack_commit=stack_write,commit_avg,+",
549 "CDEF:stack_setattr=stack_commit,setattr_avg,+",
550 "CDEF:stack_other=stack_setattr,other_avg,+",
551 "AREA:stack_other#$HalfRed",
552 "AREA:stack_setattr#$HalfGreen",
553 "AREA:stack_commit#$HalfYellow",
554 "AREA:stack_write#$HalfGreen",
555 "AREA:stack_lookup#$HalfBlue",
556 "AREA:stack_access#$HalfMagenta",
557 "AREA:stack_getattr#$HalfCyan",
558 "AREA:stack_read#$HalfBlue",
559 "LINE1:stack_other#$FullRed:Other ",
560 'GPRINT:other_max:MAX:%5.1lf Max,',
561 'GPRINT:other_avg:AVERAGE:%5.1lf Avg,',
562 'GPRINT:other_avg:LAST:%5.1lf Last\l',
563 "LINE1:stack_setattr#$FullGreen:setattr",
564 'GPRINT:setattr_max:MAX:%5.1lf Max,',
565 'GPRINT:setattr_avg:AVERAGE:%5.1lf Avg,',
566 'GPRINT:setattr_avg:LAST:%5.1lf Last\l',
567 "LINE1:stack_commit#$FullYellow:commit ",
568 'GPRINT:commit_max:MAX:%5.1lf Max,',
569 'GPRINT:commit_avg:AVERAGE:%5.1lf Avg,',
570 'GPRINT:commit_avg:LAST:%5.1lf Last\l',
571 "LINE1:stack_write#$FullGreen:write ",
572 'GPRINT:write_max:MAX:%5.1lf Max,',
573 'GPRINT:write_avg:AVERAGE:%5.1lf Avg,',
574 'GPRINT:write_avg:LAST:%5.1lf Last\l',
575 "LINE1:stack_lookup#$FullBlue:lookup ",
576 'GPRINT:lookup_max:MAX:%5.1lf Max,',
577 'GPRINT:lookup_avg:AVERAGE:%5.1lf Avg,',
578 'GPRINT:lookup_avg:LAST:%5.1lf Last\l',
579 "LINE1:stack_access#$FullMagenta:access ",
580 'GPRINT:access_max:MAX:%5.1lf Max,',
581 'GPRINT:access_avg:AVERAGE:%5.1lf Avg,',
582 'GPRINT:access_avg:LAST:%5.1lf Last\l',
583 "LINE1:stack_getattr#$FullCyan:getattr",
584 'GPRINT:getattr_max:MAX:%5.1lf Max,',
585 'GPRINT:getattr_avg:AVERAGE:%5.1lf Avg,',
586 'GPRINT:getattr_avg:LAST:%5.1lf Last\l',
587 "LINE1:stack_read#$FullBlue:read ",
588 'GPRINT:read_max:MAX:%5.1lf Max,',
589 'GPRINT:read_avg:AVERAGE:%5.1lf Avg,',
590 'GPRINT:read_avg:LAST:%5.1lf Last\l'
593 "DEF:rbyte_avg={file}:rbytes:AVERAGE",
594 "DEF:rbyte_min={file}:rbytes:MIN",
595 "DEF:rbyte_max={file}:rbytes:MAX",
596 "DEF:wbyte_avg={file}:wbytes:AVERAGE",
597 "DEF:wbyte_min={file}:wbytes:MIN",
598 "DEF:wbyte_max={file}:wbytes:MAX",
599 'CDEF:overlap=wbyte_avg,rbyte_avg,GT,rbyte_avg,wbyte_avg,IF',
600 "AREA:wbyte_avg#$HalfGreen",
601 "AREA:rbyte_avg#$HalfBlue",
602 "AREA:overlap#$HalfBlueGreen",
603 "LINE1:wbyte_avg#$FullGreen:Write",
604 'GPRINT:wbyte_min:MIN:%5.1lf%s Min,',
605 'GPRINT:wbyte_avg:AVERAGE:%5.1lf%s Avg,',
606 'GPRINT:wbyte_max:MAX:%5.1lf%s Max,',
607 'GPRINT:wbyte_avg:LAST:%5.1lf%s Last\l',
608 "LINE1:rbyte_avg#$FullBlue:Read ",
609 'GPRINT:rbyte_min:MIN:%5.1lf%s Min,',
610 'GPRINT:rbyte_avg:AVERAGE:%5.1lf%s Avg,',
611 'GPRINT:rbyte_max:MAX:%5.1lf%s Max,',
612 'GPRINT:rbyte_avg:LAST:%5.1lf%s Last\l'
614 ping => ['DEF:ping_avg={file}:ping:AVERAGE',
615 'DEF:ping_min={file}:ping:MIN',
616 'DEF:ping_max={file}:ping:MAX',
617 "AREA:ping_max#$HalfBlue",
618 "AREA:ping_min#$Canvas",
619 "LINE1:ping_avg#$FullBlue:Ping",
620 'GPRINT:ping_min:MIN:%4.1lf ms Min,',
621 'GPRINT:ping_avg:AVERAGE:%4.1lf ms Avg,',
622 'GPRINT:ping_max:MAX:%4.1lf ms Max,',
623 'GPRINT:ping_avg:LAST:%4.1lf ms Last'],
625 "DEF:running_avg={file}:running:AVERAGE",
626 "DEF:running_min={file}:running:MIN",
627 "DEF:running_max={file}:running:MAX",
628 "DEF:sleeping_avg={file}:sleeping:AVERAGE",
629 "DEF:sleeping_min={file}:sleeping:MIN",
630 "DEF:sleeping_max={file}:sleeping:MAX",
631 "DEF:zombies_avg={file}:zombies:AVERAGE",
632 "DEF:zombies_min={file}:zombies:MIN",
633 "DEF:zombies_max={file}:zombies:MAX",
634 "DEF:stopped_avg={file}:stopped:AVERAGE",
635 "DEF:stopped_min={file}:stopped:MIN",
636 "DEF:stopped_max={file}:stopped:MAX",
637 "DEF:paging_avg={file}:paging:AVERAGE",
638 "DEF:paging_min={file}:paging:MIN",
639 "DEF:paging_max={file}:paging:MAX",
640 "DEF:blocked_avg={file}:blocked:AVERAGE",
641 "DEF:blocked_min={file}:blocked:MIN",
642 "DEF:blocked_max={file}:blocked:MAX",
643 'CDEF:paging_acc=sleeping_avg,running_avg,stopped_avg,zombies_avg,blocked_avg,paging_avg,+,+,+,+,+',
644 'CDEF:blocked_acc=sleeping_avg,running_avg,stopped_avg,zombies_avg,blocked_avg,+,+,+,+',
645 'CDEF:zombies_acc=sleeping_avg,running_avg,stopped_avg,zombies_avg,+,+,+',
646 'CDEF:stopped_acc=sleeping_avg,running_avg,stopped_avg,+,+',
647 'CDEF:running_acc=sleeping_avg,running_avg,+',
648 'CDEF:sleeping_acc=sleeping_avg',
649 "AREA:paging_acc#$HalfYellow",
650 "AREA:blocked_acc#$HalfCyan",
651 "AREA:zombies_acc#$HalfRed",
652 "AREA:stopped_acc#$HalfMagenta",
653 "AREA:running_acc#$HalfGreen",
654 "AREA:sleeping_acc#$HalfBlue",
655 "LINE1:paging_acc#$FullYellow:Paging ",
656 'GPRINT:paging_min:MIN:%5.1lf Min,',
657 'GPRINT:paging_avg:AVERAGE:%5.1lf Average,',
658 'GPRINT:paging_max:MAX:%5.1lf Max,',
659 'GPRINT:paging_avg:LAST:%5.1lf Last\l',
660 "LINE1:blocked_acc#$FullCyan:Blocked ",
661 'GPRINT:blocked_min:MIN:%5.1lf Min,',
662 'GPRINT:blocked_avg:AVERAGE:%5.1lf Average,',
663 'GPRINT:blocked_max:MAX:%5.1lf Max,',
664 'GPRINT:blocked_avg:LAST:%5.1lf Last\l',
665 "LINE1:zombies_acc#$FullRed:Zombies ",
666 'GPRINT:zombies_min:MIN:%5.1lf Min,',
667 'GPRINT:zombies_avg:AVERAGE:%5.1lf Average,',
668 'GPRINT:zombies_max:MAX:%5.1lf Max,',
669 'GPRINT:zombies_avg:LAST:%5.1lf Last\l',
670 "LINE1:stopped_acc#$FullMagenta:Stopped ",
671 'GPRINT:stopped_min:MIN:%5.1lf Min,',
672 'GPRINT:stopped_avg:AVERAGE:%5.1lf Average,',
673 'GPRINT:stopped_max:MAX:%5.1lf Max,',
674 'GPRINT:stopped_avg:LAST:%5.1lf Last\l',
675 "LINE1:running_acc#$FullGreen:Running ",
676 'GPRINT:running_min:MIN:%5.1lf Min,',
677 'GPRINT:running_avg:AVERAGE:%5.1lf Average,',
678 'GPRINT:running_max:MAX:%5.1lf Max,',
679 'GPRINT:running_avg:LAST:%5.1lf Last\l',
680 "LINE1:sleeping_acc#$FullBlue:Sleeping",
681 'GPRINT:sleeping_min:MIN:%5.1lf Min,',
682 'GPRINT:sleeping_avg:AVERAGE:%5.1lf Average,',
683 'GPRINT:sleeping_max:MAX:%5.1lf Max,',
684 'GPRINT:sleeping_avg:LAST:%5.1lf Last\l'
687 'DEF:used_avg={file}:used:AVERAGE',
688 'DEF:used_min={file}:used:MIN',
689 'DEF:used_max={file}:used:MAX',
690 'DEF:free_avg={file}:free:AVERAGE',
691 'DEF:free_min={file}:free:MIN',
692 'DEF:free_max={file}:free:MAX',
693 'DEF:cach_avg={file}:cached:AVERAGE',
694 'DEF:cach_min={file}:cached:MIN',
695 'DEF:cach_max={file}:cached:MAX',
696 'DEF:resv_avg={file}:resv:AVERAGE',
697 'DEF:resv_min={file}:resv:MIN',
698 'DEF:resv_max={file}:resv:MAX',
699 'CDEF:cach_avg_notnull=cach_avg,UN,0,cach_avg,IF',
700 'CDEF:resv_avg_notnull=resv_avg,UN,0,resv_avg,IF',
701 'CDEF:used_acc=used_avg',
702 'CDEF:resv_acc=used_acc,resv_avg_notnull,+',
703 'CDEF:cach_acc=resv_acc,cach_avg_notnull,+',
704 'CDEF:free_acc=cach_acc,free_avg,+',
705 "AREA:free_acc#$HalfGreen",
706 "AREA:cach_acc#$HalfBlue",
707 "AREA:resv_acc#$HalfYellow",
708 "AREA:used_acc#$HalfRed",
709 "LINE1:free_acc#$FullGreen:Free ",
710 'GPRINT:free_min:MIN:%5.1lf%s Min,',
711 'GPRINT:free_avg:AVERAGE:%5.1lf%s Avg,',
712 'GPRINT:free_max:MAX:%5.1lf%s Max,',
713 'GPRINT:free_avg:LAST:%5.1lf%s Last\n',
714 "LINE1:cach_acc#$FullBlue:Cached ",
715 'GPRINT:cach_min:MIN:%5.1lf%s Min,',
716 'GPRINT:cach_avg:AVERAGE:%5.1lf%s Avg,',
717 'GPRINT:cach_max:MAX:%5.1lf%s Max,',
718 'GPRINT:cach_avg:LAST:%5.1lf%s Last\l',
719 "LINE1:resv_acc#$FullYellow:Reserved",
720 'GPRINT:resv_min:MIN:%5.1lf%s Min,',
721 'GPRINT:resv_avg:AVERAGE:%5.1lf%s Avg,',
722 'GPRINT:resv_max:MAX:%5.1lf%s Max,',
723 'GPRINT:resv_avg:LAST:%5.1lf%s Last\n',
724 "LINE1:used_acc#$FullRed:Used ",
725 'GPRINT:used_min:MIN:%5.1lf%s Min,',
726 'GPRINT:used_avg:AVERAGE:%5.1lf%s Avg,',
727 'GPRINT:used_max:MAX:%5.1lf%s Max,',
728 'GPRINT:used_avg:LAST:%5.1lf%s Last\l'
731 'DEF:temp_avg={file}:value:AVERAGE',
732 'DEF:temp_min={file}:value:MIN',
733 'DEF:temp_max={file}:value:MAX',
734 "AREA:temp_max#$HalfBlue",
735 "AREA:temp_min#$Canvas",
736 "LINE1:temp_avg#$FullBlue:Value",
737 'GPRINT:temp_min:MIN:%4.1lf Min,',
738 'GPRINT:temp_avg:AVERAGE:%4.1lf Avg,',
739 'GPRINT:temp_max:MAX:%4.1lf Max,',
740 'GPRINT:temp_avg:LAST:%4.1lf Last\l'
743 'DEF:avg={file}:timeleft:AVERAGE',
744 'DEF:min={file}:timeleft:MIN',
745 'DEF:max={file}:timeleft:MAX',
746 "AREA:max#$HalfBlue",
748 "LINE1:avg#$FullBlue:Time left [min]",
749 'GPRINT:min:MIN:%5.1lf%s Min,',
750 'GPRINT:avg:AVERAGE:%5.1lf%s Avg,',
751 'GPRINT:max:MAX:%5.1lf%s Max,',
752 'GPRINT:avg:LAST:%5.1lf%s Last\l'
754 time_offset => [ # NTPd
755 'DEF:s_avg={file}:seconds:AVERAGE',
756 'DEF:s_min={file}:seconds:MIN',
757 'DEF:s_max={file}:seconds:MAX',
758 "AREA:s_max#$HalfBlue",
759 "AREA:s_min#$Canvas",
760 "LINE1:s_avg#$FullBlue:{inst}",
761 'GPRINT:s_min:MIN:%7.3lf%s Min,',
762 'GPRINT:s_avg:AVERAGE:%7.3lf%s Avg,',
763 'GPRINT:s_max:MAX:%7.3lf%s Max,',
764 'GPRINT:s_avg:LAST:%7.3lf%s Last'
766 traffic => ['DEF:out_min_raw={file}:outgoing:MIN',
767 'DEF:out_avg_raw={file}:outgoing:AVERAGE',
768 'DEF:out_max_raw={file}:outgoing:MAX',
769 'DEF:inc_min_raw={file}:incoming:MIN',
770 'DEF:inc_avg_raw={file}:incoming:AVERAGE',
771 'DEF:inc_max_raw={file}:incoming:MAX',
772 'CDEF:out_min=out_min_raw,8,*',
773 'CDEF:out_avg=out_avg_raw,8,*',
774 'CDEF:out_max=out_max_raw,8,*',
775 'CDEF:inc_min=inc_min_raw,8,*',
776 'CDEF:inc_avg=inc_avg_raw,8,*',
777 'CDEF:inc_max=inc_max_raw,8,*',
778 'CDEF:overlap=out_avg,inc_avg,GT,inc_avg,out_avg,IF',
779 'CDEF:mytime=out_avg_raw,TIME,TIME,IF',
780 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
781 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
782 'CDEF:out_avg_sample=out_avg_raw,UN,0,out_avg_raw,IF,sample_len,*',
783 'CDEF:out_avg_sum=PREV,UN,0,PREV,IF,out_avg_sample,+',
784 'CDEF:inc_avg_sample=inc_avg_raw,UN,0,inc_avg_raw,IF,sample_len,*',
785 'CDEF:inc_avg_sum=PREV,UN,0,PREV,IF,inc_avg_sample,+',
786 "AREA:out_avg#$HalfGreen",
787 "AREA:inc_avg#$HalfBlue",
788 "AREA:overlap#$HalfBlueGreen",
789 "LINE1:out_avg#$FullGreen:Outgoing",
790 'GPRINT:out_avg:AVERAGE:%5.1lf%s Avg,',
791 'GPRINT:out_max:MAX:%5.1lf%s Max,',
792 'GPRINT:out_avg:LAST:%5.1lf%s Last',
793 'GPRINT:out_avg_sum:LAST:(ca. %5.1lf%sB Total)\l',
794 "LINE1:inc_avg#$FullBlue:Incoming",
795 #'GPRINT:inc_min:MIN:%5.1lf %s Min,',
796 'GPRINT:inc_avg:AVERAGE:%5.1lf%s Avg,',
797 'GPRINT:inc_max:MAX:%5.1lf%s Max,',
798 'GPRINT:inc_avg:LAST:%5.1lf%s Last',
799 'GPRINT:inc_avg_sum:LAST:(ca. %5.1lf%sB Total)\l'
802 'DEF:cpufreq_avg={file}:value:AVERAGE',
803 'DEF:cpufreq_min={file}:value:MIN',
804 'DEF:cpufreq_max={file}:value:MAX',
805 "AREA:cpufreq_max#$HalfBlue",
806 "AREA:cpufreq_min#$Canvas",
807 "LINE1:cpufreq_avg#$FullBlue:Frequency",
808 'GPRINT:cpufreq_min:MIN:%5.1lf%s Min,',
809 'GPRINT:cpufreq_avg:AVERAGE:%5.1lf%s Avg,',
810 'GPRINT:cpufreq_max:MAX:%5.1lf%s Max,',
811 'GPRINT:cpufreq_avg:LAST:%5.1lf%s Last\l'
814 'DEF:users_avg={file}:users:AVERAGE',
815 'DEF:users_min={file}:users:MIN',
816 'DEF:users_max={file}:users:MAX',
817 "AREA:users_max#$HalfBlue",
818 "AREA:users_min#$Canvas",
819 "LINE1:users_avg#$FullBlue:Users",
820 'GPRINT:users_min:MIN:%4.1lf Min,',
821 'GPRINT:users_avg:AVERAGE:%4.1lf Average,',
822 'GPRINT:users_max:MAX:%4.1lf Max,',
823 'GPRINT:users_avg:LAST:%4.1lf Last\l'
826 'DEF:avg={file}:voltage:AVERAGE',
827 'DEF:min={file}:voltage:MIN',
828 'DEF:max={file}:voltage:MAX',
829 "AREA:max#$HalfBlue",
831 "LINE1:avg#$FullBlue:Voltage",
832 'GPRINT:min:MIN:%5.1lf%sV Min,',
833 'GPRINT:avg:AVERAGE:%5.1lf%sV Avg,',
834 'GPRINT:max:MAX:%5.1lf%sV Max,',
835 'GPRINT:avg:LAST:%5.1lf%sV Last\l'
838 "DEF:total_avg={file}:total:AVERAGE",
839 "DEF:total_min={file}:total:MIN",
840 "DEF:total_max={file}:total:MAX",
841 "DEF:running_avg={file}:running:AVERAGE",
842 "DEF:running_min={file}:running:MIN",
843 "DEF:running_max={file}:running:MAX",
844 "DEF:uninterruptible_avg={file}:uninterruptible:AVERAGE",
845 "DEF:uninterruptible_min={file}:uninterruptible:MIN",
846 "DEF:uninterruptible_max={file}:uninterruptible:MAX",
847 "DEF:onhold_avg={file}:onhold:AVERAGE",
848 "DEF:onhold_min={file}:onhold:MIN",
849 "DEF:onhold_max={file}:onhold:MAX",
850 "LINE1:total_avg#$FullYellow:Total ",
851 'GPRINT:total_min:MIN:%5.1lf Min,',
852 'GPRINT:total_avg:AVERAGE:%5.1lf Avg.,',
853 'GPRINT:total_max:MAX:%5.1lf Max,',
854 'GPRINT:total_avg:LAST:%5.1lf Last\l',
855 "LINE1:running_avg#$FullRed:Running ",
856 'GPRINT:running_min:MIN:%5.1lf Min,',
857 'GPRINT:running_avg:AVERAGE:%5.1lf Avg.,',
858 'GPRINT:running_max:MAX:%5.1lf Max,',
859 'GPRINT:running_avg:LAST:%5.1lf Last\l',
860 "LINE1:uninterruptible_avg#$FullGreen:Unintr ",
861 'GPRINT:uninterruptible_min:MIN:%5.1lf Min,',
862 'GPRINT:uninterruptible_avg:AVERAGE:%5.1lf Avg.,',
863 'GPRINT:uninterruptible_max:MAX:%5.1lf Max,',
864 'GPRINT:uninterruptible_avg:LAST:%5.1lf Last\l',
865 "LINE1:onhold_avg#$FullBlue:Onhold ",
866 'GPRINT:onhold_min:MIN:%5.1lf Min,',
867 'GPRINT:onhold_avg:AVERAGE:%5.1lf Avg.,',
868 'GPRINT:onhold_max:MAX:%5.1lf Max,',
869 'GPRINT:onhold_avg:LAST:%5.1lf Last\l'
872 'DEF:vm_avg={file}:vm:AVERAGE',
873 'DEF:vm_min={file}:vm:MIN',
874 'DEF:vm_max={file}:vm:MAX',
875 'DEF:vml_avg={file}:vml:AVERAGE',
876 'DEF:vml_min={file}:vml:MIN',
877 'DEF:vml_max={file}:vml:MAX',
878 'DEF:rss_avg={file}:rss:AVERAGE',
879 'DEF:rss_min={file}:rss:MIN',
880 'DEF:rss_max={file}:rss:MAX',
881 'DEF:anon_avg={file}:anon:AVERAGE',
882 'DEF:anon_min={file}:anon:MIN',
883 'DEF:anon_max={file}:anon:MAX',
884 "LINE1:vm_avg#$FullYellow:VM ",
885 'GPRINT:vm_min:MIN:%5.1lf%s Min,',
886 'GPRINT:vm_avg:AVERAGE:%5.1lf%s Avg.,',
887 'GPRINT:vm_max:MAX:%5.1lf%s Avg.,',
888 'GPRINT:vm_avg:LAST:%5.1lf%s Last\l',
889 "LINE1:vml_avg#$FullRed:Locked ",
890 'GPRINT:vml_min:MIN:%5.1lf%s Min,',
891 'GPRINT:vml_avg:AVERAGE:%5.1lf%s Avg.,',
892 'GPRINT:vml_max:MAX:%5.1lf%s Avg.,',
893 'GPRINT:vml_avg:LAST:%5.1lf%s Last\l',
894 "LINE1:rss_avg#$FullGreen:RSS ",
895 'GPRINT:rss_min:MIN:%5.1lf%s Min,',
896 'GPRINT:rss_avg:AVERAGE:%5.1lf%s Avg.,',
897 'GPRINT:rss_max:MAX:%5.1lf%s Avg.,',
898 'GPRINT:rss_avg:LAST:%5.1lf%s Last\l',
899 "LINE1:anon_avg#$FullBlue:Anon. ",
900 'GPRINT:anon_min:MIN:%5.1lf%s Min,',
901 'GPRINT:anon_avg:AVERAGE:%5.1lf%s Avg.,',
902 'GPRINT:anon_max:MAX:%5.1lf%s Avg.,',
903 'GPRINT:anon_avg:LAST:%5.1lf%s Last\l',
906 'DEF:proc_avg={file}:total:AVERAGE',
907 'DEF:proc_min={file}:total:MIN',
908 'DEF:proc_max={file}:total:MAX',
909 "AREA:proc_max#$HalfBlue",
910 "AREA:proc_min#$Canvas",
911 "LINE1:proc_avg#$FullBlue:Processes",
912 'GPRINT:proc_min:MIN:%4.1lf Min,',
913 'GPRINT:proc_avg:AVERAGE:%4.1lf Avg.,',
914 'GPRINT:proc_max:MAX:%4.1lf Max,',
915 'GPRINT:proc_avg:LAST:%4.1lf Last\l'
918 $GraphDefs->{'disk'} = $GraphDefs->{'partition'};
919 $GraphDefs->{'meminfo'} = $GraphDefs->{'memory'};
920 $GraphDefs->{'sensors'} = $GraphDefs->{'temperature'};
922 $GraphDefs->{'delay'} = $GraphDefs->{'time_offset'};
923 $GraphDefs->{'time_dispersion'} = $GraphDefs->{'time_offset'};
928 apache_bytes => ['-t', 'apache traffic', '-v', 'Bit/s'],
929 apache_requests => ['-t', 'apache requests', '-v', 'Requests/s'],
930 apache_scoreboard => ['-t', 'apache scoreboard {inst}', '-v', 'Processes'],
931 charge => ['-t', '{host} charge', '-v', 'Ampere hours'],
932 charge_percent => ['-t', '{host} charge', '-v', 'Percent'],
933 cpu => ['-t', '{host} cpu{inst} usage', '-v', 'Percent', '-l', '0'],
934 cpufreq => ['-t', '{host} cpu{inst} usage', '-v', 'Mhz'],
935 current => ['-t', '{host} current', '-v', 'Ampere'],
936 #disk => ['-t', '{host} disk {inst} IO wait', '-v', 'Seconds'],
937 delay => ['-t', 'NTPd peer delay ({inst})', '-v', 'Seconds'],
938 df => ['-t', '{host}:{inst} usage', '-v', 'Percent', '-l', '0'],
939 disk => ['-t', '{host} disk {inst} usage', '-v', 'Byte/s'],
940 fanspeed => ['-t', '{host} fanspeed {inst}', '-v', 'rpm'],
941 frequency_offset => ['-t', 'NTPd frequency offset ({inst})', '-v', 'Parts per million'],
942 hddtemp => ['-t', '{host} hdd temperature {inst}', '-v', '°Celsius'],
943 load => ['-t', '{host} load average', '-v', 'System load', '-X', '0'],
944 load_percent => ['-t', '{host} load', '-v', 'Percent'],
945 mails => ['-t', '{host} mail count', '-v', 'Amount', '-X', '0'],
946 memory => ['-t', '{host} memory usage', '-v', 'Bytes', '-b', '1024', '-l', '0'],
947 mysql_commands => ['-t', 'mysql command {inst}', '-v', 'Issues/s' ],
948 mysql_handler => ['-t', 'mysql handler {inst}', '-v', 'Issues/s' ],
949 mysql_qcache => ['-t', 'mysql query cache', '-v', 'Queries/s' ],
950 mysql_threads => ['-t', 'mysql threads', '-v', 'Threads' ],
951 nfs3_procedures => ['-t', '{host} NFSv3 {inst} procedures', '-v', 'Procedures/s' ],
952 partition => ['-t', '{host} partition {inst} usage', '-v', 'Byte/s'],
953 ping => ['-t', '{host} ping to {inst}', '-v', 'ms'],
954 processes => ['-t', '{host} processes', '-v', 'Processes'],
955 sensors => ['-t', '{host} sensor {inst}', '-v', '°Celsius'],
956 swap => ['-t', '{host} swap usage', '-v', 'Bytes', '-b', '1024', '-l', '0'],
957 temperature => ['-t', '{host} temperature {inst}', '-v', '°Celsius'],
958 timeleft => ['-t', '{host} UPS time left', '-v', 'Time [min]'],
959 time_offset => ['-t', 'NTPd time offset ({inst})', '-v', 'Seconds'],
960 time_dispersion => ['-t', 'NTPd time dispersion ({inst})', '-v', 'Seconds'],
961 traffic => ['-t', '{host} {inst} traffic', '-v', 'Bit/s'],
962 users => ['-t', '{host} users', '-v', 'Users'],
963 voltage => ['-t', '{host} voltage', '-v', 'Volts'],
964 vs_threads => ['-t', '{host} threads', '-v', 'Threads'],
965 vs_memory => ['-t', '{host} memory usage', '-v', 'Bytes'],
966 vs_processes => ['-t', '{host} processes', '-v', 'Processes'],
971 apache_scoreboard => \&output_graph_apache_scoreboard,
972 cpu => \&output_graph_cpu,
978 mysql_commands => \&output_graph_mysql_commands,
979 mysql_handler => \&output_graph_mysql_handler,
981 ping => \&output_graph_ping,
988 if (defined ($ENV{'GATEWAY_INTERFACE'}))
990 @Info = ($ENV{'PATH_INFO'} || '') =~ m#([\w\-\.]+)#g;
997 parse_pathinfo (@Info);
1010 sub output_graph_cpu
1020 "DEF:user_avg_$_=$AbsDir/cpu-$_.rrd:user:AVERAGE",
1021 "DEF:user_min_$_=$AbsDir/cpu-$_.rrd:user:MIN",
1022 "DEF:user_max_$_=$AbsDir/cpu-$_.rrd:user:MAX",
1023 "DEF:nice_avg_$_=$AbsDir/cpu-$_.rrd:nice:AVERAGE",
1024 "DEF:nice_min_$_=$AbsDir/cpu-$_.rrd:nice:MIN",
1025 "DEF:nice_max_$_=$AbsDir/cpu-$_.rrd:nice:MAX",
1026 "DEF:syst_avg_$_=$AbsDir/cpu-$_.rrd:syst:AVERAGE",
1027 "DEF:syst_min_$_=$AbsDir/cpu-$_.rrd:syst:MIN",
1028 "DEF:syst_max_$_=$AbsDir/cpu-$_.rrd:syst:MAX",
1029 "DEF:wait_avg_$_=$AbsDir/cpu-$_.rrd:wait:AVERAGE",
1030 "DEF:wait_min_$_=$AbsDir/cpu-$_.rrd:wait:MIN",
1031 "DEF:wait_max_$_=$AbsDir/cpu-$_.rrd:wait:MAX");
1034 for (qw(user nice syst wait))
1039 my $default_value = ($def eq 'user' or $def eq 'syst') ? 'UNKN' : '0';
1041 for (qw(avg min max))
1047 push (@ret, "CDEF:${def}_${cf}_notnull_${_}=${def}_${cf}_${_},UN,0,${def}_${cf}_${_},IF");
1048 push (@ret, "CDEF:${def}_${cf}_defined_${_}=${def}_${cf}_${_},UN,0,1,IF");
1051 $cdef = "CDEF:${def}_${cf}_num=" . join (',', map { "${def}_${cf}_defined_${_}" } (@inst));
1052 $cdef .= ',+' x (scalar (@inst) - 1);
1055 $cdef = "CDEF:${def}_${cf}=${def}_${cf}_num," . join (',', map { "${def}_${cf}_notnull_${_}" } (@inst));
1056 $cdef .= ',+' x (scalar (@inst) - 1);
1057 $cdef .= ",${def}_${cf}_num,${def}_${cf}_num,1,IF,/,$default_value,IF";
1059 push (@ret, "CDEF:${def}_${cf}_notnull=${def}_${cf},UN,0,${def}_${cf},IF");
1064 "CDEF:nice_acc=syst_avg_notnull,wait_avg_notnull,user_avg_notnull,nice_avg_notnull,+,+,+",
1065 "CDEF:user_acc=syst_avg_notnull,wait_avg_notnull,user_avg_notnull,+,+",
1066 "CDEF:wait_acc=syst_avg_notnull,wait_avg_notnull,+",
1067 "CDEF:syst_acc=syst_avg_notnull");
1069 push (@ret, grep { $_ !~ m/^C?DEF/ } (@{$GraphDefs->{'cpu'}}));
1074 sub output_graph_apache_scoreboard
1081 my @colors = get_n_colors (scalar (@inst));
1083 for (my $i = 0; $i < scalar (@inst); $i++)
1085 my $inst = $inst[$i];
1087 "DEF:avg_$i=$AbsDir/apache_scoreboard-$inst.rrd:count:AVERAGE",
1088 "DEF:min_$i=$AbsDir/apache_scoreboard-$inst.rrd:count:MIN",
1089 "DEF:max_$i=$AbsDir/apache_scoreboard-$inst.rrd:count:MAX");
1092 for (my $i = 0; $i < scalar (@inst); $i++)
1094 my $inst = $inst[$i];
1095 my $color = $colors[$i];
1097 if (length ($inst) > 15)
1099 $inst = substr ($inst, 0, 12) . '...';
1103 $inst = sprintf ('%-15s', $inst);
1107 "LINE1:avg_$i#$color:$inst",
1108 "GPRINT:min_$i:MIN:%6.2lf Min,",
1109 "GPRINT:avg_$i:AVERAGE:%6.2lf Avg,",
1110 "GPRINT:max_$i:MAX:%6.2lf Max,",
1111 "GPRINT:avg_$i:LAST:%6.2lf Last\\l");
1117 sub output_graph_ping
1124 my @colors = get_n_colors (scalar (@inst));
1126 for (my $i = 0; $i < scalar (@inst); $i++)
1128 my $inst = $inst[$i];
1130 "DEF:avg_$i=$AbsDir/ping-$inst.rrd:ping:AVERAGE",
1131 "DEF:min_$i=$AbsDir/ping-$inst.rrd:ping:MIN",
1132 "DEF:max_$i=$AbsDir/ping-$inst.rrd:ping:MAX");
1135 for (my $i = 0; $i < scalar (@inst); $i++)
1137 my $inst = $inst[$i];
1138 my $color = $colors[$i];
1140 if (length ($inst) > 15)
1142 $inst = substr ($inst, 0, 12) . '...';
1146 $inst = sprintf ('%-15s', $inst);
1150 "LINE1:avg_$i#$color:$inst",
1151 "GPRINT:min_$i:MIN:%4.1lf ms Min,",
1152 "GPRINT:avg_$i:AVERAGE:%4.1lf ms Avg,",
1153 "GPRINT:max_$i:MAX:%4.1lf ms Max,",
1154 "GPRINT:avg_$i:LAST:%4.1lf ms Last\\l");
1160 sub output_graph_mysql_commands
1167 my @colors = get_n_colors (scalar (@inst));
1169 for (my $i = 0; $i < scalar (@inst); $i++)
1171 my $inst = $inst[$i];
1173 "DEF:avg_$i=$AbsDir/mysql_commands-$inst.rrd:value:AVERAGE",
1174 "DEF:min_$i=$AbsDir/mysql_commands-$inst.rrd:value:MIN",
1175 "DEF:max_$i=$AbsDir/mysql_commands-$inst.rrd:value:MAX");
1178 for (my $i = 0; $i < scalar (@inst); $i++)
1180 my $inst = $inst[$i];
1181 my $color = $colors[$i];
1183 if (length ($inst) > 18)
1185 $inst = substr ($inst, 0, 15) . '...';
1189 $inst = sprintf ('%-18s', $inst);
1193 "LINE1:avg_$i#$color:$inst",
1194 "GPRINT:min_$i:MIN:%6.1lf Min,",
1195 "GPRINT:avg_$i:AVERAGE:%6.1lf Avg,",
1196 "GPRINT:max_$i:MAX:%6.1lf Max,",
1197 "GPRINT:avg_$i:LAST:%6.1lf Last\\l");
1203 sub output_graph_mysql_handler
1210 my @colors = get_n_colors (scalar (@inst));
1212 for (my $i = 0; $i < scalar (@inst); $i++)
1214 my $inst = $inst[$i];
1216 "DEF:avg_$i=$AbsDir/mysql_handler-$inst.rrd:value:AVERAGE",
1217 "DEF:min_$i=$AbsDir/mysql_handler-$inst.rrd:value:MIN",
1218 "DEF:max_$i=$AbsDir/mysql_handler-$inst.rrd:value:MAX");
1221 for (my $i = 0; $i < scalar (@inst); $i++)
1223 my $inst = $inst[$i];
1224 my $color = $colors[$i];
1226 if (length ($inst) > 18)
1228 $inst = substr ($inst, 0, 15) . '...';
1232 $inst = sprintf ('%-18s', $inst);
1236 "LINE1:avg_$i#$color:$inst",
1237 "GPRINT:min_$i:MIN:%6.1lf Min,",
1238 "GPRINT:avg_$i:AVERAGE:%6.1lf Avg,",
1239 "GPRINT:max_$i:MAX:%6.1lf Max,",
1240 "GPRINT:avg_$i:LAST:%6.1lf Last\\l");
1248 die unless (defined ($GraphDefs->{$Type}));
1252 my $file = $AbsDir . '/';
1253 my $files = get_all_files ($AbsDir);
1258 if ($RelDir =~ m#([^/]+)$#)
1264 $host = $Config->{'HostName'};
1270 if ($TimeSpan =~ m/(\d+)/)
1272 $TimeSpan = -1 * int ($1);
1276 my %t = (hour => -3600, day => -86400, week => -604800, month => -2678400, year => -31622400);
1277 die unless (defined ($t{$TimeSpan}));
1278 $TimeSpan = $t{$TimeSpan};
1281 if (scalar (@{$files->{$Type}}) == 1)
1283 $Inst = $files->{$Type}[0];
1286 #push (@cmd, '-', '-a', 'PNG', '-s', $TimeSpan, '-w', 800, '-h', 150);
1287 push (@cmd, '-', '-a', 'PNG', '-s', $TimeSpan);
1288 push (@cmd, @{$GraphArgs->{$Type}}) if (defined ($GraphArgs->{$Type}));
1290 for (qw(Back ShadeA ShadeB Font Canvas Grid MGrid Frame Arrow))
1292 push (@cmd, '-c', uc ($_) . '#' . $Config->{'Colors'}{$_});
1295 if ((length ($Inst) == 0) and (ref ($GraphMulti->{$Type}) eq 'CODE'))
1297 push (@cmd, $GraphMulti->{$Type}->(@{$files->{$Type}}));
1301 if (length ("$Inst"))
1303 $file .= "$Type-$Inst.rrd";
1307 $file .= "$Type.rrd";
1310 die ("File not found: $file") unless (-e $file);
1312 push (@cmd, @{$GraphDefs->{$Type}});
1317 $_ =~ s/{file}/$file/g;
1318 $_ =~ s/{host}/$host/g;
1319 $_ =~ s/{inst}/$Inst/g;
1320 $_ =~ s/{type}/$Type/g;
1325 print STDOUT <<HEADER if (defined ($ENV{'GATEWAY_INTERFACE'}));
1326 Content-Type: image/png
1327 Cache-Control: no-cache
1334 open ($fh, ">/tmp/collection.log") or die ("open: $!");
1335 flock ($fh, LOCK_EX) or die ("flock: $!");
1337 print $fh join ("\n\t", @cmd) . "\n";
1344 die ('RRDs::error: ' . RRDs::error ()) if (RRDs::error ());
1349 my $files = get_all_files ($AbsDir);
1350 my $dirs = get_all_dirs ($AbsDir);
1352 print STDOUT <<HEADER if (defined ($ENV{'GATEWAY_INTERFACE'}));
1353 Content-Type: text/html
1354 Cache-Control: no-cache
1358 <title>Collection: $RelDir</title>
1359 <style type="text/css">
1360 img { border: none; display: block; }
1367 my $MySelf = defined ($ENV{'GATEWAY_INTERFACE'}) ? $ENV{'SCRIPT_NAME'} : $0;
1369 if ((length ($Type) != 0) and (length ($Inst) == 0) and (ref ($GraphMulti->{$Type}) eq 'CODE') and (scalar (@{$files->{$Type}}) > 1))
1371 print qq(\t\t<div><a href="$MySelf$RelDir">Go up</a></div>\n);
1374 for (@{$files->{$Type}})
1376 print qq(\t\t\t<li><a href="$MySelf$RelDir/$Type/$_">$_</a></li>\n);
1382 <div><img src="$MySelf$RelDir/$Type/hour" /></div>
1384 <div><img src="$MySelf$RelDir/$Type/day" /></div>
1386 <div><img src="$MySelf$RelDir/$Type/week" /></div>
1388 <div><img src="$MySelf$RelDir/$Type/month" /></div>
1390 <div><img src="$MySelf$RelDir/$Type/year" /></div>
1393 elsif (length ($Type) != 0)
1395 my $ext = length ($Inst) ? "$Type/$Inst" : $Type;
1397 if ((ref ($GraphMulti->{$Type}) eq 'CODE') and (scalar (@{$files->{$Type}}) > 1))
1399 print qq(<div><a href="$MySelf$RelDir/$Type">Go up</a></div>\n);
1403 print qq(<div><a href="$MySelf$RelDir">Go up</a></div>\n);
1408 <div><img src="$MySelf$RelDir/$ext/hour" /></div>
1410 <div><img src="$MySelf$RelDir/$ext/day" /></div>
1412 <div><img src="$MySelf$RelDir/$ext/week" /></div>
1414 <div><img src="$MySelf$RelDir/$ext/month" /></div>
1416 <div><img src="$MySelf$RelDir/$ext/year" /></div>
1423 my ($up) = $RelDir =~ m#(.*)/[^/]+$#;
1424 print qq(\t\t<div><a href="$MySelf$up">Go up</a></div>\n);
1432 print qq(<li>$AbsDir/<a href="$MySelf$RelDir/$_">$_</a></li>\n);
1437 for (sort (keys %$files))
1441 if (ref ($GraphMulti->{$type}) eq 'CODE')
1443 print qq(\t\t<a href="$MySelf$RelDir/$type" />),
1444 qq(<img src="$MySelf$RelDir/$type/day" /></a>\n);
1448 for (@{$files->{$type}})
1454 print qq(\t\t<a href="$MySelf$RelDir/$type/$inst" />),
1455 qq(<img src="$MySelf$RelDir/$type/$inst/day" /></a>\n);
1459 print qq(\t\t<a href="$MySelf$RelDir/$type" />),
1460 qq(<img src="$MySelf$RelDir/$type/day" /></a>\n);
1466 print STDOUT <<FOOTER if (defined ($ENV{'GATEWAY_INTERFACE'}));
1474 my $files = get_all_files ();
1476 print STDOUT <<HEADER if (defined ($ENV{'GATEWAY_INTERFACE'}));
1477 Content-Type: text/xml
1478 Cache-Control: no-cache
1481 print STDOUT pl2xml ($files);
1486 my $file = @_ ? shift : '/etc/collection.conf';
1490 # if (open ($fh, "< $file"))
1498 # $conf = xml2pl ($xml);
1518 FullRed => 'FF0000',
1519 FullBlue => '0000FF',
1520 FullGreen => '00E000',
1521 FullYellow => 'F0A000',
1522 FullCyan => '00A0FF',
1523 FullMagenta => 'A000FF',
1525 HalfRed => 'F8B8B8',
1526 HalfBlue => 'B8B8F8',
1527 HalfGreen => 'B8F0B8',
1528 HalfYellow => 'F4F4B8'
1530 Directory => '/var/lib/collectd',
1531 HostName => (defined ($ENV{'SERVER_NAME'}) ? $ENV{'SERVER_NAME'} : 'localhost')
1544 $AbsDir = $Config->{'Directory'};
1547 while (@info and -d $AbsDir . '/' . $info[0])
1549 my $new = shift (@info);
1550 next if ($new =~ m/^\./);
1552 $AbsDir .= '/' . $new;
1553 $RelDir .= '/' . $new;
1560 confess ("parse_pathinfo: too many elements in pathinfo") if (scalar (@info) > 3);
1561 return unless (@info);
1563 $Type = shift (@info);
1564 return unless (@info);
1566 if ($info[-1] =~ m/^(hour|day|week|month|year)$/i)
1568 $TimeSpan = pop (@info);
1571 $Inst = shift (@info) if (@info);
1573 confess ("unrecognized elements in pathinfo") if (@info);
1578 my $dir = @_ ? shift : $Config->{'Directory'};
1582 if (opendir ($dh, $dir))
1584 while (my $thing = readdir ($dh))
1586 next if ($thing =~ m/^\./);
1591 if ($thing =~ m/^(\w+)-([\w\-\.]+)\.rrd$/)
1596 elsif ($thing =~ m/^(\w+)\.rrd$/)
1606 # Only load RRD files we can actually display..
1607 next unless (defined ($GraphDefs->{$type}));
1609 $hash->{$type} = [] unless (defined ($hash->{$type}));
1610 push (@{$hash->{$type}}, $inst);
1621 my $dir = @_ ? shift : $Config->{'Directory'};
1625 if (opendir ($dh, $dir))
1627 while (my $thing = readdir ($dh))
1629 next if ($thing =~ m/^\./);
1631 next if (!-d "$dir/$thing");
1633 push (@ret, $thing);
1639 return (@ret) if (wantarray ());
1647 my ($red, $green, $blue) = map { ord (pack ("H2", $_)) } ($color =~ m/([A-Fa-f0-9]{2})/g);
1648 #print STDERR "$color -> rgb($red,$green,$blue)\n";
1650 return ($red, $green, $blue);
1655 croak unless (scalar (@_) == 3);
1657 my ($red, $green, $blue) = @_;
1659 my $ret = sprintf ("%02X%02X%02X", $red, $green, $blue);
1660 #print STDERR "rgb($red,$green,$blue) -> $ret\n";
1665 sub color_calculate_transparent
1668 my $canvas = [color_hex2rgb (shift)];
1669 my @colors = map { [color_hex2rgb ($_)] } (@_);
1671 if (($alpha < 0.0) or ($alpha > 1.0))
1678 return (color_rgb2hex (@$canvas));
1682 return (color_rgb2hex (@{$colors[-1]}));
1685 my $ret = _color_calculate_transparent ($alpha, $canvas, @colors);
1687 return (color_rgb2hex (@$ret));
1690 sub _color_calculate_transparent
1695 my @colors = @_ ? shift : ();
1696 my $ret = [0, 0, 0];
1698 for (my $i = 0; $i < 3; $i++)
1700 $ret->[$i] = ($alpha * $color->[$i]) + ((1 - $alpha) * $canvas->[$i]);
1703 return (_color_calculate_transparent ($alpha, $ret, @colors)) if (@colors);
1712 for (my $i = 0; $i < $num; $i++)
1714 my $pos = 6 * $i / $num;
1755 push (@ret, sprintf ("%02x%02x%02x", $red, $green, $blue));