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 if_packets => ['DEF:tx_min={file}:tx:MIN',
287 'DEF:tx_avg={file}:tx:AVERAGE',
288 'DEF:tx_max={file}:tx:MAX',
289 'DEF:rx_min={file}:rx:MIN',
290 'DEF:rx_avg={file}:rx:AVERAGE',
291 'DEF:rx_max={file}:rx:MAX',
292 'CDEF:overlap=tx_avg,rx_avg,GT,rx_avg,tx_avg,IF',
293 'CDEF:mytime=tx_avg,TIME,TIME,IF',
294 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
295 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
296 'CDEF:tx_avg_sample=tx_avg,UN,0,tx_avg,IF,sample_len,*',
297 'CDEF:tx_avg_sum=PREV,UN,0,PREV,IF,tx_avg_sample,+',
298 'CDEF:rx_avg_sample=rx_avg,UN,0,rx_avg,IF,sample_len,*',
299 'CDEF:rx_avg_sum=PREV,UN,0,PREV,IF,rx_avg_sample,+',
300 "AREA:tx_avg#$HalfGreen",
301 "AREA:rx_avg#$HalfBlue",
302 "AREA:overlap#$HalfBlueGreen",
303 "LINE1:tx_avg#$FullGreen:TX",
304 'GPRINT:tx_avg:AVERAGE:%5.1lf%s Avg,',
305 'GPRINT:tx_max:MAX:%5.1lf%s Max,',
306 'GPRINT:tx_avg:LAST:%5.1lf%s Last',
307 'GPRINT:tx_avg_sum:LAST:(ca. %4.0lf%s Total)\l',
308 "LINE1:rx_avg#$FullBlue:RX",
309 #'GPRINT:rx_min:MIN:%5.1lf %s Min,',
310 'GPRINT:rx_avg:AVERAGE:%5.1lf%s Avg,',
311 'GPRINT:rx_max:MAX:%5.1lf%s Max,',
312 'GPRINT:rx_avg:LAST:%5.1lf%s Last',
313 'GPRINT:rx_avg_sum:LAST:(ca. %4.0lf%s Total)\l'
315 load => ['DEF:s_avg={file}:shortterm:AVERAGE',
316 'DEF:s_min={file}:shortterm:MIN',
317 'DEF:s_max={file}:shortterm:MAX',
318 'DEF:m_avg={file}:midterm:AVERAGE',
319 'DEF:m_min={file}:midterm:MIN',
320 'DEF:m_max={file}:midterm:MAX',
321 'DEF:l_avg={file}:longterm:AVERAGE',
322 'DEF:l_min={file}:longterm:MIN',
323 'DEF:l_max={file}:longterm:MAX',
324 "AREA:s_max#$HalfGreen",
325 "AREA:s_min#$Canvas",
326 "LINE1:s_avg#$FullGreen: 1m average",
327 'GPRINT:s_min:MIN:%4.2lf Min,',
328 'GPRINT:s_avg:AVERAGE:%4.2lf Avg,',
329 'GPRINT:s_max:MAX:%4.2lf Max,',
330 'GPRINT:s_avg:LAST:%4.2lf Last\n',
331 "LINE1:m_avg#$FullBlue: 5m average",
332 'GPRINT:m_min:MIN:%4.2lf Min,',
333 'GPRINT:m_avg:AVERAGE:%4.2lf Avg,',
334 'GPRINT:m_max:MAX:%4.2lf Max,',
335 'GPRINT:m_avg:LAST:%4.2lf Last\n',
336 "LINE1:l_avg#$FullRed:15m average",
337 'GPRINT:l_min:MIN:%4.2lf Min,',
338 'GPRINT:l_avg:AVERAGE:%4.2lf Avg,',
339 'GPRINT:l_max:MAX:%4.2lf Max,',
340 'GPRINT:l_avg:LAST:%4.2lf Last'
343 'DEF:avg={file}:percent:AVERAGE',
344 'DEF:min={file}:percent:MIN',
345 'DEF:max={file}:percent:MAX',
346 "AREA:max#$HalfBlue",
348 "LINE1:avg#$FullBlue:Load",
349 'GPRINT:min:MIN:%5.1lf%s%% Min,',
350 'GPRINT:avg:AVERAGE:%5.1lf%s%% Avg,',
351 'GPRINT:max:MAX:%5.1lf%s%% Max,',
352 'GPRINT:avg:LAST:%5.1lf%s%% Last\l'
354 mails => ['DEF:rawgood={file}:good:AVERAGE',
355 'DEF:rawspam={file}:spam:AVERAGE',
356 'CDEF:good=rawgood,UN,0,rawgood,IF',
357 'CDEF:spam=rawspam,UN,0,rawspam,IF',
358 'CDEF:negspam=spam,-1,*',
359 "AREA:good#$HalfGreen",
360 "LINE1:good#$FullGreen:Good mails",
361 'GPRINT:good:AVERAGE:%4.1lf Avg,',
362 'GPRINT:good:MAX:%4.1lf Max,',
363 'GPRINT:good:LAST:%4.1lf Last\n',
364 "AREA:negspam#$HalfRed",
365 "LINE1:negspam#$FullRed:Spam mails",
366 'GPRINT:spam:AVERAGE:%4.1lf Avg,',
367 'GPRINT:spam:MAX:%4.1lf Max,',
368 'GPRINT:spam:LAST:%4.1lf Last',
371 'DEF:used_avg={file}:used:AVERAGE',
372 'DEF:free_avg={file}:free:AVERAGE',
373 'DEF:buffers_avg={file}:buffers:AVERAGE',
374 'DEF:cached_avg={file}:cached:AVERAGE',
375 'DEF:used_min={file}:used:MIN',
376 'DEF:free_min={file}:free:MIN',
377 'DEF:buffers_min={file}:buffers:MIN',
378 'DEF:cached_min={file}:cached:MIN',
379 'DEF:used_max={file}:used:MAX',
380 'DEF:free_max={file}:free:MAX',
381 'DEF:buffers_max={file}:buffers:MAX',
382 'DEF:cached_max={file}:cached:MAX',
383 'CDEF:cached_avg_nn=cached_avg,UN,0,cached_avg,IF',
384 'CDEF:buffers_avg_nn=buffers_avg,UN,0,buffers_avg,IF',
385 'CDEF:free_cached_buffers_used=free_avg,cached_avg_nn,+,buffers_avg_nn,+,used_avg,+',
386 'CDEF:cached_buffers_used=cached_avg,buffers_avg_nn,+,used_avg,+',
387 'CDEF:buffers_used=buffers_avg,used_avg,+',
388 "AREA:free_cached_buffers_used#$HalfGreen",
389 "AREA:cached_buffers_used#$HalfBlue",
390 "AREA:buffers_used#$HalfYellow",
391 "AREA:used_avg#$HalfRed",
392 "LINE1:free_cached_buffers_used#$FullGreen:Free ",
393 'GPRINT:free_min:MIN:%5.1lf%s Min,',
394 'GPRINT:free_avg:AVERAGE:%5.1lf%s Avg,',
395 'GPRINT:free_max:MAX:%5.1lf%s Max,',
396 'GPRINT:free_avg:LAST:%5.1lf%s Last\n',
397 "LINE1:cached_buffers_used#$FullBlue:Page cache ",
398 'GPRINT:cached_min:MIN:%5.1lf%s Min,',
399 'GPRINT:cached_avg:AVERAGE:%5.1lf%s Avg,',
400 'GPRINT:cached_max:MAX:%5.1lf%s Max,',
401 'GPRINT:cached_avg:LAST:%5.1lf%s Last\n',
402 "LINE1:buffers_used#$FullYellow:Buffer cache",
403 'GPRINT:buffers_min:MIN:%5.1lf%s Min,',
404 'GPRINT:buffers_avg:AVERAGE:%5.1lf%s Avg,',
405 'GPRINT:buffers_max:MAX:%5.1lf%s Max,',
406 'GPRINT:buffers_avg:LAST:%5.1lf%s Last\n',
407 "LINE1:used_avg#$FullRed:Used ",
408 'GPRINT:used_min:MIN:%5.1lf%s Min,',
409 'GPRINT:used_avg:AVERAGE:%5.1lf%s Avg,',
410 'GPRINT:used_max:MAX:%5.1lf%s Max,',
411 'GPRINT:used_avg:LAST:%5.1lf%s Last'
414 "DEF:val_avg={file}:value:AVERAGE",
415 "DEF:val_min={file}:value:MIN",
416 "DEF:val_max={file}:value:MAX",
417 "AREA:val_max#$HalfBlue",
418 "AREA:val_min#$Canvas",
419 "LINE1:val_avg#$FullBlue:{inst}",
420 'GPRINT:val_min:MIN:%5.2lf Min,',
421 'GPRINT:val_avg:AVERAGE:%5.2lf Avg,',
422 'GPRINT:val_max:MAX:%5.2lf Max,',
423 'GPRINT:val_avg:LAST:%5.2lf Last'
426 "DEF:val_avg={file}:value:AVERAGE",
427 "DEF:val_min={file}:value:MIN",
428 "DEF:val_max={file}:value:MAX",
429 "AREA:val_max#$HalfBlue",
430 "AREA:val_min#$Canvas",
431 "LINE1:val_avg#$FullBlue:{inst}",
432 'GPRINT:val_min:MIN:%5.2lf Min,',
433 'GPRINT:val_avg:AVERAGE:%5.2lf Avg,',
434 'GPRINT:val_max:MAX:%5.2lf Max,',
435 'GPRINT:val_avg:LAST:%5.2lf Last'
438 "DEF:hits_min={file}:hits:MIN",
439 "DEF:hits_avg={file}:hits:AVERAGE",
440 "DEF:hits_max={file}:hits:MAX",
441 "DEF:inserts_min={file}:inserts:MIN",
442 "DEF:inserts_avg={file}:inserts:AVERAGE",
443 "DEF:inserts_max={file}:inserts:MAX",
444 "DEF:not_cached_min={file}:not_cached:MIN",
445 "DEF:not_cached_avg={file}:not_cached:AVERAGE",
446 "DEF:not_cached_max={file}:not_cached:MAX",
447 "DEF:lowmem_prunes_min={file}:lowmem_prunes:MIN",
448 "DEF:lowmem_prunes_avg={file}:lowmem_prunes:AVERAGE",
449 "DEF:lowmem_prunes_max={file}:lowmem_prunes:MAX",
450 "DEF:queries_min={file}:queries_in_cache:MIN",
451 "DEF:queries_avg={file}:queries_in_cache:AVERAGE",
452 "DEF:queries_max={file}:queries_in_cache:MAX",
453 "CDEF:unknown=queries_avg,UNKN,+",
454 "CDEF:not_cached_agg=hits_avg,inserts_avg,+,not_cached_avg,+",
455 "CDEF:inserts_agg=hits_avg,inserts_avg,+",
456 "CDEF:hits_agg=hits_avg",
457 "AREA:not_cached_agg#$HalfYellow",
458 "AREA:inserts_agg#$HalfBlue",
459 "AREA:hits_agg#$HalfGreen",
460 "LINE1:not_cached_agg#$FullYellow:Not Cached ",
461 'GPRINT:not_cached_min:MIN:%5.2lf Min,',
462 'GPRINT:not_cached_avg:AVERAGE:%5.2lf Avg,',
463 'GPRINT:not_cached_max:MAX:%5.2lf Max,',
464 'GPRINT:not_cached_avg:LAST:%5.2lf Last\l',
465 "LINE1:inserts_agg#$FullBlue:Inserts ",
466 'GPRINT:inserts_min:MIN:%5.2lf Min,',
467 'GPRINT:inserts_avg:AVERAGE:%5.2lf Avg,',
468 'GPRINT:inserts_max:MAX:%5.2lf Max,',
469 'GPRINT:inserts_avg:LAST:%5.2lf Last\l',
470 "LINE1:hits_agg#$FullGreen:Hits ",
471 'GPRINT:hits_min:MIN:%5.2lf Min,',
472 'GPRINT:hits_avg:AVERAGE:%5.2lf Avg,',
473 'GPRINT:hits_max:MAX:%5.2lf Max,',
474 'GPRINT:hits_avg:LAST:%5.2lf Last\l',
475 "LINE1:lowmem_prunes_avg#$FullRed:Lowmem Prunes ",
476 'GPRINT:lowmem_prunes_min:MIN:%5.2lf Min,',
477 'GPRINT:lowmem_prunes_avg:AVERAGE:%5.2lf Avg,',
478 'GPRINT:lowmem_prunes_max:MAX:%5.2lf Max,',
479 'GPRINT:lowmem_prunes_avg:LAST:%5.2lf Last\l',
480 "LINE1:unknown#$Canvas:Queries in cache",
481 'GPRINT:queries_min:MIN:%5.0lf Min,',
482 'GPRINT:queries_avg:AVERAGE:%5.0lf Avg,',
483 'GPRINT:queries_max:MAX:%5.0lf Max,',
484 'GPRINT:queries_avg:LAST:%5.0lf Last\l'
487 "DEF:running_min={file}:running:MIN",
488 "DEF:running_avg={file}:running:AVERAGE",
489 "DEF:running_max={file}:running:MAX",
490 "DEF:connected_min={file}:connected:MIN",
491 "DEF:connected_avg={file}:connected:AVERAGE",
492 "DEF:connected_max={file}:connected:MAX",
493 "DEF:cached_min={file}:cached:MIN",
494 "DEF:cached_avg={file}:cached:AVERAGE",
495 "DEF:cached_max={file}:cached:MAX",
496 "DEF:created_min={file}:created:MIN",
497 "DEF:created_avg={file}:created:AVERAGE",
498 "DEF:created_max={file}:created:MAX",
499 "CDEF:unknown=created_avg,UNKN,+",
500 "CDEF:cached_agg=connected_avg,cached_avg,+",
501 "AREA:cached_agg#$HalfGreen",
502 "AREA:connected_avg#$HalfBlue",
503 "AREA:running_avg#$HalfRed",
504 "LINE1:cached_agg#$FullGreen:Cached ",
505 'GPRINT:cached_min:MIN:%5.1lf Min,',
506 'GPRINT:cached_avg:AVERAGE:%5.1lf Avg,',
507 'GPRINT:cached_max:MAX:%5.1lf Max,',
508 'GPRINT:cached_avg:LAST:%5.1lf Last\l',
509 "LINE1:connected_avg#$FullBlue:Connected",
510 'GPRINT:connected_min:MIN:%5.1lf Min,',
511 'GPRINT:connected_avg:AVERAGE:%5.1lf Avg,',
512 'GPRINT:connected_max:MAX:%5.1lf Max,',
513 'GPRINT:connected_avg:LAST:%5.1lf Last\l',
514 "LINE1:running_avg#$FullRed:Running ",
515 'GPRINT:running_min:MIN:%5.1lf Min,',
516 'GPRINT:running_avg:AVERAGE:%5.1lf Avg,',
517 'GPRINT:running_max:MAX:%5.1lf Max,',
518 'GPRINT:running_avg:LAST:%5.1lf Last\l',
519 "LINE1:unknown#$Canvas:Created ",
520 'GPRINT:created_min:MIN:%5.0lf Min,',
521 'GPRINT:created_avg:AVERAGE:%5.0lf Avg,',
522 'GPRINT:created_max:MAX:%5.0lf Max,',
523 'GPRINT:created_avg:LAST:%5.0lf Last\l'
526 "DEF:null_avg={file}:null:AVERAGE",
527 "DEF:getattr_avg={file}:getattr:AVERAGE",
528 "DEF:setattr_avg={file}:setattr:AVERAGE",
529 "DEF:lookup_avg={file}:lookup:AVERAGE",
530 "DEF:access_avg={file}:access:AVERAGE",
531 "DEF:readlink_avg={file}:readlink:AVERAGE",
532 "DEF:read_avg={file}:read:AVERAGE",
533 "DEF:write_avg={file}:write:AVERAGE",
534 "DEF:create_avg={file}:create:AVERAGE",
535 "DEF:mkdir_avg={file}:mkdir:AVERAGE",
536 "DEF:symlink_avg={file}:symlink:AVERAGE",
537 "DEF:mknod_avg={file}:mknod:AVERAGE",
538 "DEF:remove_avg={file}:remove:AVERAGE",
539 "DEF:rmdir_avg={file}:rmdir:AVERAGE",
540 "DEF:rename_avg={file}:rename:AVERAGE",
541 "DEF:link_avg={file}:link:AVERAGE",
542 "DEF:readdir_avg={file}:readdir:AVERAGE",
543 "DEF:readdirplus_avg={file}:readdirplus:AVERAGE",
544 "DEF:fsstat_avg={file}:fsstat:AVERAGE",
545 "DEF:fsinfo_avg={file}:fsinfo:AVERAGE",
546 "DEF:pathconf_avg={file}:pathconf:AVERAGE",
547 "DEF:commit_avg={file}:commit:AVERAGE",
548 "DEF:null_max={file}:null:MAX",
549 "DEF:getattr_max={file}:getattr:MAX",
550 "DEF:setattr_max={file}:setattr:MAX",
551 "DEF:lookup_max={file}:lookup:MAX",
552 "DEF:access_max={file}:access:MAX",
553 "DEF:readlink_max={file}:readlink:MAX",
554 "DEF:read_max={file}:read:MAX",
555 "DEF:write_max={file}:write:MAX",
556 "DEF:create_max={file}:create:MAX",
557 "DEF:mkdir_max={file}:mkdir:MAX",
558 "DEF:symlink_max={file}:symlink:MAX",
559 "DEF:mknod_max={file}:mknod:MAX",
560 "DEF:remove_max={file}:remove:MAX",
561 "DEF:rmdir_max={file}:rmdir:MAX",
562 "DEF:rename_max={file}:rename:MAX",
563 "DEF:link_max={file}:link:MAX",
564 "DEF:readdir_max={file}:readdir:MAX",
565 "DEF:readdirplus_max={file}:readdirplus:MAX",
566 "DEF:fsstat_max={file}:fsstat:MAX",
567 "DEF:fsinfo_max={file}:fsinfo:MAX",
568 "DEF:pathconf_max={file}:pathconf:MAX",
569 "DEF:commit_max={file}:commit:MAX",
570 "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,+,+,+,+,+,+,+,+,+,+,+,+,+,+",
571 "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,+,+,+,+,+,+,+,+,+,+,+,+,+,+",
572 "CDEF:stack_read=read_avg",
573 "CDEF:stack_getattr=stack_read,getattr_avg,+",
574 "CDEF:stack_access=stack_getattr,access_avg,+",
575 "CDEF:stack_lookup=stack_access,lookup_avg,+",
576 "CDEF:stack_write=stack_lookup,write_avg,+",
577 "CDEF:stack_commit=stack_write,commit_avg,+",
578 "CDEF:stack_setattr=stack_commit,setattr_avg,+",
579 "CDEF:stack_other=stack_setattr,other_avg,+",
580 "AREA:stack_other#$HalfRed",
581 "AREA:stack_setattr#$HalfGreen",
582 "AREA:stack_commit#$HalfYellow",
583 "AREA:stack_write#$HalfGreen",
584 "AREA:stack_lookup#$HalfBlue",
585 "AREA:stack_access#$HalfMagenta",
586 "AREA:stack_getattr#$HalfCyan",
587 "AREA:stack_read#$HalfBlue",
588 "LINE1:stack_other#$FullRed:Other ",
589 'GPRINT:other_max:MAX:%5.1lf Max,',
590 'GPRINT:other_avg:AVERAGE:%5.1lf Avg,',
591 'GPRINT:other_avg:LAST:%5.1lf Last\l',
592 "LINE1:stack_setattr#$FullGreen:setattr",
593 'GPRINT:setattr_max:MAX:%5.1lf Max,',
594 'GPRINT:setattr_avg:AVERAGE:%5.1lf Avg,',
595 'GPRINT:setattr_avg:LAST:%5.1lf Last\l',
596 "LINE1:stack_commit#$FullYellow:commit ",
597 'GPRINT:commit_max:MAX:%5.1lf Max,',
598 'GPRINT:commit_avg:AVERAGE:%5.1lf Avg,',
599 'GPRINT:commit_avg:LAST:%5.1lf Last\l',
600 "LINE1:stack_write#$FullGreen:write ",
601 'GPRINT:write_max:MAX:%5.1lf Max,',
602 'GPRINT:write_avg:AVERAGE:%5.1lf Avg,',
603 'GPRINT:write_avg:LAST:%5.1lf Last\l',
604 "LINE1:stack_lookup#$FullBlue:lookup ",
605 'GPRINT:lookup_max:MAX:%5.1lf Max,',
606 'GPRINT:lookup_avg:AVERAGE:%5.1lf Avg,',
607 'GPRINT:lookup_avg:LAST:%5.1lf Last\l',
608 "LINE1:stack_access#$FullMagenta:access ",
609 'GPRINT:access_max:MAX:%5.1lf Max,',
610 'GPRINT:access_avg:AVERAGE:%5.1lf Avg,',
611 'GPRINT:access_avg:LAST:%5.1lf Last\l',
612 "LINE1:stack_getattr#$FullCyan:getattr",
613 'GPRINT:getattr_max:MAX:%5.1lf Max,',
614 'GPRINT:getattr_avg:AVERAGE:%5.1lf Avg,',
615 'GPRINT:getattr_avg:LAST:%5.1lf Last\l',
616 "LINE1:stack_read#$FullBlue:read ",
617 'GPRINT:read_max:MAX:%5.1lf Max,',
618 'GPRINT:read_avg:AVERAGE:%5.1lf Avg,',
619 'GPRINT:read_avg:LAST:%5.1lf Last\l'
622 "DEF:rbyte_avg={file}:rbytes:AVERAGE",
623 "DEF:rbyte_min={file}:rbytes:MIN",
624 "DEF:rbyte_max={file}:rbytes:MAX",
625 "DEF:wbyte_avg={file}:wbytes:AVERAGE",
626 "DEF:wbyte_min={file}:wbytes:MIN",
627 "DEF:wbyte_max={file}:wbytes:MAX",
628 'CDEF:overlap=wbyte_avg,rbyte_avg,GT,rbyte_avg,wbyte_avg,IF',
629 "AREA:wbyte_avg#$HalfGreen",
630 "AREA:rbyte_avg#$HalfBlue",
631 "AREA:overlap#$HalfBlueGreen",
632 "LINE1:wbyte_avg#$FullGreen:Write",
633 'GPRINT:wbyte_min:MIN:%5.1lf%s Min,',
634 'GPRINT:wbyte_avg:AVERAGE:%5.1lf%s Avg,',
635 'GPRINT:wbyte_max:MAX:%5.1lf%s Max,',
636 'GPRINT:wbyte_avg:LAST:%5.1lf%s Last\l',
637 "LINE1:rbyte_avg#$FullBlue:Read ",
638 'GPRINT:rbyte_min:MIN:%5.1lf%s Min,',
639 'GPRINT:rbyte_avg:AVERAGE:%5.1lf%s Avg,',
640 'GPRINT:rbyte_max:MAX:%5.1lf%s Max,',
641 'GPRINT:rbyte_avg:LAST:%5.1lf%s Last\l'
643 ping => ['DEF:ping_avg={file}:ping:AVERAGE',
644 'DEF:ping_min={file}:ping:MIN',
645 'DEF:ping_max={file}:ping:MAX',
646 "AREA:ping_max#$HalfBlue",
647 "AREA:ping_min#$Canvas",
648 "LINE1:ping_avg#$FullBlue:Ping",
649 'GPRINT:ping_min:MIN:%4.1lf ms Min,',
650 'GPRINT:ping_avg:AVERAGE:%4.1lf ms Avg,',
651 'GPRINT:ping_max:MAX:%4.1lf ms Max,',
652 'GPRINT:ping_avg:LAST:%4.1lf ms Last'],
654 "DEF:running_avg={file}:running:AVERAGE",
655 "DEF:running_min={file}:running:MIN",
656 "DEF:running_max={file}:running:MAX",
657 "DEF:sleeping_avg={file}:sleeping:AVERAGE",
658 "DEF:sleeping_min={file}:sleeping:MIN",
659 "DEF:sleeping_max={file}:sleeping:MAX",
660 "DEF:zombies_avg={file}:zombies:AVERAGE",
661 "DEF:zombies_min={file}:zombies:MIN",
662 "DEF:zombies_max={file}:zombies:MAX",
663 "DEF:stopped_avg={file}:stopped:AVERAGE",
664 "DEF:stopped_min={file}:stopped:MIN",
665 "DEF:stopped_max={file}:stopped:MAX",
666 "DEF:paging_avg={file}:paging:AVERAGE",
667 "DEF:paging_min={file}:paging:MIN",
668 "DEF:paging_max={file}:paging:MAX",
669 "DEF:blocked_avg={file}:blocked:AVERAGE",
670 "DEF:blocked_min={file}:blocked:MIN",
671 "DEF:blocked_max={file}:blocked:MAX",
672 'CDEF:paging_acc=sleeping_avg,running_avg,stopped_avg,zombies_avg,blocked_avg,paging_avg,+,+,+,+,+',
673 'CDEF:blocked_acc=sleeping_avg,running_avg,stopped_avg,zombies_avg,blocked_avg,+,+,+,+',
674 'CDEF:zombies_acc=sleeping_avg,running_avg,stopped_avg,zombies_avg,+,+,+',
675 'CDEF:stopped_acc=sleeping_avg,running_avg,stopped_avg,+,+',
676 'CDEF:running_acc=sleeping_avg,running_avg,+',
677 'CDEF:sleeping_acc=sleeping_avg',
678 "AREA:paging_acc#$HalfYellow",
679 "AREA:blocked_acc#$HalfCyan",
680 "AREA:zombies_acc#$HalfRed",
681 "AREA:stopped_acc#$HalfMagenta",
682 "AREA:running_acc#$HalfGreen",
683 "AREA:sleeping_acc#$HalfBlue",
684 "LINE1:paging_acc#$FullYellow:Paging ",
685 'GPRINT:paging_min:MIN:%5.1lf Min,',
686 'GPRINT:paging_avg:AVERAGE:%5.1lf Average,',
687 'GPRINT:paging_max:MAX:%5.1lf Max,',
688 'GPRINT:paging_avg:LAST:%5.1lf Last\l',
689 "LINE1:blocked_acc#$FullCyan:Blocked ",
690 'GPRINT:blocked_min:MIN:%5.1lf Min,',
691 'GPRINT:blocked_avg:AVERAGE:%5.1lf Average,',
692 'GPRINT:blocked_max:MAX:%5.1lf Max,',
693 'GPRINT:blocked_avg:LAST:%5.1lf Last\l',
694 "LINE1:zombies_acc#$FullRed:Zombies ",
695 'GPRINT:zombies_min:MIN:%5.1lf Min,',
696 'GPRINT:zombies_avg:AVERAGE:%5.1lf Average,',
697 'GPRINT:zombies_max:MAX:%5.1lf Max,',
698 'GPRINT:zombies_avg:LAST:%5.1lf Last\l',
699 "LINE1:stopped_acc#$FullMagenta:Stopped ",
700 'GPRINT:stopped_min:MIN:%5.1lf Min,',
701 'GPRINT:stopped_avg:AVERAGE:%5.1lf Average,',
702 'GPRINT:stopped_max:MAX:%5.1lf Max,',
703 'GPRINT:stopped_avg:LAST:%5.1lf Last\l',
704 "LINE1:running_acc#$FullGreen:Running ",
705 'GPRINT:running_min:MIN:%5.1lf Min,',
706 'GPRINT:running_avg:AVERAGE:%5.1lf Average,',
707 'GPRINT:running_max:MAX:%5.1lf Max,',
708 'GPRINT:running_avg:LAST:%5.1lf Last\l',
709 "LINE1:sleeping_acc#$FullBlue:Sleeping",
710 'GPRINT:sleeping_min:MIN:%5.1lf Min,',
711 'GPRINT:sleeping_avg:AVERAGE:%5.1lf Average,',
712 'GPRINT:sleeping_max:MAX:%5.1lf Max,',
713 'GPRINT:sleeping_avg:LAST:%5.1lf Last\l'
716 'DEF:used_avg={file}:used:AVERAGE',
717 'DEF:used_min={file}:used:MIN',
718 'DEF:used_max={file}:used:MAX',
719 'DEF:free_avg={file}:free:AVERAGE',
720 'DEF:free_min={file}:free:MIN',
721 'DEF:free_max={file}:free:MAX',
722 'DEF:cach_avg={file}:cached:AVERAGE',
723 'DEF:cach_min={file}:cached:MIN',
724 'DEF:cach_max={file}:cached:MAX',
725 'DEF:resv_avg={file}:resv:AVERAGE',
726 'DEF:resv_min={file}:resv:MIN',
727 'DEF:resv_max={file}:resv:MAX',
728 'CDEF:cach_avg_notnull=cach_avg,UN,0,cach_avg,IF',
729 'CDEF:resv_avg_notnull=resv_avg,UN,0,resv_avg,IF',
730 'CDEF:used_acc=used_avg',
731 'CDEF:resv_acc=used_acc,resv_avg_notnull,+',
732 'CDEF:cach_acc=resv_acc,cach_avg_notnull,+',
733 'CDEF:free_acc=cach_acc,free_avg,+',
734 "AREA:free_acc#$HalfGreen",
735 "AREA:cach_acc#$HalfBlue",
736 "AREA:resv_acc#$HalfYellow",
737 "AREA:used_acc#$HalfRed",
738 "LINE1:free_acc#$FullGreen:Free ",
739 'GPRINT:free_min:MIN:%5.1lf%s Min,',
740 'GPRINT:free_avg:AVERAGE:%5.1lf%s Avg,',
741 'GPRINT:free_max:MAX:%5.1lf%s Max,',
742 'GPRINT:free_avg:LAST:%5.1lf%s Last\n',
743 "LINE1:cach_acc#$FullBlue:Cached ",
744 'GPRINT:cach_min:MIN:%5.1lf%s Min,',
745 'GPRINT:cach_avg:AVERAGE:%5.1lf%s Avg,',
746 'GPRINT:cach_max:MAX:%5.1lf%s Max,',
747 'GPRINT:cach_avg:LAST:%5.1lf%s Last\l',
748 "LINE1:resv_acc#$FullYellow:Reserved",
749 'GPRINT:resv_min:MIN:%5.1lf%s Min,',
750 'GPRINT:resv_avg:AVERAGE:%5.1lf%s Avg,',
751 'GPRINT:resv_max:MAX:%5.1lf%s Max,',
752 'GPRINT:resv_avg:LAST:%5.1lf%s Last\n',
753 "LINE1:used_acc#$FullRed:Used ",
754 'GPRINT:used_min:MIN:%5.1lf%s Min,',
755 'GPRINT:used_avg:AVERAGE:%5.1lf%s Avg,',
756 'GPRINT:used_max:MAX:%5.1lf%s Max,',
757 'GPRINT:used_avg:LAST:%5.1lf%s Last\l'
760 'DEF:temp_avg={file}:value:AVERAGE',
761 'DEF:temp_min={file}:value:MIN',
762 'DEF:temp_max={file}:value:MAX',
763 "AREA:temp_max#$HalfBlue",
764 "AREA:temp_min#$Canvas",
765 "LINE1:temp_avg#$FullBlue:Value",
766 'GPRINT:temp_min:MIN:%4.1lf Min,',
767 'GPRINT:temp_avg:AVERAGE:%4.1lf Avg,',
768 'GPRINT:temp_max:MAX:%4.1lf Max,',
769 'GPRINT:temp_avg:LAST:%4.1lf Last\l'
772 'DEF:avg={file}:timeleft:AVERAGE',
773 'DEF:min={file}:timeleft:MIN',
774 'DEF:max={file}:timeleft:MAX',
775 "AREA:max#$HalfBlue",
777 "LINE1:avg#$FullBlue:Time left [min]",
778 'GPRINT:min:MIN:%5.1lf%s Min,',
779 'GPRINT:avg:AVERAGE:%5.1lf%s Avg,',
780 'GPRINT:max:MAX:%5.1lf%s Max,',
781 'GPRINT:avg:LAST:%5.1lf%s Last\l'
783 time_offset => [ # NTPd
784 'DEF:s_avg={file}:seconds:AVERAGE',
785 'DEF:s_min={file}:seconds:MIN',
786 'DEF:s_max={file}:seconds:MAX',
787 "AREA:s_max#$HalfBlue",
788 "AREA:s_min#$Canvas",
789 "LINE1:s_avg#$FullBlue:{inst}",
790 'GPRINT:s_min:MIN:%7.3lf%s Min,',
791 'GPRINT:s_avg:AVERAGE:%7.3lf%s Avg,',
792 'GPRINT:s_max:MAX:%7.3lf%s Max,',
793 'GPRINT:s_avg:LAST:%7.3lf%s Last'
795 traffic => ['DEF:out_min_raw={file}:outgoing:MIN',
796 'DEF:out_avg_raw={file}:outgoing:AVERAGE',
797 'DEF:out_max_raw={file}:outgoing:MAX',
798 'DEF:inc_min_raw={file}:incoming:MIN',
799 'DEF:inc_avg_raw={file}:incoming:AVERAGE',
800 'DEF:inc_max_raw={file}:incoming:MAX',
801 'CDEF:out_min=out_min_raw,8,*',
802 'CDEF:out_avg=out_avg_raw,8,*',
803 'CDEF:out_max=out_max_raw,8,*',
804 'CDEF:inc_min=inc_min_raw,8,*',
805 'CDEF:inc_avg=inc_avg_raw,8,*',
806 'CDEF:inc_max=inc_max_raw,8,*',
807 'CDEF:overlap=out_avg,inc_avg,GT,inc_avg,out_avg,IF',
808 'CDEF:mytime=out_avg_raw,TIME,TIME,IF',
809 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
810 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
811 'CDEF:out_avg_sample=out_avg_raw,UN,0,out_avg_raw,IF,sample_len,*',
812 'CDEF:out_avg_sum=PREV,UN,0,PREV,IF,out_avg_sample,+',
813 'CDEF:inc_avg_sample=inc_avg_raw,UN,0,inc_avg_raw,IF,sample_len,*',
814 'CDEF:inc_avg_sum=PREV,UN,0,PREV,IF,inc_avg_sample,+',
815 "AREA:out_avg#$HalfGreen",
816 "AREA:inc_avg#$HalfBlue",
817 "AREA:overlap#$HalfBlueGreen",
818 "LINE1:out_avg#$FullGreen:Outgoing",
819 'GPRINT:out_avg:AVERAGE:%5.1lf%s Avg,',
820 'GPRINT:out_max:MAX:%5.1lf%s Max,',
821 'GPRINT:out_avg:LAST:%5.1lf%s Last',
822 'GPRINT:out_avg_sum:LAST:(ca. %5.1lf%sB Total)\l',
823 "LINE1:inc_avg#$FullBlue:Incoming",
824 #'GPRINT:inc_min:MIN:%5.1lf %s Min,',
825 'GPRINT:inc_avg:AVERAGE:%5.1lf%s Avg,',
826 'GPRINT:inc_max:MAX:%5.1lf%s Max,',
827 'GPRINT:inc_avg:LAST:%5.1lf%s Last',
828 'GPRINT:inc_avg_sum:LAST:(ca. %5.1lf%sB Total)\l'
831 'DEF:cpufreq_avg={file}:value:AVERAGE',
832 'DEF:cpufreq_min={file}:value:MIN',
833 'DEF:cpufreq_max={file}:value:MAX',
834 "AREA:cpufreq_max#$HalfBlue",
835 "AREA:cpufreq_min#$Canvas",
836 "LINE1:cpufreq_avg#$FullBlue:Frequency",
837 'GPRINT:cpufreq_min:MIN:%5.1lf%s Min,',
838 'GPRINT:cpufreq_avg:AVERAGE:%5.1lf%s Avg,',
839 'GPRINT:cpufreq_max:MAX:%5.1lf%s Max,',
840 'GPRINT:cpufreq_avg:LAST:%5.1lf%s Last\l'
843 'DEF:users_avg={file}:users:AVERAGE',
844 'DEF:users_min={file}:users:MIN',
845 'DEF:users_max={file}:users:MAX',
846 "AREA:users_max#$HalfBlue",
847 "AREA:users_min#$Canvas",
848 "LINE1:users_avg#$FullBlue:Users",
849 'GPRINT:users_min:MIN:%4.1lf Min,',
850 'GPRINT:users_avg:AVERAGE:%4.1lf Average,',
851 'GPRINT:users_max:MAX:%4.1lf Max,',
852 'GPRINT:users_avg:LAST:%4.1lf Last\l'
855 'DEF:avg={file}:voltage:AVERAGE',
856 'DEF:min={file}:voltage:MIN',
857 'DEF:max={file}:voltage:MAX',
858 "AREA:max#$HalfBlue",
860 "LINE1:avg#$FullBlue:Voltage",
861 'GPRINT:min:MIN:%5.1lf%sV Min,',
862 'GPRINT:avg:AVERAGE:%5.1lf%sV Avg,',
863 'GPRINT:max:MAX:%5.1lf%sV Max,',
864 'GPRINT:avg:LAST:%5.1lf%sV Last\l'
867 "DEF:total_avg={file}:total:AVERAGE",
868 "DEF:total_min={file}:total:MIN",
869 "DEF:total_max={file}:total:MAX",
870 "DEF:running_avg={file}:running:AVERAGE",
871 "DEF:running_min={file}:running:MIN",
872 "DEF:running_max={file}:running:MAX",
873 "DEF:uninterruptible_avg={file}:uninterruptible:AVERAGE",
874 "DEF:uninterruptible_min={file}:uninterruptible:MIN",
875 "DEF:uninterruptible_max={file}:uninterruptible:MAX",
876 "DEF:onhold_avg={file}:onhold:AVERAGE",
877 "DEF:onhold_min={file}:onhold:MIN",
878 "DEF:onhold_max={file}:onhold:MAX",
879 "LINE1:total_avg#$FullYellow:Total ",
880 'GPRINT:total_min:MIN:%5.1lf Min,',
881 'GPRINT:total_avg:AVERAGE:%5.1lf Avg.,',
882 'GPRINT:total_max:MAX:%5.1lf Max,',
883 'GPRINT:total_avg:LAST:%5.1lf Last\l',
884 "LINE1:running_avg#$FullRed:Running ",
885 'GPRINT:running_min:MIN:%5.1lf Min,',
886 'GPRINT:running_avg:AVERAGE:%5.1lf Avg.,',
887 'GPRINT:running_max:MAX:%5.1lf Max,',
888 'GPRINT:running_avg:LAST:%5.1lf Last\l',
889 "LINE1:uninterruptible_avg#$FullGreen:Unintr ",
890 'GPRINT:uninterruptible_min:MIN:%5.1lf Min,',
891 'GPRINT:uninterruptible_avg:AVERAGE:%5.1lf Avg.,',
892 'GPRINT:uninterruptible_max:MAX:%5.1lf Max,',
893 'GPRINT:uninterruptible_avg:LAST:%5.1lf Last\l',
894 "LINE1:onhold_avg#$FullBlue:Onhold ",
895 'GPRINT:onhold_min:MIN:%5.1lf Min,',
896 'GPRINT:onhold_avg:AVERAGE:%5.1lf Avg.,',
897 'GPRINT:onhold_max:MAX:%5.1lf Max,',
898 'GPRINT:onhold_avg:LAST:%5.1lf Last\l'
901 'DEF:vm_avg={file}:vm:AVERAGE',
902 'DEF:vm_min={file}:vm:MIN',
903 'DEF:vm_max={file}:vm:MAX',
904 'DEF:vml_avg={file}:vml:AVERAGE',
905 'DEF:vml_min={file}:vml:MIN',
906 'DEF:vml_max={file}:vml:MAX',
907 'DEF:rss_avg={file}:rss:AVERAGE',
908 'DEF:rss_min={file}:rss:MIN',
909 'DEF:rss_max={file}:rss:MAX',
910 'DEF:anon_avg={file}:anon:AVERAGE',
911 'DEF:anon_min={file}:anon:MIN',
912 'DEF:anon_max={file}:anon:MAX',
913 "LINE1:vm_avg#$FullYellow:VM ",
914 'GPRINT:vm_min:MIN:%5.1lf%s Min,',
915 'GPRINT:vm_avg:AVERAGE:%5.1lf%s Avg.,',
916 'GPRINT:vm_max:MAX:%5.1lf%s Avg.,',
917 'GPRINT:vm_avg:LAST:%5.1lf%s Last\l',
918 "LINE1:vml_avg#$FullRed:Locked ",
919 'GPRINT:vml_min:MIN:%5.1lf%s Min,',
920 'GPRINT:vml_avg:AVERAGE:%5.1lf%s Avg.,',
921 'GPRINT:vml_max:MAX:%5.1lf%s Avg.,',
922 'GPRINT:vml_avg:LAST:%5.1lf%s Last\l',
923 "LINE1:rss_avg#$FullGreen:RSS ",
924 'GPRINT:rss_min:MIN:%5.1lf%s Min,',
925 'GPRINT:rss_avg:AVERAGE:%5.1lf%s Avg.,',
926 'GPRINT:rss_max:MAX:%5.1lf%s Avg.,',
927 'GPRINT:rss_avg:LAST:%5.1lf%s Last\l',
928 "LINE1:anon_avg#$FullBlue:Anon. ",
929 'GPRINT:anon_min:MIN:%5.1lf%s Min,',
930 'GPRINT:anon_avg:AVERAGE:%5.1lf%s Avg.,',
931 'GPRINT:anon_max:MAX:%5.1lf%s Avg.,',
932 'GPRINT:anon_avg:LAST:%5.1lf%s Last\l',
935 'DEF:proc_avg={file}:total:AVERAGE',
936 'DEF:proc_min={file}:total:MIN',
937 'DEF:proc_max={file}:total:MAX',
938 "AREA:proc_max#$HalfBlue",
939 "AREA:proc_min#$Canvas",
940 "LINE1:proc_avg#$FullBlue:Processes",
941 'GPRINT:proc_min:MIN:%4.1lf Min,',
942 'GPRINT:proc_avg:AVERAGE:%4.1lf Avg.,',
943 'GPRINT:proc_max:MAX:%4.1lf Max,',
944 'GPRINT:proc_avg:LAST:%4.1lf Last\l'
947 $GraphDefs->{'disk'} = $GraphDefs->{'partition'};
948 $GraphDefs->{'if_errors'} = $GraphDefs->{'if_packets'};
949 $GraphDefs->{'meminfo'} = $GraphDefs->{'memory'};
950 $GraphDefs->{'sensors'} = $GraphDefs->{'temperature'};
952 $GraphDefs->{'delay'} = $GraphDefs->{'time_offset'};
953 $GraphDefs->{'time_dispersion'} = $GraphDefs->{'time_offset'};
958 apache_bytes => ['-t', 'apache traffic', '-v', 'Bit/s'],
959 apache_requests => ['-t', 'apache requests', '-v', 'Requests/s'],
960 apache_scoreboard => ['-t', 'apache scoreboard {inst}', '-v', 'Processes'],
961 charge => ['-t', '{host} charge', '-v', 'Ampere hours'],
962 charge_percent => ['-t', '{host} charge', '-v', 'Percent'],
963 cpu => ['-t', '{host} cpu{inst} usage', '-v', 'Percent', '-l', '0'],
964 cpufreq => ['-t', '{host} cpu{inst} usage', '-v', 'Mhz'],
965 current => ['-t', '{host} current', '-v', 'Ampere'],
966 #disk => ['-t', '{host} disk {inst} IO wait', '-v', 'Seconds'],
967 delay => ['-t', 'NTPd peer delay ({inst})', '-v', 'Seconds'],
968 df => ['-t', '{host}:{inst} usage', '-v', 'Percent', '-l', '0'],
969 disk => ['-t', '{host} disk {inst} usage', '-v', 'Byte/s'],
970 fanspeed => ['-t', '{host} fanspeed {inst}', '-v', 'rpm'],
971 frequency_offset => ['-t', 'NTPd frequency offset ({inst})', '-v', 'Parts per million'],
972 hddtemp => ['-t', '{host} hdd temperature {inst}', '-v', '°Celsius'],
973 if_errors => ['-t', '{host} {inst} errors', '-v', 'Errors/s'],
974 if_packets => ['-t', '{host} {inst} packets', '-v', 'Packets/s'],
975 load => ['-t', '{host} load average', '-v', 'System load', '-X', '0'],
976 load_percent => ['-t', '{host} load', '-v', 'Percent'],
977 mails => ['-t', '{host} mail count', '-v', 'Amount', '-X', '0'],
978 memory => ['-t', '{host} memory usage', '-v', 'Bytes', '-b', '1024', '-l', '0'],
979 mysql_commands => ['-t', 'mysql command {inst}', '-v', 'Issues/s' ],
980 mysql_handler => ['-t', 'mysql handler {inst}', '-v', 'Issues/s' ],
981 mysql_qcache => ['-t', 'mysql query cache', '-v', 'Queries/s' ],
982 mysql_threads => ['-t', 'mysql threads', '-v', 'Threads' ],
983 nfs3_procedures => ['-t', '{host} NFSv3 {inst} procedures', '-v', 'Procedures/s' ],
984 partition => ['-t', '{host} partition {inst} usage', '-v', 'Byte/s'],
985 ping => ['-t', '{host} ping to {inst}', '-v', 'ms'],
986 processes => ['-t', '{host} processes', '-v', 'Processes'],
987 sensors => ['-t', '{host} sensor {inst}', '-v', '°Celsius'],
988 swap => ['-t', '{host} swap usage', '-v', 'Bytes', '-b', '1024', '-l', '0'],
989 temperature => ['-t', '{host} temperature {inst}', '-v', '°Celsius'],
990 timeleft => ['-t', '{host} UPS time left', '-v', 'Time [min]'],
991 time_offset => ['-t', 'NTPd time offset ({inst})', '-v', 'Seconds'],
992 time_dispersion => ['-t', 'NTPd time dispersion ({inst})', '-v', 'Seconds'],
993 traffic => ['-t', '{host} {inst} traffic', '-v', 'Bit/s'],
994 users => ['-t', '{host} users', '-v', 'Users'],
995 voltage => ['-t', '{host} voltage', '-v', 'Volts'],
996 vs_threads => ['-t', '{host} threads', '-v', 'Threads'],
997 vs_memory => ['-t', '{host} memory usage', '-v', 'Bytes'],
998 vs_processes => ['-t', '{host} processes', '-v', 'Processes'],
1003 apache_scoreboard => \&output_graph_apache_scoreboard,
1004 cpu => \&output_graph_cpu,
1010 mysql_commands => \&output_graph_mysql_commands,
1011 mysql_handler => \&output_graph_mysql_handler,
1013 ping => \&output_graph_ping,
1020 if (defined ($ENV{'GATEWAY_INTERFACE'}))
1022 @Info = ($ENV{'PATH_INFO'} || '') =~ m#([\w\-\.]+)#g;
1029 parse_pathinfo (@Info);
1042 sub output_graph_cpu
1052 "DEF:user_avg_$_=$AbsDir/cpu-$_.rrd:user:AVERAGE",
1053 "DEF:user_min_$_=$AbsDir/cpu-$_.rrd:user:MIN",
1054 "DEF:user_max_$_=$AbsDir/cpu-$_.rrd:user:MAX",
1055 "DEF:nice_avg_$_=$AbsDir/cpu-$_.rrd:nice:AVERAGE",
1056 "DEF:nice_min_$_=$AbsDir/cpu-$_.rrd:nice:MIN",
1057 "DEF:nice_max_$_=$AbsDir/cpu-$_.rrd:nice:MAX",
1058 "DEF:syst_avg_$_=$AbsDir/cpu-$_.rrd:syst:AVERAGE",
1059 "DEF:syst_min_$_=$AbsDir/cpu-$_.rrd:syst:MIN",
1060 "DEF:syst_max_$_=$AbsDir/cpu-$_.rrd:syst:MAX",
1061 "DEF:wait_avg_$_=$AbsDir/cpu-$_.rrd:wait:AVERAGE",
1062 "DEF:wait_min_$_=$AbsDir/cpu-$_.rrd:wait:MIN",
1063 "DEF:wait_max_$_=$AbsDir/cpu-$_.rrd:wait:MAX");
1066 for (qw(user nice syst wait))
1071 my $default_value = ($def eq 'user' or $def eq 'syst') ? 'UNKN' : '0';
1073 for (qw(avg min max))
1079 push (@ret, "CDEF:${def}_${cf}_notnull_${_}=${def}_${cf}_${_},UN,0,${def}_${cf}_${_},IF");
1080 push (@ret, "CDEF:${def}_${cf}_defined_${_}=${def}_${cf}_${_},UN,0,1,IF");
1083 $cdef = "CDEF:${def}_${cf}_num=" . join (',', map { "${def}_${cf}_defined_${_}" } (@inst));
1084 $cdef .= ',+' x (scalar (@inst) - 1);
1087 $cdef = "CDEF:${def}_${cf}=${def}_${cf}_num," . join (',', map { "${def}_${cf}_notnull_${_}" } (@inst));
1088 $cdef .= ',+' x (scalar (@inst) - 1);
1089 $cdef .= ",${def}_${cf}_num,${def}_${cf}_num,1,IF,/,$default_value,IF";
1091 push (@ret, "CDEF:${def}_${cf}_notnull=${def}_${cf},UN,0,${def}_${cf},IF");
1096 "CDEF:nice_acc=syst_avg_notnull,wait_avg_notnull,user_avg_notnull,nice_avg_notnull,+,+,+",
1097 "CDEF:user_acc=syst_avg_notnull,wait_avg_notnull,user_avg_notnull,+,+",
1098 "CDEF:wait_acc=syst_avg_notnull,wait_avg_notnull,+",
1099 "CDEF:syst_acc=syst_avg_notnull");
1101 push (@ret, grep { $_ !~ m/^C?DEF/ } (@{$GraphDefs->{'cpu'}}));
1106 sub output_graph_apache_scoreboard
1113 my @colors = get_n_colors (scalar (@inst));
1115 for (my $i = 0; $i < scalar (@inst); $i++)
1117 my $inst = $inst[$i];
1119 "DEF:avg_$i=$AbsDir/apache_scoreboard-$inst.rrd:count:AVERAGE",
1120 "DEF:min_$i=$AbsDir/apache_scoreboard-$inst.rrd:count:MIN",
1121 "DEF:max_$i=$AbsDir/apache_scoreboard-$inst.rrd:count:MAX");
1124 for (my $i = 0; $i < scalar (@inst); $i++)
1126 my $inst = $inst[$i];
1127 my $color = $colors[$i];
1129 if (length ($inst) > 15)
1131 $inst = substr ($inst, 0, 12) . '...';
1135 $inst = sprintf ('%-15s', $inst);
1139 "LINE1:avg_$i#$color:$inst",
1140 "GPRINT:min_$i:MIN:%6.2lf Min,",
1141 "GPRINT:avg_$i:AVERAGE:%6.2lf Avg,",
1142 "GPRINT:max_$i:MAX:%6.2lf Max,",
1143 "GPRINT:avg_$i:LAST:%6.2lf Last\\l");
1149 sub output_graph_ping
1156 my @colors = get_n_colors (scalar (@inst));
1158 for (my $i = 0; $i < scalar (@inst); $i++)
1160 my $inst = $inst[$i];
1162 "DEF:avg_$i=$AbsDir/ping-$inst.rrd:ping:AVERAGE",
1163 "DEF:min_$i=$AbsDir/ping-$inst.rrd:ping:MIN",
1164 "DEF:max_$i=$AbsDir/ping-$inst.rrd:ping:MAX");
1167 for (my $i = 0; $i < scalar (@inst); $i++)
1169 my $inst = $inst[$i];
1170 my $color = $colors[$i];
1172 if (length ($inst) > 15)
1174 $inst = substr ($inst, 0, 12) . '...';
1178 $inst = sprintf ('%-15s', $inst);
1182 "LINE1:avg_$i#$color:$inst",
1183 "GPRINT:min_$i:MIN:%4.1lf ms Min,",
1184 "GPRINT:avg_$i:AVERAGE:%4.1lf ms Avg,",
1185 "GPRINT:max_$i:MAX:%4.1lf ms Max,",
1186 "GPRINT:avg_$i:LAST:%4.1lf ms Last\\l");
1192 sub output_graph_mysql_commands
1199 my @colors = get_n_colors (scalar (@inst));
1201 for (my $i = 0; $i < scalar (@inst); $i++)
1203 my $inst = $inst[$i];
1205 "DEF:avg_$i=$AbsDir/mysql_commands-$inst.rrd:value:AVERAGE",
1206 "DEF:min_$i=$AbsDir/mysql_commands-$inst.rrd:value:MIN",
1207 "DEF:max_$i=$AbsDir/mysql_commands-$inst.rrd:value:MAX");
1210 for (my $i = 0; $i < scalar (@inst); $i++)
1212 my $inst = $inst[$i];
1213 my $color = $colors[$i];
1215 if (length ($inst) > 18)
1217 $inst = substr ($inst, 0, 15) . '...';
1221 $inst = sprintf ('%-18s', $inst);
1225 "LINE1:avg_$i#$color:$inst",
1226 "GPRINT:min_$i:MIN:%6.1lf Min,",
1227 "GPRINT:avg_$i:AVERAGE:%6.1lf Avg,",
1228 "GPRINT:max_$i:MAX:%6.1lf Max,",
1229 "GPRINT:avg_$i:LAST:%6.1lf Last\\l");
1235 sub output_graph_mysql_handler
1242 my @colors = get_n_colors (scalar (@inst));
1244 for (my $i = 0; $i < scalar (@inst); $i++)
1246 my $inst = $inst[$i];
1248 "DEF:avg_$i=$AbsDir/mysql_handler-$inst.rrd:value:AVERAGE",
1249 "DEF:min_$i=$AbsDir/mysql_handler-$inst.rrd:value:MIN",
1250 "DEF:max_$i=$AbsDir/mysql_handler-$inst.rrd:value:MAX");
1253 for (my $i = 0; $i < scalar (@inst); $i++)
1255 my $inst = $inst[$i];
1256 my $color = $colors[$i];
1258 if (length ($inst) > 18)
1260 $inst = substr ($inst, 0, 15) . '...';
1264 $inst = sprintf ('%-18s', $inst);
1268 "LINE1:avg_$i#$color:$inst",
1269 "GPRINT:min_$i:MIN:%6.1lf Min,",
1270 "GPRINT:avg_$i:AVERAGE:%6.1lf Avg,",
1271 "GPRINT:max_$i:MAX:%6.1lf Max,",
1272 "GPRINT:avg_$i:LAST:%6.1lf Last\\l");
1280 die unless (defined ($GraphDefs->{$Type}));
1284 my $file = $AbsDir . '/';
1285 my $files = get_all_files ($AbsDir);
1290 if ($RelDir =~ m#([^/]+)$#)
1296 $host = $Config->{'HostName'};
1302 if ($TimeSpan =~ m/(\d+)/)
1304 $TimeSpan = -1 * int ($1);
1308 my %t = (hour => -3600, day => -86400, week => -604800, month => -2678400, year => -31622400);
1309 die unless (defined ($t{$TimeSpan}));
1310 $TimeSpan = $t{$TimeSpan};
1313 if (scalar (@{$files->{$Type}}) == 1)
1315 $Inst = $files->{$Type}[0];
1318 #push (@cmd, '-', '-a', 'PNG', '-s', $TimeSpan, '-w', 800, '-h', 150);
1319 push (@cmd, '-', '-a', 'PNG', '-s', $TimeSpan);
1320 push (@cmd, @{$GraphArgs->{$Type}}) if (defined ($GraphArgs->{$Type}));
1322 for (qw(Back ShadeA ShadeB Font Canvas Grid MGrid Frame Arrow))
1324 push (@cmd, '-c', uc ($_) . '#' . $Config->{'Colors'}{$_});
1327 if ((length ($Inst) == 0) and (ref ($GraphMulti->{$Type}) eq 'CODE'))
1329 push (@cmd, $GraphMulti->{$Type}->(@{$files->{$Type}}));
1333 if (length ("$Inst"))
1335 $file .= "$Type-$Inst.rrd";
1339 $file .= "$Type.rrd";
1342 die ("File not found: $file") unless (-e $file);
1344 push (@cmd, @{$GraphDefs->{$Type}});
1349 $_ =~ s/{file}/$file/g;
1350 $_ =~ s/{host}/$host/g;
1351 $_ =~ s/{inst}/$Inst/g;
1352 $_ =~ s/{type}/$Type/g;
1357 print STDOUT <<HEADER if (defined ($ENV{'GATEWAY_INTERFACE'}));
1358 Content-Type: image/png
1359 Cache-Control: no-cache
1366 open ($fh, ">/tmp/collection.log") or die ("open: $!");
1367 flock ($fh, LOCK_EX) or die ("flock: $!");
1369 print $fh join ("\n\t", @cmd) . "\n";
1376 die ('RRDs::error: ' . RRDs::error ()) if (RRDs::error ());
1381 my $files = get_all_files ($AbsDir);
1382 my $dirs = get_all_dirs ($AbsDir);
1384 print STDOUT <<HEADER if (defined ($ENV{'GATEWAY_INTERFACE'}));
1385 Content-Type: text/html
1386 Cache-Control: no-cache
1390 <title>Collection: $RelDir</title>
1391 <style type="text/css">
1392 img { border: none; display: block; }
1399 my $MySelf = defined ($ENV{'GATEWAY_INTERFACE'}) ? $ENV{'SCRIPT_NAME'} : $0;
1401 if ((length ($Type) != 0) and (length ($Inst) == 0) and (ref ($GraphMulti->{$Type}) eq 'CODE') and (scalar (@{$files->{$Type}}) > 1))
1403 print qq(\t\t<div><a href="$MySelf$RelDir">Go up</a></div>\n);
1406 for (@{$files->{$Type}})
1408 print qq(\t\t\t<li><a href="$MySelf$RelDir/$Type/$_">$_</a></li>\n);
1414 <div><img src="$MySelf$RelDir/$Type/hour" /></div>
1416 <div><img src="$MySelf$RelDir/$Type/day" /></div>
1418 <div><img src="$MySelf$RelDir/$Type/week" /></div>
1420 <div><img src="$MySelf$RelDir/$Type/month" /></div>
1422 <div><img src="$MySelf$RelDir/$Type/year" /></div>
1425 elsif (length ($Type) != 0)
1427 my $ext = length ($Inst) ? "$Type/$Inst" : $Type;
1429 if ((ref ($GraphMulti->{$Type}) eq 'CODE') and (scalar (@{$files->{$Type}}) > 1))
1431 print qq(<div><a href="$MySelf$RelDir/$Type">Go up</a></div>\n);
1435 print qq(<div><a href="$MySelf$RelDir">Go up</a></div>\n);
1440 <div><img src="$MySelf$RelDir/$ext/hour" /></div>
1442 <div><img src="$MySelf$RelDir/$ext/day" /></div>
1444 <div><img src="$MySelf$RelDir/$ext/week" /></div>
1446 <div><img src="$MySelf$RelDir/$ext/month" /></div>
1448 <div><img src="$MySelf$RelDir/$ext/year" /></div>
1455 my ($up) = $RelDir =~ m#(.*)/[^/]+$#;
1456 print qq(\t\t<div><a href="$MySelf$up">Go up</a></div>\n);
1464 print qq(<li>$AbsDir/<a href="$MySelf$RelDir/$_">$_</a></li>\n);
1469 for (sort (keys %$files))
1473 if (ref ($GraphMulti->{$type}) eq 'CODE')
1475 print qq(\t\t<a href="$MySelf$RelDir/$type" />),
1476 qq(<img src="$MySelf$RelDir/$type/day" /></a>\n);
1480 for (@{$files->{$type}})
1486 print qq(\t\t<a href="$MySelf$RelDir/$type/$inst" />),
1487 qq(<img src="$MySelf$RelDir/$type/$inst/day" /></a>\n);
1491 print qq(\t\t<a href="$MySelf$RelDir/$type" />),
1492 qq(<img src="$MySelf$RelDir/$type/day" /></a>\n);
1498 print STDOUT <<FOOTER if (defined ($ENV{'GATEWAY_INTERFACE'}));
1506 my $files = get_all_files ();
1508 print STDOUT <<HEADER if (defined ($ENV{'GATEWAY_INTERFACE'}));
1509 Content-Type: text/xml
1510 Cache-Control: no-cache
1513 print STDOUT pl2xml ($files);
1518 my $file = @_ ? shift : '/etc/collection.conf';
1522 # if (open ($fh, "< $file"))
1530 # $conf = xml2pl ($xml);
1550 FullRed => 'FF0000',
1551 FullBlue => '0000FF',
1552 FullGreen => '00E000',
1553 FullYellow => 'F0A000',
1554 FullCyan => '00A0FF',
1555 FullMagenta => 'A000FF',
1557 HalfRed => 'F8B8B8',
1558 HalfBlue => 'B8B8F8',
1559 HalfGreen => 'B8F0B8',
1560 HalfYellow => 'F4F4B8'
1562 Directory => '/var/lib/collectd',
1563 HostName => (defined ($ENV{'SERVER_NAME'}) ? $ENV{'SERVER_NAME'} : 'localhost')
1576 $AbsDir = $Config->{'Directory'};
1579 while (@info and -d $AbsDir . '/' . $info[0])
1581 my $new = shift (@info);
1582 next if ($new =~ m/^\./);
1584 $AbsDir .= '/' . $new;
1585 $RelDir .= '/' . $new;
1592 confess ("parse_pathinfo: too many elements in pathinfo") if (scalar (@info) > 3);
1593 return unless (@info);
1595 $Type = shift (@info);
1596 return unless (@info);
1598 if ($info[-1] =~ m/^(hour|day|week|month|year)$/i)
1600 $TimeSpan = pop (@info);
1603 $Inst = shift (@info) if (@info);
1605 confess ("unrecognized elements in pathinfo") if (@info);
1610 my $dir = @_ ? shift : $Config->{'Directory'};
1614 if (opendir ($dh, $dir))
1616 while (my $thing = readdir ($dh))
1618 next if ($thing =~ m/^\./);
1623 if ($thing =~ m/^(\w+)-([\w\-\.]+)\.rrd$/)
1628 elsif ($thing =~ m/^(\w+)\.rrd$/)
1638 # Only load RRD files we can actually display..
1639 next unless (defined ($GraphDefs->{$type}));
1641 $hash->{$type} = [] unless (defined ($hash->{$type}));
1642 push (@{$hash->{$type}}, $inst);
1653 my $dir = @_ ? shift : $Config->{'Directory'};
1657 if (opendir ($dh, $dir))
1659 while (my $thing = readdir ($dh))
1661 next if ($thing =~ m/^\./);
1663 next if (!-d "$dir/$thing");
1665 push (@ret, $thing);
1671 return (@ret) if (wantarray ());
1679 my ($red, $green, $blue) = map { ord (pack ("H2", $_)) } ($color =~ m/([A-Fa-f0-9]{2})/g);
1680 #print STDERR "$color -> rgb($red,$green,$blue)\n";
1682 return ($red, $green, $blue);
1687 croak unless (scalar (@_) == 3);
1689 my ($red, $green, $blue) = @_;
1691 my $ret = sprintf ("%02X%02X%02X", $red, $green, $blue);
1692 #print STDERR "rgb($red,$green,$blue) -> $ret\n";
1697 sub color_calculate_transparent
1700 my $canvas = [color_hex2rgb (shift)];
1701 my @colors = map { [color_hex2rgb ($_)] } (@_);
1703 if (($alpha < 0.0) or ($alpha > 1.0))
1710 return (color_rgb2hex (@$canvas));
1714 return (color_rgb2hex (@{$colors[-1]}));
1717 my $ret = _color_calculate_transparent ($alpha, $canvas, @colors);
1719 return (color_rgb2hex (@$ret));
1722 sub _color_calculate_transparent
1727 my @colors = @_ ? shift : ();
1728 my $ret = [0, 0, 0];
1730 for (my $i = 0; $i < 3; $i++)
1732 $ret->[$i] = ($alpha * $color->[$i]) + ((1 - $alpha) * $canvas->[$i]);
1735 return (_color_calculate_transparent ($alpha, $ret, @colors)) if (@colors);
1744 for (my $i = 0; $i < $num; $i++)
1746 my $pos = 6 * $i / $num;
1787 push (@ret, sprintf ("%02x%02x%02x", $red, $green, $blue));