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:line_avg={file}:linev:AVERAGE',
779 'DEF:line_min={file}:linev:MIN',
780 'DEF:line_max={file}:linev:MAX',
781 'DEF:out_avg={file}:outputv:AVERAGE',
782 'DEF:out_min={file}:outputv:MIN',
783 'DEF:out_max={file}:outputv:MAX',
784 #"AREA:line_max#$HalfBlue",
785 #"AREA:line_min#$Canvas",
786 #"AREA:out_avg#$HalfGreen",
787 "LINE1:line_avg#$FullBlue:Line Volt",
788 'GPRINT:line_min:MIN:%5.1lf%sV Min,',
789 'GPRINT:line_avg:AVERAGE:%5.1lf%sV Avg,',
790 'GPRINT:line_max:MAX:%5.1lf%sV Max,',
791 'GPRINT:line_avg:LAST:%5.1lf%sV Last\l',
792 "LINE2:out_avg#$FullGreen:Out Volt",
793 'GPRINT:out_min:MIN:%5.1lf%sV Min,',
794 'GPRINT:out_avg:AVERAGE:%5.1lf%sV Avg,',
795 'GPRINT:out_max:MAX:%5.1lf%sV Max,',
796 'GPRINT:out_avg:LAST:%5.1lf%sV Last\l'
799 'DEF:bvolt_avg={file}:battv:AVERAGE',
800 'DEF:bvolt_min={file}:battv:MIN',
801 'DEF:bvolt_max={file}:battv:MAX',
802 "AREA:bvolt_max#$HalfBlue",
803 "LINE1:bvolt_avg#$FullBlue:Batt Volt",
804 'GPRINT:bvolt_min:MIN:%5.1lf%sV Min,',
805 'GPRINT:bvolt_avg:AVERAGE:%5.1lf%sV Avg,',
806 'GPRINT:bvolt_max:MAX:%5.1lf%sV Max,',
807 'GPRINT:bvolt_avg:LAST:%5.1lf%sV Last\l',
810 'DEF:load_avg={file}:loadpct:AVERAGE',
811 'DEF:load_min={file}:loadpct:MIN',
812 'DEF:load_max={file}:loadpct:MAX',
813 "AREA:load_max#$HalfBlue",
814 "LINE1:load_avg#$FullBlue:Batt load",
815 'GPRINT:load_min:MIN:%5.1lf%s%% Min,',
816 'GPRINT:load_avg:AVERAGE:%5.1lf%s%% Avg,',
817 'GPRINT:load_max:MAX:%5.1lf%s%% Max,',
818 'GPRINT:load_avg:LAST:%5.1lf%s%% Last\l',
821 'DEF:charge_avg={file}:bcharge:AVERAGE',
822 'DEF:charge_min={file}:bcharge:MIN',
823 'DEF:charge_max={file}:bcharge:MAX',
824 "AREA:charge_max#$HalfBlue",
825 "LINE1:charge_avg#$FullBlue:Batt Charge",
826 'GPRINT:charge_min:MIN:%5.1lf%s%% Min,',
827 'GPRINT:charge_avg:AVERAGE:%5.1lf%s%% Avg,',
828 'GPRINT:charge_max:MAX:%5.1lf%s%% Max,',
829 'GPRINT:charge_avg:LAST:%5.1lf%s%% Last\l',
832 'DEF:time_avg={file}:timeleft:AVERAGE',
833 'DEF:time_min={file}:timeleft:MIN',
834 'DEF:time_max={file}:timeleft:MAX',
835 "AREA:time_max#$HalfBlue",
836 "LINE1:time_avg#$FullBlue:Time Avail",
837 'GPRINT:time_min:MIN:%5.1lf%smin Min,',
838 'GPRINT:time_avg:AVERAGE:%5.1lf%smin Avg,',
839 'GPRINT:time_max:MAX:%5.1lf%smin Max,',
840 'GPRINT:time_avg:LAST:%5.1lf%smin Last\l',
843 'DEF:temp_avg={file}:itemp:AVERAGE',
844 'DEF:temp_min={file}:itemp:MIN',
845 'DEF:temp_max={file}:itemp:MAX',
846 "AREA:temp_max#$HalfBlue",
847 "LINE1:temp_avg#$FullBlue:Temp Avail",
848 'GPRINT:temp_min:MIN:%5.1lf%s° Min,',
849 'GPRINT:temp_avg:AVERAGE:%5.1lf%s° Avg,',
850 'GPRINT:temp_max:MAX:%5.1lf%s° Max,',
851 'GPRINT:temp_avg:LAST:%5.1lf%s° Last\l',
854 'DEF:freq_avg={file}:linefreq:AVERAGE',
855 'DEF:freq_min={file}:linefreq:MIN',
856 'DEF:freq_max={file}:linefreq:MAX',
857 "AREA:freq_max#$HalfBlue",
858 "LINE1:freq_avg#$FullBlue:Line Freq",
859 'GPRINT:freq_min:MIN:%5.1lf%sHz Min,',
860 'GPRINT:freq_avg:AVERAGE:%5.1lf%sHz Avg,',
861 'GPRINT:freq_max:MAX:%5.1lf%sHz Max,',
862 'GPRINT:freq_avg:LAST:%5.1lf%sHz Last\l',
865 "DEF:total_avg={file}:total:AVERAGE",
866 "DEF:total_min={file}:total:MIN",
867 "DEF:total_max={file}:total:MAX",
868 "DEF:running_avg={file}:running:AVERAGE",
869 "DEF:running_min={file}:running:MIN",
870 "DEF:running_max={file}:running:MAX",
871 "DEF:uninterruptible_avg={file}:uninterruptible:AVERAGE",
872 "DEF:uninterruptible_min={file}:uninterruptible:MIN",
873 "DEF:uninterruptible_max={file}:uninterruptible:MAX",
874 "DEF:onhold_avg={file}:onhold:AVERAGE",
875 "DEF:onhold_min={file}:onhold:MIN",
876 "DEF:onhold_max={file}:onhold:MAX",
877 "LINE1:total_avg#$FullYellow:Total ",
878 'GPRINT:total_min:MIN:%5.1lf Min,',
879 'GPRINT:total_avg:AVERAGE:%5.1lf Avg.,',
880 'GPRINT:total_max:MAX:%5.1lf Max,',
881 'GPRINT:total_avg:LAST:%5.1lf Last\l',
882 "LINE1:running_avg#$FullRed:Running ",
883 'GPRINT:running_min:MIN:%5.1lf Min,',
884 'GPRINT:running_avg:AVERAGE:%5.1lf Avg.,',
885 'GPRINT:running_max:MAX:%5.1lf Max,',
886 'GPRINT:running_avg:LAST:%5.1lf Last\l',
887 "LINE1:uninterruptible_avg#$FullGreen:Unintr ",
888 'GPRINT:uninterruptible_min:MIN:%5.1lf Min,',
889 'GPRINT:uninterruptible_avg:AVERAGE:%5.1lf Avg.,',
890 'GPRINT:uninterruptible_max:MAX:%5.1lf Max,',
891 'GPRINT:uninterruptible_avg:LAST:%5.1lf Last\l',
892 "LINE1:onhold_avg#$FullBlue:Onhold ",
893 'GPRINT:onhold_min:MIN:%5.1lf Min,',
894 'GPRINT:onhold_avg:AVERAGE:%5.1lf Avg.,',
895 'GPRINT:onhold_max:MAX:%5.1lf Max,',
896 'GPRINT:onhold_avg:LAST:%5.1lf Last\l'
899 'DEF:vm_avg={file}:vm:AVERAGE',
900 'DEF:vm_min={file}:vm:MIN',
901 'DEF:vm_max={file}:vm:MAX',
902 'DEF:vml_avg={file}:vml:AVERAGE',
903 'DEF:vml_min={file}:vml:MIN',
904 'DEF:vml_max={file}:vml:MAX',
905 'DEF:rss_avg={file}:rss:AVERAGE',
906 'DEF:rss_min={file}:rss:MIN',
907 'DEF:rss_max={file}:rss:MAX',
908 'DEF:anon_avg={file}:anon:AVERAGE',
909 'DEF:anon_min={file}:anon:MIN',
910 'DEF:anon_max={file}:anon:MAX',
911 "LINE1:vm_avg#$FullYellow:VM ",
912 'GPRINT:vm_min:MIN:%5.1lf%s Min,',
913 'GPRINT:vm_avg:AVERAGE:%5.1lf%s Avg.,',
914 'GPRINT:vm_max:MAX:%5.1lf%s Avg.,',
915 'GPRINT:vm_avg:LAST:%5.1lf%s Last\l',
916 "LINE1:vml_avg#$FullRed:Locked ",
917 'GPRINT:vml_min:MIN:%5.1lf%s Min,',
918 'GPRINT:vml_avg:AVERAGE:%5.1lf%s Avg.,',
919 'GPRINT:vml_max:MAX:%5.1lf%s Avg.,',
920 'GPRINT:vml_avg:LAST:%5.1lf%s Last\l',
921 "LINE1:rss_avg#$FullGreen:RSS ",
922 'GPRINT:rss_min:MIN:%5.1lf%s Min,',
923 'GPRINT:rss_avg:AVERAGE:%5.1lf%s Avg.,',
924 'GPRINT:rss_max:MAX:%5.1lf%s Avg.,',
925 'GPRINT:rss_avg:LAST:%5.1lf%s Last\l',
926 "LINE1:anon_avg#$FullBlue:Anon. ",
927 'GPRINT:anon_min:MIN:%5.1lf%s Min,',
928 'GPRINT:anon_avg:AVERAGE:%5.1lf%s Avg.,',
929 'GPRINT:anon_max:MAX:%5.1lf%s Avg.,',
930 'GPRINT:anon_avg:LAST:%5.1lf%s Last\l',
933 'DEF:proc_avg={file}:total:AVERAGE',
934 'DEF:proc_min={file}:total:MIN',
935 'DEF:proc_max={file}:total:MAX',
936 "AREA:proc_max#$HalfBlue",
937 "AREA:proc_min#$Canvas",
938 "LINE1:proc_avg#$FullBlue:Processes",
939 'GPRINT:proc_min:MIN:%4.1lf Min,',
940 'GPRINT:proc_avg:AVERAGE:%4.1lf Avg.,',
941 'GPRINT:proc_max:MAX:%4.1lf Max,',
942 'GPRINT:proc_avg:LAST:%4.1lf Last\l'
945 $GraphDefs->{'disk'} = $GraphDefs->{'partition'};
946 $GraphDefs->{'meminfo'} = $GraphDefs->{'memory'};
947 $GraphDefs->{'sensors'} = $GraphDefs->{'temperature'};
952 apache_bytes => ['-t', 'apache traffic', '-v', 'Bit/s'],
953 apache_requests => ['-t', 'apache requests', '-v', 'Requests/s'],
954 apache_scoreboard => ['-t', 'apache scoreboard {inst}', '-v', 'Processes'],
955 charge => ['-t', '{host} charge', '-v', 'Ampere hours'],
956 cpu => ['-t', '{host} cpu{inst} usage', '-v', 'Percent', '-l', '0'],
957 cpufreq => ['-t', '{host} cpu{inst} usage', '-v', 'Mhz'],
958 current => ['-t', '{host} current', '-v', 'Ampere'],
959 #disk => ['-t', '{host} disk {inst} IO wait', '-v', 'Seconds'],
960 df => ['-t', '{host}:{inst} usage', '-v', 'Percent', '-l', '0'],
961 disk => ['-t', '{host} disk {inst} usage', '-v', 'Byte/s'],
962 fanspeed => ['-t', '{host} fanspeed {inst}', '-v', 'rpm'],
963 hddtemp => ['-t', '{host} hdd temperature {inst}', '-v', '°Celsius'],
964 load => ['-t', '{host} load average', '-v', 'System load', '-X', '0'],
965 mails => ['-t', '{host} mail count', '-v', 'Amount', '-X', '0'],
966 memory => ['-t', '{host} memory usage', '-v', 'Bytes', '-b', '1024', '-l', '0'],
967 mysql_commands => ['-t', 'mysql command {inst}', '-v', 'Issues/s' ],
968 mysql_handler => ['-t', 'mysql handler {inst}', '-v', 'Issues/s' ],
969 mysql_qcache => ['-t', 'mysql query cache', '-v', 'Queries/s' ],
970 mysql_threads => ['-t', 'mysql threads', '-v', 'Threads' ],
971 nfs3_procedures => ['-t', '{host} NFSv3 {inst} procedures', '-v', 'Procedures/s' ],
972 partition => ['-t', '{host} partition {inst} usage', '-v', 'Byte/s'],
973 ping => ['-t', '{host} ping to {inst}', '-v', 'ms'],
974 processes => ['-t', '{host} processes', '-v', 'Processes'],
975 sensors => ['-t', '{host} sensor {inst}', '-v', '°Celsius'],
976 swap => ['-t', '{host} swap usage', '-v', 'Bytes', '-b', '1024', '-l', '0'],
977 temperature => ['-t', '{host} temperature {inst}', '-v', '°Celsius'],
978 traffic => ['-t', '{host} {inst} traffic', '-v', 'Bit/s'],
979 users => ['-t', '{host} users', '-v', 'Users'],
980 voltage => ['-t', '{host} voltage', '-v', 'Volts'],
981 apcups_volt => ['-t', '{host} APC voltage {inst}', '-v', 'Volts AC'],
982 apcups_bvolt => ['-t', '{host} APC Batt voltage {inst}', '-v', 'Volts DC'],
983 apcups_load => ['-t', '{host} APC Load {inst}', '-v', 'Percent'],
984 apcups_charge => ['-t', '{host} APC Batt Charge {inst}', '-v', 'Percent'],
985 apcups_time => ['-t', '{host} APC Time Left {inst}', '-v', 'Minutes'],
986 apcups_temp => ['-t', '{host} APC Internal Temp {inst}', '-v', '°Celsius'],
987 apcups_freq => ['-t', '{host} APC Line Freq {inst}', '-v', 'Hz'],
988 vs_threads => ['-t', '{host} threads', '-v', 'Threads'],
989 vs_memory => ['-t', '{host} memory usage', '-v', 'Bytes'],
990 vs_processes => ['-t', '{host} processes', '-v', 'Processes'],
995 apache_scoreboard => \&output_graph_apache_scoreboard,
996 cpu => \&output_graph_cpu,
1009 mysql_commands => \&output_graph_mysql_commands,
1010 mysql_handler => \&output_graph_mysql_handler,
1012 ping => \&output_graph_ping,
1019 if (defined ($ENV{'GATEWAY_INTERFACE'}))
1021 @Info = ($ENV{'PATH_INFO'} || '') =~ m#([\w\-\.]+)#g;
1028 parse_pathinfo (@Info);
1041 sub output_graph_cpu
1051 "DEF:user_avg_$_=$AbsDir/cpu-$_.rrd:user:AVERAGE",
1052 "DEF:user_min_$_=$AbsDir/cpu-$_.rrd:user:MIN",
1053 "DEF:user_max_$_=$AbsDir/cpu-$_.rrd:user:MAX",
1054 "DEF:nice_avg_$_=$AbsDir/cpu-$_.rrd:nice:AVERAGE",
1055 "DEF:nice_min_$_=$AbsDir/cpu-$_.rrd:nice:MIN",
1056 "DEF:nice_max_$_=$AbsDir/cpu-$_.rrd:nice:MAX",
1057 "DEF:syst_avg_$_=$AbsDir/cpu-$_.rrd:syst:AVERAGE",
1058 "DEF:syst_min_$_=$AbsDir/cpu-$_.rrd:syst:MIN",
1059 "DEF:syst_max_$_=$AbsDir/cpu-$_.rrd:syst:MAX",
1060 "DEF:wait_avg_$_=$AbsDir/cpu-$_.rrd:wait:AVERAGE",
1061 "DEF:wait_min_$_=$AbsDir/cpu-$_.rrd:wait:MIN",
1062 "DEF:wait_max_$_=$AbsDir/cpu-$_.rrd:wait:MAX");
1065 for (qw(user nice syst wait))
1070 my $default_value = ($def eq 'user' or $def eq 'syst') ? 'UNKN' : '0';
1072 for (qw(avg min max))
1078 push (@ret, "CDEF:${def}_${cf}_notnull_${_}=${def}_${cf}_${_},UN,0,${def}_${cf}_${_},IF");
1079 push (@ret, "CDEF:${def}_${cf}_defined_${_}=${def}_${cf}_${_},UN,0,1,IF");
1082 $cdef = "CDEF:${def}_${cf}_num=" . join (',', map { "${def}_${cf}_defined_${_}" } (@inst));
1083 $cdef .= ',+' x (scalar (@inst) - 1);
1086 $cdef = "CDEF:${def}_${cf}=${def}_${cf}_num," . join (',', map { "${def}_${cf}_notnull_${_}" } (@inst));
1087 $cdef .= ',+' x (scalar (@inst) - 1);
1088 $cdef .= ",${def}_${cf}_num,${def}_${cf}_num,1,IF,/,$default_value,IF";
1090 push (@ret, "CDEF:${def}_${cf}_notnull=${def}_${cf},UN,0,${def}_${cf},IF");
1095 "CDEF:nice_acc=syst_avg_notnull,wait_avg_notnull,user_avg_notnull,nice_avg_notnull,+,+,+",
1096 "CDEF:user_acc=syst_avg_notnull,wait_avg_notnull,user_avg_notnull,+,+",
1097 "CDEF:wait_acc=syst_avg_notnull,wait_avg_notnull,+",
1098 "CDEF:syst_acc=syst_avg_notnull");
1100 push (@ret, grep { $_ !~ m/^C?DEF/ } (@{$GraphDefs->{'cpu'}}));
1105 sub output_graph_apache_scoreboard
1112 my @colors = get_n_colors (scalar (@inst));
1114 for (my $i = 0; $i < scalar (@inst); $i++)
1116 my $inst = $inst[$i];
1118 "DEF:avg_$i=$AbsDir/apache_scoreboard-$inst.rrd:count:AVERAGE",
1119 "DEF:min_$i=$AbsDir/apache_scoreboard-$inst.rrd:count:MIN",
1120 "DEF:max_$i=$AbsDir/apache_scoreboard-$inst.rrd:count:MAX");
1123 for (my $i = 0; $i < scalar (@inst); $i++)
1125 my $inst = $inst[$i];
1126 my $color = $colors[$i];
1128 if (length ($inst) > 15)
1130 $inst = substr ($inst, 0, 12) . '...';
1134 $inst = sprintf ('%-15s', $inst);
1138 "LINE1:avg_$i#$color:$inst",
1139 "GPRINT:min_$i:MIN:%6.2lf Min,",
1140 "GPRINT:avg_$i:AVERAGE:%6.2lf Avg,",
1141 "GPRINT:max_$i:MAX:%6.2lf Max,",
1142 "GPRINT:avg_$i:LAST:%6.2lf Last\\l");
1148 sub output_graph_ping
1155 my @colors = get_n_colors (scalar (@inst));
1157 for (my $i = 0; $i < scalar (@inst); $i++)
1159 my $inst = $inst[$i];
1161 "DEF:avg_$i=$AbsDir/ping-$inst.rrd:ping:AVERAGE",
1162 "DEF:min_$i=$AbsDir/ping-$inst.rrd:ping:MIN",
1163 "DEF:max_$i=$AbsDir/ping-$inst.rrd:ping:MAX");
1166 for (my $i = 0; $i < scalar (@inst); $i++)
1168 my $inst = $inst[$i];
1169 my $color = $colors[$i];
1171 if (length ($inst) > 15)
1173 $inst = substr ($inst, 0, 12) . '...';
1177 $inst = sprintf ('%-15s', $inst);
1181 "LINE1:avg_$i#$color:$inst",
1182 "GPRINT:min_$i:MIN:%4.1lf ms Min,",
1183 "GPRINT:avg_$i:AVERAGE:%4.1lf ms Avg,",
1184 "GPRINT:max_$i:MAX:%4.1lf ms Max,",
1185 "GPRINT:avg_$i:LAST:%4.1lf ms Last\\l");
1191 sub output_graph_mysql_commands
1198 my @colors = get_n_colors (scalar (@inst));
1200 for (my $i = 0; $i < scalar (@inst); $i++)
1202 my $inst = $inst[$i];
1204 "DEF:avg_$i=$AbsDir/mysql_commands-$inst.rrd:value:AVERAGE",
1205 "DEF:min_$i=$AbsDir/mysql_commands-$inst.rrd:value:MIN",
1206 "DEF:max_$i=$AbsDir/mysql_commands-$inst.rrd:value:MAX");
1209 for (my $i = 0; $i < scalar (@inst); $i++)
1211 my $inst = $inst[$i];
1212 my $color = $colors[$i];
1214 if (length ($inst) > 18)
1216 $inst = substr ($inst, 0, 15) . '...';
1220 $inst = sprintf ('%-18s', $inst);
1224 "LINE1:avg_$i#$color:$inst",
1225 "GPRINT:min_$i:MIN:%6.1lf Min,",
1226 "GPRINT:avg_$i:AVERAGE:%6.1lf Avg,",
1227 "GPRINT:max_$i:MAX:%6.1lf Max,",
1228 "GPRINT:avg_$i:LAST:%6.1lf Last\\l");
1234 sub output_graph_mysql_handler
1241 my @colors = get_n_colors (scalar (@inst));
1243 for (my $i = 0; $i < scalar (@inst); $i++)
1245 my $inst = $inst[$i];
1247 "DEF:avg_$i=$AbsDir/mysql_handler-$inst.rrd:value:AVERAGE",
1248 "DEF:min_$i=$AbsDir/mysql_handler-$inst.rrd:value:MIN",
1249 "DEF:max_$i=$AbsDir/mysql_handler-$inst.rrd:value:MAX");
1252 for (my $i = 0; $i < scalar (@inst); $i++)
1254 my $inst = $inst[$i];
1255 my $color = $colors[$i];
1257 if (length ($inst) > 18)
1259 $inst = substr ($inst, 0, 15) . '...';
1263 $inst = sprintf ('%-18s', $inst);
1267 "LINE1:avg_$i#$color:$inst",
1268 "GPRINT:min_$i:MIN:%6.1lf Min,",
1269 "GPRINT:avg_$i:AVERAGE:%6.1lf Avg,",
1270 "GPRINT:max_$i:MAX:%6.1lf Max,",
1271 "GPRINT:avg_$i:LAST:%6.1lf Last\\l");
1279 die unless (defined ($GraphDefs->{$Type}));
1283 my $file = $AbsDir . '/';
1284 my $files = get_all_files ($AbsDir);
1289 if ($RelDir =~ m#([^/]+)$#)
1295 $host = $Config->{'HostName'};
1301 if ($TimeSpan =~ m/(\d+)/)
1303 $TimeSpan = -1 * int ($1);
1307 my %t = (hour => -3600, day => -86400, week => -604800, month => -2678400, year => -31622400);
1308 die unless (defined ($t{$TimeSpan}));
1309 $TimeSpan = $t{$TimeSpan};
1312 if (scalar (@{$files->{$Type}}) == 1)
1314 $Inst = $files->{$Type}[0];
1317 #push (@cmd, '-', '-a', 'PNG', '-s', $TimeSpan, '-w', 800, '-h', 150);
1318 push (@cmd, '-', '-a', 'PNG', '-s', $TimeSpan);
1319 push (@cmd, @{$GraphArgs->{$Type}}) if (defined ($GraphArgs->{$Type}));
1321 for (qw(Back ShadeA ShadeB Font Canvas Grid MGrid Frame Arrow))
1323 push (@cmd, '-c', uc ($_) . '#' . $Config->{'Colors'}{$_});
1326 if ((length ($Inst) == 0) and (ref ($GraphMulti->{$Type}) eq 'CODE'))
1328 push (@cmd, $GraphMulti->{$Type}->(@{$files->{$Type}}));
1332 if (length ("$Inst"))
1334 $file .= "$Type-$Inst.rrd";
1338 $file .= "$Type.rrd";
1341 die ("File not found: $file") unless (-e $file);
1343 push (@cmd, @{$GraphDefs->{$Type}});
1348 $_ =~ s/{file}/$file/g;
1349 $_ =~ s/{host}/$host/g;
1350 $_ =~ s/{inst}/$Inst/g;
1351 $_ =~ s/{type}/$Type/g;
1356 print STDOUT <<HEADER if (defined ($ENV{'GATEWAY_INTERFACE'}));
1357 Content-Type: image/png
1358 Cache-Control: no-cache
1365 open ($fh, ">/tmp/collection.log") or die ("open: $!");
1366 flock ($fh, LOCK_EX) or die ("flock: $!");
1368 print $fh join ("\n\t", @cmd) . "\n";
1375 die ('RRDs::error: ' . RRDs::error ()) if (RRDs::error ());
1380 my $files = get_all_files ($AbsDir);
1381 my $dirs = get_all_dirs ($AbsDir);
1383 print STDOUT <<HEADER if (defined ($ENV{'GATEWAY_INTERFACE'}));
1384 Content-Type: text/html
1385 Cache-Control: no-cache
1389 <title>Collection: $RelDir</title>
1390 <style type="text/css">
1391 img { border: none; display: block; }
1398 my $MySelf = defined ($ENV{'GATEWAY_INTERFACE'}) ? $ENV{'SCRIPT_NAME'} : $0;
1400 if ((length ($Type) != 0) and (length ($Inst) == 0) and (ref ($GraphMulti->{$Type}) eq 'CODE') and (scalar (@{$files->{$Type}}) > 1))
1402 print qq(\t\t<div><a href="$MySelf$RelDir">Go up</a></div>\n);
1405 for (@{$files->{$Type}})
1407 print qq(\t\t\t<li><a href="$MySelf$RelDir/$Type/$_">$_</a></li>\n);
1413 <div><img src="$MySelf$RelDir/$Type/hour" /></div>
1415 <div><img src="$MySelf$RelDir/$Type/day" /></div>
1417 <div><img src="$MySelf$RelDir/$Type/week" /></div>
1419 <div><img src="$MySelf$RelDir/$Type/month" /></div>
1421 <div><img src="$MySelf$RelDir/$Type/year" /></div>
1424 elsif (length ($Type) != 0)
1426 my $ext = length ($Inst) ? "$Type/$Inst" : $Type;
1428 if ((ref ($GraphMulti->{$Type}) eq 'CODE') and (scalar (@{$files->{$Type}}) > 1))
1430 print qq(<div><a href="$MySelf$RelDir/$Type">Go up</a></div>\n);
1434 print qq(<div><a href="$MySelf$RelDir">Go up</a></div>\n);
1439 <div><img src="$MySelf$RelDir/$ext/hour" /></div>
1441 <div><img src="$MySelf$RelDir/$ext/day" /></div>
1443 <div><img src="$MySelf$RelDir/$ext/week" /></div>
1445 <div><img src="$MySelf$RelDir/$ext/month" /></div>
1447 <div><img src="$MySelf$RelDir/$ext/year" /></div>
1454 my ($up) = $RelDir =~ m#(.*)/[^/]+$#;
1455 print qq(\t\t<div><a href="$MySelf$up">Go up</a></div>\n);
1463 print qq(<li>$AbsDir/<a href="$MySelf$RelDir/$_">$_</a></li>\n);
1468 for (sort (keys %$files))
1472 if (ref ($GraphMulti->{$type}) eq 'CODE')
1474 print qq(\t\t<a href="$MySelf$RelDir/$type" />),
1475 qq(<img src="$MySelf$RelDir/$type/day" /></a>\n);
1479 for (@{$files->{$type}})
1485 print qq(\t\t<a href="$MySelf$RelDir/$type/$inst" />),
1486 qq(<img src="$MySelf$RelDir/$type/$inst/day" /></a>\n);
1490 print qq(\t\t<a href="$MySelf$RelDir/$type" />),
1491 qq(<img src="$MySelf$RelDir/$type/day" /></a>\n);
1497 print STDOUT <<FOOTER if (defined ($ENV{'GATEWAY_INTERFACE'}));
1505 my $files = get_all_files ();
1507 print STDOUT <<HEADER if (defined ($ENV{'GATEWAY_INTERFACE'}));
1508 Content-Type: text/xml
1509 Cache-Control: no-cache
1512 print STDOUT pl2xml ($files);
1517 my $file = @_ ? shift : '/etc/collection.conf';
1521 # if (open ($fh, "< $file"))
1529 # $conf = xml2pl ($xml);
1549 FullRed => 'FF0000',
1550 FullBlue => '0000FF',
1551 FullGreen => '00E000',
1552 FullYellow => 'F0A000',
1553 FullCyan => '00A0FF',
1554 FullMagenta => 'A000FF',
1556 HalfRed => 'F8B8B8',
1557 HalfBlue => 'B8B8F8',
1558 HalfGreen => 'B8F0B8',
1559 HalfYellow => 'F4F4B8'
1561 Directory => '/var/lib/collectd',
1562 HostName => (defined ($ENV{'SERVER_NAME'}) ? $ENV{'SERVER_NAME'} : 'localhost')
1575 $AbsDir = $Config->{'Directory'};
1578 while (@info and -d $AbsDir . '/' . $info[0])
1580 my $new = shift (@info);
1581 next if ($new =~ m/^\./);
1583 $AbsDir .= '/' . $new;
1584 $RelDir .= '/' . $new;
1591 confess ("parse_pathinfo: too many elements in pathinfo") if (scalar (@info) > 3);
1592 return unless (@info);
1594 $Type = shift (@info);
1595 return unless (@info);
1597 if ($info[-1] =~ m/^(hour|day|week|month|year)$/i)
1599 $TimeSpan = pop (@info);
1602 $Inst = shift (@info) if (@info);
1604 confess ("unrecognized elements in pathinfo") if (@info);
1609 my $dir = @_ ? shift : $Config->{'Directory'};
1613 if (opendir ($dh, $dir))
1615 while (my $thing = readdir ($dh))
1617 next if ($thing =~ m/^\./);
1622 if ($thing =~ m/^(\w+)-([\w\-\.]+)\.rrd$/)
1627 elsif ($thing =~ m/^(\w+)\.rrd$/)
1637 # Only load RRD files we can actually display..
1638 next unless (defined ($GraphDefs->{$type}));
1640 $hash->{$type} = [] unless (defined ($hash->{$type}));
1641 push (@{$hash->{$type}}, $inst);
1652 my $dir = @_ ? shift : $Config->{'Directory'};
1656 if (opendir ($dh, $dir))
1658 while (my $thing = readdir ($dh))
1660 next if ($thing =~ m/^\./);
1662 next if (!-d "$dir/$thing");
1664 push (@ret, $thing);
1670 return (@ret) if (wantarray ());
1678 my ($red, $green, $blue) = map { ord (pack ("H2", $_)) } ($color =~ m/([A-Fa-f0-9]{2})/g);
1679 #print STDERR "$color -> rgb($red,$green,$blue)\n";
1681 return ($red, $green, $blue);
1686 croak unless (scalar (@_) == 3);
1688 my ($red, $green, $blue) = @_;
1690 my $ret = sprintf ("%02X%02X%02X", $red, $green, $blue);
1691 #print STDERR "rgb($red,$green,$blue) -> $ret\n";
1696 sub color_calculate_transparent
1699 my $canvas = [color_hex2rgb (shift)];
1700 my @colors = map { [color_hex2rgb ($_)] } (@_);
1702 if (($alpha < 0.0) or ($alpha > 1.0))
1709 return (color_rgb2hex (@$canvas));
1713 return (color_rgb2hex (@{$colors[-1]}));
1716 my $ret = _color_calculate_transparent ($alpha, $canvas, @colors);
1718 return (color_rgb2hex (@$ret));
1721 sub _color_calculate_transparent
1726 my @colors = @_ ? shift : ();
1727 my $ret = [0, 0, 0];
1729 for (my $i = 0; $i < 3; $i++)
1731 $ret->[$i] = ($alpha * $color->[$i]) + ((1 - $alpha) * $canvas->[$i]);
1734 return (_color_calculate_transparent ($alpha, $ret, @colors)) if (@colors);
1743 for (my $i = 0; $i < $num; $i++)
1745 my $pos = 6 * $i / $num;
1786 push (@ret, sprintf ("%02x%02x%02x", $red, $green, $blue));