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'};
57 'DEF:avg={file}:charge:AVERAGE',
58 'DEF:min={file}:charge:MIN',
59 'DEF:max={file}:charge:MAX',
62 "LINE1:avg#$FullBlue:Charge",
63 'GPRINT:min:MIN:%5.1lf%sAh Min,',
64 'GPRINT:avg:AVERAGE:%5.1lf%sAh Avg,',
65 'GPRINT:max:MAX:%5.1lf%sAh Max,',
66 'GPRINT:avg:LAST:%5.1lf%sAh Last\l'
68 cpu => ['DEF:user_avg={file}:user:AVERAGE',
69 'DEF:user_min={file}:user:MIN',
70 'DEF:user_max={file}:user:MAX',
71 'DEF:nice_avg={file}:nice:AVERAGE',
72 'DEF:nice_min={file}:nice:MIN',
73 'DEF:nice_max={file}:nice:MAX',
74 'DEF:syst_avg={file}:syst:AVERAGE',
75 'DEF:syst_min={file}:syst:MIN',
76 'DEF:syst_max={file}:syst:MAX',
77 'DEF:idle_avg={file}:idle:AVERAGE',
78 'DEF:idle_min={file}:idle:MIN',
79 'DEF:idle_max={file}:idle:MAX',
80 'DEF:wait_avg={file}:wait:AVERAGE',
81 'DEF:wait_min={file}:wait:MIN',
82 'DEF:wait_max={file}:wait:MAX',
83 'CDEF:user_avg_notnull=user_avg,UN,0,user_avg,IF',
84 'CDEF:nice_avg_notnull=nice_avg,UN,0,nice_avg,IF',
85 'CDEF:syst_avg_notnull=syst_avg,UN,0,syst_avg,IF',
86 'CDEF:idle_avg_notnull=idle_avg,UN,0,idle_avg,IF',
87 'CDEF:wait_avg_notnull=wait_avg,UN,0,wait_avg,IF',
88 'CDEF:totl_avg_notnull=user_avg_notnull,nice_avg_notnull,+,syst_avg_notnull,+,idle_avg_notnull,+,wait_avg_notnull,+',
89 'CDEF:user_avg_pct=user_avg_notnull,100,*,totl_avg_notnull,/',
90 'CDEF:nice_avg_pct=nice_avg_notnull,100,*,totl_avg_notnull,/',
91 'CDEF:syst_avg_pct=syst_avg_notnull,100,*,totl_avg_notnull,/',
92 'CDEF:wait_avg_pct=wait_avg_notnull,100,*,totl_avg_notnull,/',
93 'CDEF:nice_acc=syst_avg_pct,wait_avg_pct,user_avg_pct,nice_avg_pct,+,+,+',
94 'CDEF:user_acc=syst_avg_pct,wait_avg_pct,user_avg_pct,+,+',
95 'CDEF:wait_acc=syst_avg_pct,wait_avg_pct,+',
96 'CDEF:syst_acc=syst_avg_pct',
97 # 'CDEF:nice_acc=syst_avg_notnull,wait_avg_notnull,user_avg_notnull,nice_avg_notnull,+,+,+',
98 # 'CDEF:user_acc=syst_avg_notnull,wait_avg_notnull,user_avg_notnull,+,+',
99 # 'CDEF:wait_acc=syst_avg_notnull,wait_avg_notnull,+',
100 # 'CDEF:syst_acc=syst_avg_notnull',
101 "AREA:nice_acc#$HalfGreen",
102 "AREA:user_acc#$HalfBlue",
103 "AREA:wait_acc#$HalfYellow",
104 "AREA:syst_acc#$HalfRed",
105 "LINE1:nice_acc#$FullGreen:Nice ",
106 'GPRINT:nice_min:MIN:%5.1lf%% Min,',
107 'GPRINT:nice_avg:AVERAGE:%5.1lf%% Avg,',
108 'GPRINT:nice_max:MAX:%5.1lf%% Max,',
109 'GPRINT:nice_avg:LAST:%5.1lf%% Last\l',
110 "LINE1:user_acc#$FullBlue:User ",
111 'GPRINT:user_min:MIN:%5.1lf%% Min,',
112 'GPRINT:user_avg:AVERAGE:%5.1lf%% Avg,',
113 'GPRINT:user_max:MAX:%5.1lf%% Max,',
114 'GPRINT:user_avg:LAST:%5.1lf%% Last\l',
115 "LINE1:wait_acc#$FullYellow:Wait-IO",
116 'GPRINT:wait_min:MIN:%5.1lf%% Min,',
117 'GPRINT:wait_avg:AVERAGE:%5.1lf%% Avg,',
118 'GPRINT:wait_max:MAX:%5.1lf%% Max,',
119 'GPRINT:wait_avg:LAST:%5.1lf%% Last\l',
120 "LINE1:syst_acc#$FullRed:System ",
121 'GPRINT:syst_min:MIN:%5.1lf%% Min,',
122 'GPRINT:syst_avg:AVERAGE:%5.1lf%% Avg,',
123 'GPRINT:syst_max:MAX:%5.1lf%% Max,',
124 'GPRINT:syst_avg:LAST:%5.1lf%% Last\l'
127 'DEF:avg={file}:current:AVERAGE',
128 'DEF:min={file}:current:MIN',
129 'DEF:max={file}:current:MAX',
130 "AREA:max#$HalfBlue",
132 "LINE1:avg#$FullBlue:Current",
133 'GPRINT:min:MIN:%5.1lf%sA Min,',
134 'GPRINT:avg:AVERAGE:%5.1lf%sA Avg,',
135 'GPRINT:max:MAX:%5.1lf%sA Max,',
136 'GPRINT:avg:LAST:%5.1lf%sA Last\l'
139 'DEF:free_avg={file}:free:AVERAGE',
140 'DEF:free_min={file}:free:MIN',
141 'DEF:free_max={file}:free:MAX',
142 'DEF:used_avg={file}:used:AVERAGE',
143 'DEF:used_min={file}:used:MIN',
144 'DEF:used_max={file}:used:MAX',
145 'CDEF:total=free_avg,used_avg,+',
146 'CDEF:free_pct=100,free_avg,*,total,/',
147 'CDEF:used_pct=100,used_avg,*,total,/',
148 'CDEF:free_acc=free_pct,used_pct,+',
149 'CDEF:used_acc=used_pct',
150 "AREA:free_acc#$HalfGreen",
151 "AREA:used_acc#$HalfRed",
152 "LINE1:free_acc#$FullGreen:Free",
153 'GPRINT:free_min:MIN:%5.1lf%sB Min,',
154 'GPRINT:free_avg:AVERAGE:%5.1lf%sB Avg,',
155 'GPRINT:free_max:MAX:%5.1lf%sB Max,',
156 'GPRINT:free_avg:LAST:%5.1lf%sB Last\l',
157 "LINE1:used_acc#$FullRed:Used",
158 'GPRINT:used_min:MIN:%5.1lf%sB Min,',
159 'GPRINT:used_avg:AVERAGE:%5.1lf%sB Avg,',
160 'GPRINT:used_max:MAX:%5.1lf%sB Max,',
161 'GPRINT:used_avg:LAST:%5.1lf%sB Last\l'
164 'DEF:rtime_avg={file}:rtime:AVERAGE',
165 'DEF:rtime_min={file}:rtime:MIN',
166 'DEF:rtime_max={file}:rtime:MAX',
167 'DEF:wtime_avg={file}:wtime:AVERAGE',
168 'DEF:wtime_min={file}:wtime:MIN',
169 'DEF:wtime_max={file}:wtime:MAX',
170 'CDEF:rtime_avg_ms=rtime_avg,1000,/',
171 'CDEF:rtime_min_ms=rtime_min,1000,/',
172 'CDEF:rtime_max_ms=rtime_max,1000,/',
173 'CDEF:wtime_avg_ms=wtime_avg,1000,/',
174 'CDEF:wtime_min_ms=wtime_min,1000,/',
175 'CDEF:wtime_max_ms=wtime_max,1000,/',
176 'CDEF:total_avg_ms=rtime_avg_ms,wtime_avg_ms,+',
177 'CDEF:total_min_ms=rtime_min_ms,wtime_min_ms,+',
178 'CDEF:total_max_ms=rtime_max_ms,wtime_max_ms,+',
179 "AREA:total_max_ms#$HalfRed",
180 "AREA:total_min_ms#$Canvas",
181 "LINE1:wtime_avg_ms#$FullGreen:Write",
182 'GPRINT:wtime_min_ms:MIN:%5.1lf%s Min,',
183 'GPRINT:wtime_avg_ms:AVERAGE:%5.1lf%s Avg,',
184 'GPRINT:wtime_max_ms:MAX:%5.1lf%s Max,',
185 'GPRINT:wtime_avg_ms:LAST:%5.1lf%s Last\n',
186 "LINE1:rtime_avg_ms#$FullBlue:Read ",
187 'GPRINT:rtime_min_ms:MIN:%5.1lf%s Min,',
188 'GPRINT:rtime_avg_ms:AVERAGE:%5.1lf%s Avg,',
189 'GPRINT:rtime_max_ms:MAX:%5.1lf%s Max,',
190 'GPRINT:rtime_avg_ms:LAST:%5.1lf%s Last\n',
191 "LINE1:total_avg_ms#$FullRed:Total",
192 'GPRINT:total_min_ms:MIN:%5.1lf%s Min,',
193 'GPRINT:total_avg_ms:AVERAGE:%5.1lf%s Avg,',
194 'GPRINT:total_max_ms:MAX:%5.1lf%s Max,',
195 'GPRINT:total_avg_ms:LAST:%5.1lf%s Last'
198 'DEF:temp_avg={file}:value:AVERAGE',
199 'DEF:temp_min={file}:value:MIN',
200 'DEF:temp_max={file}:value:MAX',
201 "AREA:temp_max#$HalfBlue",
202 "AREA:temp_min#$Canvas",
203 "LINE1:temp_avg#$FullBlue:Temperature",
204 'GPRINT:temp_min:MIN:%4.1lf Min,',
205 'GPRINT:temp_avg:AVERAGE:%4.1lf Avg,',
206 'GPRINT:temp_max:MAX:%4.1lf Max,',
207 'GPRINT:temp_avg:LAST:%4.1lf Last\l'
209 load => ['DEF:s_avg={file}:shortterm:AVERAGE',
210 'DEF:s_min={file}:shortterm:MIN',
211 'DEF:s_max={file}:shortterm:MAX',
212 'DEF:m_avg={file}:midterm:AVERAGE',
213 'DEF:m_min={file}:midterm:MIN',
214 'DEF:m_max={file}:midterm:MAX',
215 'DEF:l_avg={file}:longterm:AVERAGE',
216 'DEF:l_min={file}:longterm:MIN',
217 'DEF:l_max={file}:longterm:MAX',
218 "AREA:s_max#$HalfGreen",
219 "AREA:s_min#$Canvas",
220 "LINE1:s_avg#$FullGreen: 1m average",
221 'GPRINT:s_min:MIN:%4.2lf Min,',
222 'GPRINT:s_avg:AVERAGE:%4.2lf Avg,',
223 'GPRINT:s_max:MAX:%4.2lf Max,',
224 'GPRINT:s_avg:LAST:%4.2lf Last\n',
225 "LINE1:m_avg#$FullBlue: 5m average",
226 'GPRINT:m_min:MIN:%4.2lf Min,',
227 'GPRINT:m_avg:AVERAGE:%4.2lf Avg,',
228 'GPRINT:m_max:MAX:%4.2lf Max,',
229 'GPRINT:m_avg:LAST:%4.2lf Last\n',
230 "LINE1:l_avg#$FullRed:15m average",
231 'GPRINT:l_min:MIN:%4.2lf Min,',
232 'GPRINT:l_avg:AVERAGE:%4.2lf Avg,',
233 'GPRINT:l_max:MAX:%4.2lf Max,',
234 'GPRINT:l_avg:LAST:%4.2lf Last'
236 mails => ['DEF:rawgood={file}:good:AVERAGE',
237 'DEF:rawspam={file}:spam:AVERAGE',
238 'CDEF:good=rawgood,UN,0,rawgood,IF',
239 'CDEF:spam=rawspam,UN,0,rawspam,IF',
240 'CDEF:negspam=spam,-1,*',
241 "AREA:good#$HalfGreen",
242 "LINE1:good#$FullGreen:Good mails",
243 'GPRINT:good:AVERAGE:%4.1lf Avg,',
244 'GPRINT:good:MAX:%4.1lf Max,',
245 'GPRINT:good:LAST:%4.1lf Last\n',
246 "AREA:negspam#$HalfRed",
247 "LINE1:negspam#$FullRed:Spam mails",
248 'GPRINT:spam:AVERAGE:%4.1lf Avg,',
249 'GPRINT:spam:MAX:%4.1lf Max,',
250 'GPRINT:spam:LAST:%4.1lf Last',
253 'DEF:used_avg={file}:used:AVERAGE',
254 'DEF:free_avg={file}:free:AVERAGE',
255 'DEF:buffers_avg={file}:buffers:AVERAGE',
256 'DEF:cached_avg={file}:cached:AVERAGE',
257 'DEF:used_min={file}:used:MIN',
258 'DEF:free_min={file}:free:MIN',
259 'DEF:buffers_min={file}:buffers:MIN',
260 'DEF:cached_min={file}:cached:MIN',
261 'DEF:used_max={file}:used:MAX',
262 'DEF:free_max={file}:free:MAX',
263 'DEF:buffers_max={file}:buffers:MAX',
264 'DEF:cached_max={file}:cached:MAX',
265 'CDEF:free_cached_buffers_used=free_avg,cached_avg,+,buffers_avg,+,used_avg,+',
266 'CDEF:cached_buffers_used=cached_avg,buffers_avg,+,used_avg,+',
267 'CDEF:buffers_used=buffers_avg,used_avg,+',
268 "AREA:free_cached_buffers_used#$HalfGreen",
269 "AREA:cached_buffers_used#$HalfBlue",
270 "AREA:buffers_used#$HalfYellow",
271 "AREA:used_avg#$HalfRed",
272 "LINE1:free_cached_buffers_used#$FullGreen:Free ",
273 'GPRINT:free_min:MIN:%5.1lf%s Min,',
274 'GPRINT:free_avg:AVERAGE:%5.1lf%s Avg,',
275 'GPRINT:free_max:MAX:%5.1lf%s Max,',
276 'GPRINT:free_avg:LAST:%5.1lf%s Last\n',
277 "LINE1:cached_buffers_used#$FullBlue:Page cache ",
278 'GPRINT:cached_min:MIN:%5.1lf%s Min,',
279 'GPRINT:cached_avg:AVERAGE:%5.1lf%s Avg,',
280 'GPRINT:cached_max:MAX:%5.1lf%s Max,',
281 'GPRINT:cached_avg:LAST:%5.1lf%s Last\n',
282 "LINE1:buffers_used#$FullYellow:Buffer cache",
283 'GPRINT:buffers_min:MIN:%5.1lf%s Min,',
284 'GPRINT:buffers_avg:AVERAGE:%5.1lf%s Avg,',
285 'GPRINT:buffers_max:MAX:%5.1lf%s Max,',
286 'GPRINT:buffers_avg:LAST:%5.1lf%s Last\n',
287 "LINE1:used_avg#$FullRed:Used ",
288 'GPRINT:used_min:MIN:%5.1lf%s Min,',
289 'GPRINT:used_avg:AVERAGE:%5.1lf%s Avg,',
290 'GPRINT:used_max:MAX:%5.1lf%s Max,',
291 'GPRINT:used_avg:LAST:%5.1lf%s Last'
294 "DEF:val_avg={file}:value:AVERAGE",
295 "DEF:val_min={file}:value:MIN",
296 "DEF:val_max={file}:value:MAX",
297 "AREA:val_max#$HalfBlue",
298 "AREA:val_min#$Canvas",
299 "LINE1:val_avg#$FullBlue:{inst}",
300 'GPRINT:val_min:MIN:%5.2lf Min,',
301 'GPRINT:val_avg:AVERAGE:%5.2lf Avg,',
302 'GPRINT:val_max:MAX:%5.2lf Max,',
303 'GPRINT:val_avg:LAST:%5.2lf Last'
306 "DEF:val_avg={file}:value:AVERAGE",
307 "DEF:val_min={file}:value:MIN",
308 "DEF:val_max={file}:value:MAX",
309 "AREA:val_max#$HalfBlue",
310 "AREA:val_min#$Canvas",
311 "LINE1:val_avg#$FullBlue:{inst}",
312 'GPRINT:val_min:MIN:%5.2lf Min,',
313 'GPRINT:val_avg:AVERAGE:%5.2lf Avg,',
314 'GPRINT:val_max:MAX:%5.2lf Max,',
315 'GPRINT:val_avg:LAST:%5.2lf Last'
318 "DEF:hits_min={file}:hits:MIN",
319 "DEF:hits_avg={file}:hits:AVERAGE",
320 "DEF:hits_max={file}:hits:MAX",
321 "DEF:inserts_min={file}:inserts:MIN",
322 "DEF:inserts_avg={file}:inserts:AVERAGE",
323 "DEF:inserts_max={file}:inserts:MAX",
324 "DEF:not_cached_min={file}:not_cached:MIN",
325 "DEF:not_cached_avg={file}:not_cached:AVERAGE",
326 "DEF:not_cached_max={file}:not_cached:MAX",
327 "DEF:lowmem_prunes_min={file}:lowmem_prunes:MIN",
328 "DEF:lowmem_prunes_avg={file}:lowmem_prunes:AVERAGE",
329 "DEF:lowmem_prunes_max={file}:lowmem_prunes:MAX",
330 "DEF:queries_min={file}:queries_in_cache:MIN",
331 "DEF:queries_avg={file}:queries_in_cache:AVERAGE",
332 "DEF:queries_max={file}:queries_in_cache:MAX",
333 "CDEF:unknown=queries_avg,UNKN,+",
334 "CDEF:not_cached_agg=hits_avg,inserts_avg,+,not_cached_avg,+",
335 "CDEF:inserts_agg=hits_avg,inserts_avg,+",
336 "CDEF:hits_agg=hits_avg",
337 "AREA:not_cached_agg#$HalfYellow",
338 "AREA:inserts_agg#$HalfBlue",
339 "AREA:hits_agg#$HalfGreen",
340 "LINE1:not_cached_agg#$FullYellow:Not Cached ",
341 'GPRINT:not_cached_min:MIN:%5.2lf Min,',
342 'GPRINT:not_cached_avg:AVERAGE:%5.2lf Avg,',
343 'GPRINT:not_cached_max:MAX:%5.2lf Max,',
344 'GPRINT:not_cached_avg:LAST:%5.2lf Last\l',
345 "LINE1:inserts_agg#$FullBlue:Inserts ",
346 'GPRINT:inserts_min:MIN:%5.2lf Min,',
347 'GPRINT:inserts_avg:AVERAGE:%5.2lf Avg,',
348 'GPRINT:inserts_max:MAX:%5.2lf Max,',
349 'GPRINT:inserts_avg:LAST:%5.2lf Last\l',
350 "LINE1:hits_agg#$FullGreen:Hits ",
351 'GPRINT:hits_min:MIN:%5.2lf Min,',
352 'GPRINT:hits_avg:AVERAGE:%5.2lf Avg,',
353 'GPRINT:hits_max:MAX:%5.2lf Max,',
354 'GPRINT:hits_avg:LAST:%5.2lf Last\l',
355 "LINE1:lowmem_prunes_avg#$FullRed:Lowmem Prunes ",
356 'GPRINT:lowmem_prunes_min:MIN:%5.2lf Min,',
357 'GPRINT:lowmem_prunes_avg:AVERAGE:%5.2lf Avg,',
358 'GPRINT:lowmem_prunes_max:MAX:%5.2lf Max,',
359 'GPRINT:lowmem_prunes_avg:LAST:%5.2lf Last\l',
360 "LINE1:unknown#$Canvas:Queries in cache",
361 'GPRINT:queries_min:MIN:%5.0lf Min,',
362 'GPRINT:queries_avg:AVERAGE:%5.0lf Avg,',
363 'GPRINT:queries_max:MAX:%5.0lf Max,',
364 'GPRINT:queries_avg:LAST:%5.0lf Last\l'
367 "DEF:running_min={file}:running:MIN",
368 "DEF:running_avg={file}:running:AVERAGE",
369 "DEF:running_max={file}:running:MAX",
370 "DEF:connected_min={file}:connected:MIN",
371 "DEF:connected_avg={file}:connected:AVERAGE",
372 "DEF:connected_max={file}:connected:MAX",
373 "DEF:cached_min={file}:cached:MIN",
374 "DEF:cached_avg={file}:cached:AVERAGE",
375 "DEF:cached_max={file}:cached:MAX",
376 "DEF:created_min={file}:created:MIN",
377 "DEF:created_avg={file}:created:AVERAGE",
378 "DEF:created_max={file}:created:MAX",
379 "CDEF:unknown=created_avg,UNKN,+",
380 "CDEF:cached_agg=connected_avg,cached_avg,+",
381 "AREA:cached_agg#$HalfGreen",
382 "AREA:connected_avg#$HalfBlue",
383 "AREA:running_avg#$HalfRed",
384 "LINE1:cached_agg#$FullGreen:Cached ",
385 'GPRINT:cached_min:MIN:%5.1lf Min,',
386 'GPRINT:cached_avg:AVERAGE:%5.1lf Avg,',
387 'GPRINT:cached_max:MAX:%5.1lf Max,',
388 'GPRINT:cached_avg:LAST:%5.1lf Last\l',
389 "LINE1:connected_avg#$FullBlue:Connected",
390 'GPRINT:connected_min:MIN:%5.1lf Min,',
391 'GPRINT:connected_avg:AVERAGE:%5.1lf Avg,',
392 'GPRINT:connected_max:MAX:%5.1lf Max,',
393 'GPRINT:connected_avg:LAST:%5.1lf Last\l',
394 "LINE1:running_avg#$FullRed:Running ",
395 'GPRINT:running_min:MIN:%5.1lf Min,',
396 'GPRINT:running_avg:AVERAGE:%5.1lf Avg,',
397 'GPRINT:running_max:MAX:%5.1lf Max,',
398 'GPRINT:running_avg:LAST:%5.1lf Last\l',
399 "LINE1:unknown#$Canvas:Created ",
400 'GPRINT:created_min:MIN:%5.0lf Min,',
401 'GPRINT:created_avg:AVERAGE:%5.0lf Avg,',
402 'GPRINT:created_max:MAX:%5.0lf Max,',
403 'GPRINT:created_avg:LAST:%5.0lf Last\l'
406 "DEF:null_avg={file}:null:AVERAGE",
407 "DEF:getattr_avg={file}:getattr:AVERAGE",
408 "DEF:setattr_avg={file}:setattr:AVERAGE",
409 "DEF:lookup_avg={file}:lookup:AVERAGE",
410 "DEF:access_avg={file}:access:AVERAGE",
411 "DEF:readlink_avg={file}:readlink:AVERAGE",
412 "DEF:read_avg={file}:read:AVERAGE",
413 "DEF:write_avg={file}:write:AVERAGE",
414 "DEF:create_avg={file}:create:AVERAGE",
415 "DEF:mkdir_avg={file}:mkdir:AVERAGE",
416 "DEF:symlink_avg={file}:symlink:AVERAGE",
417 "DEF:mknod_avg={file}:mknod:AVERAGE",
418 "DEF:remove_avg={file}:remove:AVERAGE",
419 "DEF:rmdir_avg={file}:rmdir:AVERAGE",
420 "DEF:rename_avg={file}:rename:AVERAGE",
421 "DEF:link_avg={file}:link:AVERAGE",
422 "DEF:readdir_avg={file}:readdir:AVERAGE",
423 "DEF:readdirplus_avg={file}:readdirplus:AVERAGE",
424 "DEF:fsstat_avg={file}:fsstat:AVERAGE",
425 "DEF:fsinfo_avg={file}:fsinfo:AVERAGE",
426 "DEF:pathconf_avg={file}:pathconf:AVERAGE",
427 "DEF:commit_avg={file}:commit:AVERAGE",
428 "DEF:null_max={file}:null:MAX",
429 "DEF:getattr_max={file}:getattr:MAX",
430 "DEF:setattr_max={file}:setattr:MAX",
431 "DEF:lookup_max={file}:lookup:MAX",
432 "DEF:access_max={file}:access:MAX",
433 "DEF:readlink_max={file}:readlink:MAX",
434 "DEF:read_max={file}:read:MAX",
435 "DEF:write_max={file}:write:MAX",
436 "DEF:create_max={file}:create:MAX",
437 "DEF:mkdir_max={file}:mkdir:MAX",
438 "DEF:symlink_max={file}:symlink:MAX",
439 "DEF:mknod_max={file}:mknod:MAX",
440 "DEF:remove_max={file}:remove:MAX",
441 "DEF:rmdir_max={file}:rmdir:MAX",
442 "DEF:rename_max={file}:rename:MAX",
443 "DEF:link_max={file}:link:MAX",
444 "DEF:readdir_max={file}:readdir:MAX",
445 "DEF:readdirplus_max={file}:readdirplus:MAX",
446 "DEF:fsstat_max={file}:fsstat:MAX",
447 "DEF:fsinfo_max={file}:fsinfo:MAX",
448 "DEF:pathconf_max={file}:pathconf:MAX",
449 "DEF:commit_max={file}:commit:MAX",
450 "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,+,+,+,+,+,+,+,+,+,+,+,+,+,+",
451 "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,+,+,+,+,+,+,+,+,+,+,+,+,+,+",
452 "CDEF:stack_read=read_avg",
453 "CDEF:stack_getattr=stack_read,getattr_avg,+",
454 "CDEF:stack_access=stack_getattr,access_avg,+",
455 "CDEF:stack_lookup=stack_access,lookup_avg,+",
456 "CDEF:stack_write=stack_lookup,write_avg,+",
457 "CDEF:stack_commit=stack_write,commit_avg,+",
458 "CDEF:stack_setattr=stack_commit,setattr_avg,+",
459 "CDEF:stack_other=stack_setattr,other_avg,+",
460 "AREA:stack_other#$HalfRed",
461 "AREA:stack_setattr#$HalfGreen",
462 "AREA:stack_commit#$HalfYellow",
463 "AREA:stack_write#$HalfGreen",
464 "AREA:stack_lookup#$HalfBlue",
465 "AREA:stack_access#$HalfMagenta",
466 "AREA:stack_getattr#$HalfCyan",
467 "AREA:stack_read#$HalfBlue",
468 "LINE1:stack_other#$FullRed:Other ",
469 'GPRINT:other_max:MAX:%5.1lf Max,',
470 'GPRINT:other_avg:AVERAGE:%5.1lf Avg,',
471 'GPRINT:other_avg:LAST:%5.1lf Last\l',
472 "LINE1:stack_setattr#$FullGreen:setattr",
473 'GPRINT:setattr_max:MAX:%5.1lf Max,',
474 'GPRINT:setattr_avg:AVERAGE:%5.1lf Avg,',
475 'GPRINT:setattr_avg:LAST:%5.1lf Last\l',
476 "LINE1:stack_commit#$FullYellow:commit ",
477 'GPRINT:commit_max:MAX:%5.1lf Max,',
478 'GPRINT:commit_avg:AVERAGE:%5.1lf Avg,',
479 'GPRINT:commit_avg:LAST:%5.1lf Last\l',
480 "LINE1:stack_write#$FullGreen:write ",
481 'GPRINT:write_max:MAX:%5.1lf Max,',
482 'GPRINT:write_avg:AVERAGE:%5.1lf Avg,',
483 'GPRINT:write_avg:LAST:%5.1lf Last\l',
484 "LINE1:stack_lookup#$FullBlue:lookup ",
485 'GPRINT:lookup_max:MAX:%5.1lf Max,',
486 'GPRINT:lookup_avg:AVERAGE:%5.1lf Avg,',
487 'GPRINT:lookup_avg:LAST:%5.1lf Last\l',
488 "LINE1:stack_access#$FullMagenta:access ",
489 'GPRINT:access_max:MAX:%5.1lf Max,',
490 'GPRINT:access_avg:AVERAGE:%5.1lf Avg,',
491 'GPRINT:access_avg:LAST:%5.1lf Last\l',
492 "LINE1:stack_getattr#$FullCyan:getattr",
493 'GPRINT:getattr_max:MAX:%5.1lf Max,',
494 'GPRINT:getattr_avg:AVERAGE:%5.1lf Avg,',
495 'GPRINT:getattr_avg:LAST:%5.1lf Last\l',
496 "LINE1:stack_read#$FullBlue:read ",
497 'GPRINT:read_max:MAX:%5.1lf Max,',
498 'GPRINT:read_avg:AVERAGE:%5.1lf Avg,',
499 'GPRINT:read_avg:LAST:%5.1lf Last\l'
502 "DEF:rbyte_avg={file}:rbytes:AVERAGE",
503 "DEF:rbyte_min={file}:rbytes:MIN",
504 "DEF:rbyte_max={file}:rbytes:MAX",
505 "DEF:wbyte_avg={file}:wbytes:AVERAGE",
506 "DEF:wbyte_min={file}:wbytes:MIN",
507 "DEF:wbyte_max={file}:wbytes:MAX",
508 'CDEF:overlap=wbyte_avg,rbyte_avg,GT,rbyte_avg,wbyte_avg,IF',
509 "AREA:wbyte_avg#$HalfGreen",
510 "AREA:rbyte_avg#$HalfBlue",
511 "AREA:overlap#$HalfBlueGreen",
512 "LINE1:wbyte_avg#$FullGreen:Write",
513 'GPRINT:wbyte_min:MIN:%5.1lf%s Min,',
514 'GPRINT:wbyte_avg:AVERAGE:%5.1lf%s Avg,',
515 'GPRINT:wbyte_max:MAX:%5.1lf%s Max,',
516 'GPRINT:wbyte_avg:LAST:%5.1lf%s Last\l',
517 "LINE1:rbyte_avg#$FullBlue:Read ",
518 'GPRINT:rbyte_min:MIN:%5.1lf%s Min,',
519 'GPRINT:rbyte_avg:AVERAGE:%5.1lf%s Avg,',
520 'GPRINT:rbyte_max:MAX:%5.1lf%s Max,',
521 'GPRINT:rbyte_avg:LAST:%5.1lf%s Last\l'
523 ping => ['DEF:ping_avg={file}:ping:AVERAGE',
524 'DEF:ping_min={file}:ping:MIN',
525 'DEF:ping_max={file}:ping:MAX',
526 "AREA:ping_max#$HalfBlue",
527 "AREA:ping_min#$Canvas",
528 "LINE1:ping_avg#$FullBlue:Ping",
529 'GPRINT:ping_min:MIN:%4.1lf ms Min,',
530 'GPRINT:ping_avg:AVERAGE:%4.1lf ms Avg,',
531 'GPRINT:ping_max:MAX:%4.1lf ms Max,',
532 'GPRINT:ping_avg:LAST:%4.1lf ms Last'],
534 "DEF:running_avg={file}:running:AVERAGE",
535 "DEF:running_min={file}:running:MIN",
536 "DEF:running_max={file}:running:MAX",
537 "DEF:sleeping_avg={file}:sleeping:AVERAGE",
538 "DEF:sleeping_min={file}:sleeping:MIN",
539 "DEF:sleeping_max={file}:sleeping:MAX",
540 "DEF:zombies_avg={file}:zombies:AVERAGE",
541 "DEF:zombies_min={file}:zombies:MIN",
542 "DEF:zombies_max={file}:zombies:MAX",
543 "DEF:stopped_avg={file}:stopped:AVERAGE",
544 "DEF:stopped_min={file}:stopped:MIN",
545 "DEF:stopped_max={file}:stopped:MAX",
546 "DEF:paging_avg={file}:paging:AVERAGE",
547 "DEF:paging_min={file}:paging:MIN",
548 "DEF:paging_max={file}:paging:MAX",
549 "DEF:blocked_avg={file}:blocked:AVERAGE",
550 "DEF:blocked_min={file}:blocked:MIN",
551 "DEF:blocked_max={file}:blocked:MAX",
552 'CDEF:paging_acc=sleeping_avg,running_avg,stopped_avg,zombies_avg,blocked_avg,paging_avg,+,+,+,+,+',
553 'CDEF:blocked_acc=sleeping_avg,running_avg,stopped_avg,zombies_avg,blocked_avg,+,+,+,+',
554 'CDEF:zombies_acc=sleeping_avg,running_avg,stopped_avg,zombies_avg,+,+,+',
555 'CDEF:stopped_acc=sleeping_avg,running_avg,stopped_avg,+,+',
556 'CDEF:running_acc=sleeping_avg,running_avg,+',
557 'CDEF:sleeping_acc=sleeping_avg',
558 "AREA:paging_acc#$HalfYellow",
559 "AREA:blocked_acc#$HalfCyan",
560 "AREA:zombies_acc#$HalfRed",
561 "AREA:stopped_acc#$HalfMagenta",
562 "AREA:running_acc#$HalfGreen",
563 "AREA:sleeping_acc#$HalfBlue",
564 "LINE1:paging_acc#$FullYellow:Paging ",
565 'GPRINT:paging_min:MIN:%5.1lf Min,',
566 'GPRINT:paging_avg:AVERAGE:%5.1lf Average,',
567 'GPRINT:paging_max:MAX:%5.1lf Max,',
568 'GPRINT:paging_avg:LAST:%5.1lf Last\l',
569 "LINE1:blocked_acc#$FullCyan:Blocked ",
570 'GPRINT:blocked_min:MIN:%5.1lf Min,',
571 'GPRINT:blocked_avg:AVERAGE:%5.1lf Average,',
572 'GPRINT:blocked_max:MAX:%5.1lf Max,',
573 'GPRINT:blocked_avg:LAST:%5.1lf Last\l',
574 "LINE1:zombies_acc#$FullRed:Zombies ",
575 'GPRINT:zombies_min:MIN:%5.1lf Min,',
576 'GPRINT:zombies_avg:AVERAGE:%5.1lf Average,',
577 'GPRINT:zombies_max:MAX:%5.1lf Max,',
578 'GPRINT:zombies_avg:LAST:%5.1lf Last\l',
579 "LINE1:stopped_acc#$FullMagenta:Stopped ",
580 'GPRINT:stopped_min:MIN:%5.1lf Min,',
581 'GPRINT:stopped_avg:AVERAGE:%5.1lf Average,',
582 'GPRINT:stopped_max:MAX:%5.1lf Max,',
583 'GPRINT:stopped_avg:LAST:%5.1lf Last\l',
584 "LINE1:running_acc#$FullGreen:Running ",
585 'GPRINT:running_min:MIN:%5.1lf Min,',
586 'GPRINT:running_avg:AVERAGE:%5.1lf Average,',
587 'GPRINT:running_max:MAX:%5.1lf Max,',
588 'GPRINT:running_avg:LAST:%5.1lf Last\l',
589 "LINE1:sleeping_acc#$FullBlue:Sleeping",
590 'GPRINT:sleeping_min:MIN:%5.1lf Min,',
591 'GPRINT:sleeping_avg:AVERAGE:%5.1lf Average,',
592 'GPRINT:sleeping_max:MAX:%5.1lf Max,',
593 'GPRINT:sleeping_avg:LAST:%5.1lf Last\l'
596 'DEF:temp_avg={file}:value:AVERAGE',
597 'DEF:temp_min={file}:value:MIN',
598 'DEF:temp_max={file}:value:MAX',
599 "AREA:temp_max#$HalfBlue",
600 "AREA:temp_min#$Canvas",
601 "LINE1:temp_avg#$FullBlue:Value",
602 'GPRINT:temp_min:MIN:%4.1lf Min,',
603 'GPRINT:temp_avg:AVERAGE:%4.1lf Avg,',
604 'GPRINT:temp_max:MAX:%4.1lf Max,',
605 'GPRINT:temp_avg:LAST:%4.1lf Last\l'
608 'DEF:used_avg={file}:used:AVERAGE',
609 'DEF:used_min={file}:used:MIN',
610 'DEF:used_max={file}:used:MAX',
611 'DEF:free_avg={file}:free:AVERAGE',
612 'DEF:free_min={file}:free:MIN',
613 'DEF:free_max={file}:free:MAX',
614 'DEF:cach_avg={file}:cached:AVERAGE',
615 'DEF:cach_min={file}:cached:MIN',
616 'DEF:cach_max={file}:cached:MAX',
617 'DEF:resv_avg={file}:resv:AVERAGE',
618 'DEF:resv_min={file}:resv:MIN',
619 'DEF:resv_max={file}:resv:MAX',
620 'CDEF:cach_avg_notnull=cach_avg,UN,0,cach_avg,IF',
621 'CDEF:resv_avg_notnull=resv_avg,UN,0,resv_avg,IF',
622 'CDEF:used_acc=used_avg',
623 'CDEF:resv_acc=used_acc,resv_avg_notnull,+',
624 'CDEF:cach_acc=resv_acc,cach_avg_notnull,+',
625 'CDEF:free_acc=cach_acc,free_avg,+',
626 "AREA:free_acc#$HalfGreen",
627 "AREA:cach_acc#$HalfBlue",
628 "AREA:resv_acc#$HalfYellow",
629 "AREA:used_acc#$HalfRed",
630 "LINE1:free_acc#$FullGreen:Free ",
631 'GPRINT:free_min:MIN:%5.1lf%s Min,',
632 'GPRINT:free_avg:AVERAGE:%5.1lf%s Avg,',
633 'GPRINT:free_max:MAX:%5.1lf%s Max,',
634 'GPRINT:free_avg:LAST:%5.1lf%s Last\n',
635 "LINE1:cach_acc#$FullBlue:Cached ",
636 'GPRINT:cach_min:MIN:%5.1lf%s Min,',
637 'GPRINT:cach_avg:AVERAGE:%5.1lf%s Avg,',
638 'GPRINT:cach_max:MAX:%5.1lf%s Max,',
639 'GPRINT:cach_avg:LAST:%5.1lf%s Last\l',
640 "LINE1:resv_acc#$FullYellow:Reserved",
641 'GPRINT:resv_min:MIN:%5.1lf%s Min,',
642 'GPRINT:resv_avg:AVERAGE:%5.1lf%s Avg,',
643 'GPRINT:resv_max:MAX:%5.1lf%s Max,',
644 'GPRINT:resv_avg:LAST:%5.1lf%s Last\n',
645 "LINE1:used_acc#$FullRed:Used ",
646 'GPRINT:used_min:MIN:%5.1lf%s Min,',
647 'GPRINT:used_avg:AVERAGE:%5.1lf%s Avg,',
648 'GPRINT:used_max:MAX:%5.1lf%s Max,',
649 'GPRINT:used_avg:LAST:%5.1lf%s Last\l'
651 traffic => ['DEF:out_min_raw={file}:outgoing:MIN',
652 'DEF:out_avg_raw={file}:outgoing:AVERAGE',
653 'DEF:out_max_raw={file}:outgoing:MAX',
654 'DEF:inc_min_raw={file}:incoming:MIN',
655 'DEF:inc_avg_raw={file}:incoming:AVERAGE',
656 'DEF:inc_max_raw={file}:incoming:MAX',
657 'CDEF:out_min=out_min_raw,8,*',
658 'CDEF:out_avg=out_avg_raw,8,*',
659 'CDEF:out_max=out_max_raw,8,*',
660 'CDEF:inc_min=inc_min_raw,8,*',
661 'CDEF:inc_avg=inc_avg_raw,8,*',
662 'CDEF:inc_max=inc_max_raw,8,*',
663 'CDEF:overlap=out_avg,inc_avg,GT,inc_avg,out_avg,IF',
664 'CDEF:mytime=out_avg_raw,TIME,TIME,IF',
665 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
666 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
667 'CDEF:out_avg_sample=out_avg_raw,UN,0,out_avg_raw,IF,sample_len,*',
668 'CDEF:out_avg_sum=PREV,UN,0,PREV,IF,out_avg_sample,+',
669 'CDEF:inc_avg_sample=inc_avg_raw,UN,0,inc_avg_raw,IF,sample_len,*',
670 'CDEF:inc_avg_sum=PREV,UN,0,PREV,IF,inc_avg_sample,+',
671 "AREA:out_avg#$HalfGreen",
672 "AREA:inc_avg#$HalfBlue",
673 "AREA:overlap#$HalfBlueGreen",
674 "LINE1:out_avg#$FullGreen:Outgoing",
675 'GPRINT:out_avg:AVERAGE:%5.1lf%s Avg,',
676 'GPRINT:out_max:MAX:%5.1lf%s Max,',
677 'GPRINT:out_avg:LAST:%5.1lf%s Last',
678 'GPRINT:out_avg_sum:LAST:(ca. %5.1lf%sB Total)\l',
679 "LINE1:inc_avg#$FullBlue:Incoming",
680 #'GPRINT:inc_min:MIN:%5.1lf %s Min,',
681 'GPRINT:inc_avg:AVERAGE:%5.1lf%s Avg,',
682 'GPRINT:inc_max:MAX:%5.1lf%s Max,',
683 'GPRINT:inc_avg:LAST:%5.1lf%s Last',
684 'GPRINT:inc_avg_sum:LAST:(ca. %5.1lf%sB Total)\l'
687 'DEF:cpufreq_avg={file}:value:AVERAGE',
688 'DEF:cpufreq_min={file}:value:MIN',
689 'DEF:cpufreq_max={file}:value:MAX',
690 "AREA:cpufreq_max#$HalfBlue",
691 "AREA:cpufreq_min#$Canvas",
692 "LINE1:cpufreq_avg#$FullBlue:Frequency",
693 'GPRINT:cpufreq_min:MIN:%5.1lf%s Min,',
694 'GPRINT:cpufreq_avg:AVERAGE:%5.1lf%s Avg,',
695 'GPRINT:cpufreq_max:MAX:%5.1lf%s Max,',
696 'GPRINT:cpufreq_avg:LAST:%5.1lf%s Last\l'
699 'DEF:users_avg={file}:users:AVERAGE',
700 'DEF:users_min={file}:users:MIN',
701 'DEF:users_max={file}:users:MAX',
702 "AREA:users_max#$HalfBlue",
703 "AREA:users_min#$Canvas",
704 "LINE1:users_avg#$FullBlue:Users",
705 'GPRINT:users_min:MIN:%4.1lf Min,',
706 'GPRINT:users_avg:AVERAGE:%4.1lf Average,',
707 'GPRINT:users_max:MAX:%4.1lf Max,',
708 'GPRINT:users_avg:LAST:%4.1lf Last\l'
711 'DEF:avg={file}:voltage:AVERAGE',
712 'DEF:min={file}:voltage:MIN',
713 'DEF:max={file}:voltage:MAX',
714 "AREA:max#$HalfBlue",
716 "LINE1:avg#$FullBlue:Voltage",
717 'GPRINT:min:MIN:%5.1lf%sV Min,',
718 'GPRINT:avg:AVERAGE:%5.1lf%sV Avg,',
719 'GPRINT:max:MAX:%5.1lf%sV Max,',
720 'GPRINT:avg:LAST:%5.1lf%sV Last\l'
723 "DEF:total_avg={file}:total:AVERAGE",
724 "DEF:total_min={file}:total:MIN",
725 "DEF:total_max={file}:total:MAX",
726 "DEF:running_avg={file}:running:AVERAGE",
727 "DEF:running_min={file}:running:MIN",
728 "DEF:running_max={file}:running:MAX",
729 "DEF:uninterruptible_avg={file}:uninterruptible:AVERAGE",
730 "DEF:uninterruptible_min={file}:uninterruptible:MIN",
731 "DEF:uninterruptible_max={file}:uninterruptible:MAX",
732 "DEF:onhold_avg={file}:onhold:AVERAGE",
733 "DEF:onhold_min={file}:onhold:MIN",
734 "DEF:onhold_max={file}:onhold:MAX",
735 "LINE1:total_avg#$FullYellow:Total ",
736 'GPRINT:total_min:MIN:%5.1lf Min,',
737 'GPRINT:total_avg:AVERAGE:%5.1lf Avg.,',
738 'GPRINT:total_max:MAX:%5.1lf Max,',
739 'GPRINT:total_avg:LAST:%5.1lf Last\l',
740 "LINE1:running_avg#$FullRed:Running ",
741 'GPRINT:running_min:MIN:%5.1lf Min,',
742 'GPRINT:running_avg:AVERAGE:%5.1lf Avg.,',
743 'GPRINT:running_max:MAX:%5.1lf Max,',
744 'GPRINT:running_avg:LAST:%5.1lf Last\l',
745 "LINE1:uninterruptible_avg#$FullGreen:Unintr ",
746 'GPRINT:uninterruptible_min:MIN:%5.1lf Min,',
747 'GPRINT:uninterruptible_avg:AVERAGE:%5.1lf Avg.,',
748 'GPRINT:uninterruptible_max:MAX:%5.1lf Max,',
749 'GPRINT:uninterruptible_avg:LAST:%5.1lf Last\l',
750 "LINE1:onhold_avg#$FullBlue:Onhold ",
751 'GPRINT:onhold_min:MIN:%5.1lf Min,',
752 'GPRINT:onhold_avg:AVERAGE:%5.1lf Avg.,',
753 'GPRINT:onhold_max:MAX:%5.1lf Max,',
754 'GPRINT:onhold_avg:LAST:%5.1lf Last\l'
757 'DEF:vm_avg={file}:vm:AVERAGE',
758 'DEF:vm_min={file}:vm:MIN',
759 'DEF:vm_max={file}:vm:MAX',
760 'DEF:vml_avg={file}:vml:AVERAGE',
761 'DEF:vml_min={file}:vml:MIN',
762 'DEF:vml_max={file}:vml:MAX',
763 'DEF:rss_avg={file}:rss:AVERAGE',
764 'DEF:rss_min={file}:rss:MIN',
765 'DEF:rss_max={file}:rss:MAX',
766 'DEF:anon_avg={file}:anon:AVERAGE',
767 'DEF:anon_min={file}:anon:MIN',
768 'DEF:anon_max={file}:anon:MAX',
769 "LINE1:vm_avg#$FullYellow:VM ",
770 'GPRINT:vm_min:MIN:%5.1lf%s Min,',
771 'GPRINT:vm_avg:AVERAGE:%5.1lf%s Avg.,',
772 'GPRINT:vm_max:MAX:%5.1lf%s Avg.,',
773 'GPRINT:vm_avg:LAST:%5.1lf%s Last\l',
774 "LINE1:vml_avg#$FullRed:Locked ",
775 'GPRINT:vml_min:MIN:%5.1lf%s Min,',
776 'GPRINT:vml_avg:AVERAGE:%5.1lf%s Avg.,',
777 'GPRINT:vml_max:MAX:%5.1lf%s Avg.,',
778 'GPRINT:vml_avg:LAST:%5.1lf%s Last\l',
779 "LINE1:rss_avg#$FullGreen:RSS ",
780 'GPRINT:rss_min:MIN:%5.1lf%s Min,',
781 'GPRINT:rss_avg:AVERAGE:%5.1lf%s Avg.,',
782 'GPRINT:rss_max:MAX:%5.1lf%s Avg.,',
783 'GPRINT:rss_avg:LAST:%5.1lf%s Last\l',
784 "LINE1:anon_avg#$FullBlue:Anon. ",
785 'GPRINT:anon_min:MIN:%5.1lf%s Min,',
786 'GPRINT:anon_avg:AVERAGE:%5.1lf%s Avg.,',
787 'GPRINT:anon_max:MAX:%5.1lf%s Avg.,',
788 'GPRINT:anon_avg:LAST:%5.1lf%s Last\l',
791 'DEF:proc_avg={file}:total:AVERAGE',
792 'DEF:proc_min={file}:total:MIN',
793 'DEF:proc_max={file}:total:MAX',
794 "AREA:proc_max#$HalfBlue",
795 "AREA:proc_min#$Canvas",
796 "LINE1:proc_avg#$FullBlue:Processes",
797 'GPRINT:proc_min:MIN:%4.1lf Min,',
798 'GPRINT:proc_avg:AVERAGE:%4.1lf Avg.,',
799 'GPRINT:proc_max:MAX:%4.1lf Max,',
800 'GPRINT:proc_avg:LAST:%4.1lf Last\l'
803 $GraphDefs->{'disk'} = $GraphDefs->{'partition'};
804 $GraphDefs->{'meminfo'} = $GraphDefs->{'memory'};
809 charge => ['-t', '{host} charge', '-v', 'Ampere hours'],
810 cpu => ['-t', '{host} cpu{inst} usage', '-v', 'Percent', '-l', '0'],
811 cpufreq => ['-t', '{host} cpu{inst} usage', '-v', 'Mhz'],
812 current => ['-t', '{host} current', '-v', 'Ampere'],
813 #disk => ['-t', '{host} disk {inst} IO wait', '-v', 'Seconds'],
814 df => ['-t', '{host}:{inst} usage', '-v', 'Percent', '-l', '0'],
815 disk => ['-t', '{host} disk {inst} usage', '-v', 'Byte/s'],
816 hddtemp => ['-t', '{host} hdd temperature {inst}', '-v', '°Celsius'],
817 load => ['-t', '{host} load average', '-v', 'System load', '-X', '0'],
818 mails => ['-t', '{host} mail count', '-v', 'Amount', '-X', '0'],
819 memory => ['-t', '{host} memory usage', '-v', 'Bytes', '-b', '1024', '-l', '0'],
820 mysql_commands => ['-t', 'mysql command {inst}', '-v', 'Issues/s' ],
821 mysql_handler => ['-t', 'mysql handler {inst}', '-v', 'Issues/s' ],
822 mysql_qcache => ['-t', 'mysql query cache', '-v', 'Queries/s' ],
823 mysql_threads => ['-t', 'mysql threads', '-v', 'Threads' ],
824 nfs3_procedures => ['-t', '{host} NFSv3 {inst} procedures', '-v', 'Procedures/s' ],
825 partition => ['-t', '{host} partition {inst} usage', '-v', 'Byte/s'],
826 ping => ['-t', '{host} ping to {inst}', '-v', 'ms'],
827 processes => ['-t', '{host} processes', '-v', 'Processes'],
828 sensors => ['-t', '{host} sensor {inst}', '-v', '°Celsius'],
829 swap => ['-t', '{host} swap usage', '-v', 'Bytes', '-b', '1024', '-l', '0'],
830 traffic => ['-t', '{host} {inst} traffic', '-v', 'Bit/s'],
831 users => ['-t', '{host} users', '-v', 'Users'],
832 voltage => ['-t', '{host} voltage', '-v', 'Volts'],
833 threads => ['-t', '{host} threads', '-v', 'Threads'],
834 vs_memory => ['-t', '{host} memory usage', '-v', 'Bytes'],
835 vs_processes => ['-t', '{host} processes', '-v', 'Processes'],
840 cpu => \&output_graph_cpu,
846 mysql_commands => \&output_graph_mysql_commands,
847 mysql_handler => \&output_graph_mysql_handler,
849 ping => \&output_graph_ping,
856 if (defined ($ENV{'GATEWAY_INTERFACE'}))
858 @Info = ($ENV{'PATH_INFO'} || '') =~ m#([\w\-\.]+)#g;
865 parse_pathinfo (@Info);
888 "DEF:user_avg_$_=$AbsDir/cpu-$_.rrd:user:AVERAGE",
889 "DEF:user_min_$_=$AbsDir/cpu-$_.rrd:user:MIN",
890 "DEF:user_max_$_=$AbsDir/cpu-$_.rrd:user:MAX",
891 "DEF:nice_avg_$_=$AbsDir/cpu-$_.rrd:nice:AVERAGE",
892 "DEF:nice_min_$_=$AbsDir/cpu-$_.rrd:nice:MIN",
893 "DEF:nice_max_$_=$AbsDir/cpu-$_.rrd:nice:MAX",
894 "DEF:syst_avg_$_=$AbsDir/cpu-$_.rrd:syst:AVERAGE",
895 "DEF:syst_min_$_=$AbsDir/cpu-$_.rrd:syst:MIN",
896 "DEF:syst_max_$_=$AbsDir/cpu-$_.rrd:syst:MAX",
897 "DEF:wait_avg_$_=$AbsDir/cpu-$_.rrd:wait:AVERAGE",
898 "DEF:wait_min_$_=$AbsDir/cpu-$_.rrd:wait:MIN",
899 "DEF:wait_max_$_=$AbsDir/cpu-$_.rrd:wait:MAX");
902 for (qw(user nice syst wait))
907 my $default_value = ($def eq 'user' or $def eq 'syst') ? 'UNKN' : '0';
909 for (qw(avg min max))
915 push (@ret, "CDEF:${def}_${cf}_notnull_${_}=${def}_${cf}_${_},UN,0,${def}_${cf}_${_},IF");
916 push (@ret, "CDEF:${def}_${cf}_defined_${_}=${def}_${cf}_${_},UN,0,1,IF");
919 $cdef = "CDEF:${def}_${cf}_num=" . join (',', map { "${def}_${cf}_defined_${_}" } (@inst));
920 $cdef .= ',+' x (scalar (@inst) - 1);
923 $cdef = "CDEF:${def}_${cf}=${def}_${cf}_num," . join (',', map { "${def}_${cf}_notnull_${_}" } (@inst));
924 $cdef .= ',+' x (scalar (@inst) - 1);
925 $cdef .= ",${def}_${cf}_num,${def}_${cf}_num,1,IF,/,$default_value,IF";
927 push (@ret, "CDEF:${def}_${cf}_notnull=${def}_${cf},UN,0,${def}_${cf},IF");
932 "CDEF:nice_acc=syst_avg_notnull,wait_avg_notnull,user_avg_notnull,nice_avg_notnull,+,+,+",
933 "CDEF:user_acc=syst_avg_notnull,wait_avg_notnull,user_avg_notnull,+,+",
934 "CDEF:wait_acc=syst_avg_notnull,wait_avg_notnull,+",
935 "CDEF:syst_acc=syst_avg_notnull");
937 push (@ret, grep { $_ !~ m/^C?DEF/ } (@{$GraphDefs->{'cpu'}}));
942 sub output_graph_ping
949 my @colors = get_n_colors (scalar (@inst));
951 for (my $i = 0; $i < scalar (@inst); $i++)
953 my $inst = $inst[$i];
955 "DEF:avg_$i=$AbsDir/ping-$inst.rrd:ping:AVERAGE",
956 "DEF:min_$i=$AbsDir/ping-$inst.rrd:ping:MIN",
957 "DEF:max_$i=$AbsDir/ping-$inst.rrd:ping:MAX");
960 for (my $i = 0; $i < scalar (@inst); $i++)
962 my $inst = $inst[$i];
963 my $color = $colors[$i];
965 if (length ($inst) > 15)
967 $inst = substr ($inst, 0, 12) . '...';
971 $inst = sprintf ('%-15s', $inst);
975 "LINE1:avg_$i#$color:$inst",
976 "GPRINT:min_$i:MIN:%4.1lf ms Min,",
977 "GPRINT:avg_$i:AVERAGE:%4.1lf ms Avg,",
978 "GPRINT:max_$i:MAX:%4.1lf ms Max,",
979 "GPRINT:avg_$i:LAST:%4.1lf ms Last\\l");
985 sub output_graph_mysql_commands
992 my @colors = get_n_colors (scalar (@inst));
994 for (my $i = 0; $i < scalar (@inst); $i++)
996 my $inst = $inst[$i];
998 "DEF:avg_$i=$AbsDir/mysql_commands-$inst.rrd:value:AVERAGE",
999 "DEF:min_$i=$AbsDir/mysql_commands-$inst.rrd:value:MIN",
1000 "DEF:max_$i=$AbsDir/mysql_commands-$inst.rrd:value:MAX");
1003 for (my $i = 0; $i < scalar (@inst); $i++)
1005 my $inst = $inst[$i];
1006 my $color = $colors[$i];
1008 if (length ($inst) > 18)
1010 $inst = substr ($inst, 0, 15) . '...';
1014 $inst = sprintf ('%-18s', $inst);
1018 "LINE1:avg_$i#$color:$inst",
1019 "GPRINT:min_$i:MIN:%6.1lf Min,",
1020 "GPRINT:avg_$i:AVERAGE:%6.1lf Avg,",
1021 "GPRINT:max_$i:MAX:%6.1lf Max,",
1022 "GPRINT:avg_$i:LAST:%6.1lf Last\\l");
1028 sub output_graph_mysql_handler
1035 my @colors = get_n_colors (scalar (@inst));
1037 for (my $i = 0; $i < scalar (@inst); $i++)
1039 my $inst = $inst[$i];
1041 "DEF:avg_$i=$AbsDir/mysql_handler-$inst.rrd:value:AVERAGE",
1042 "DEF:min_$i=$AbsDir/mysql_handler-$inst.rrd:value:MIN",
1043 "DEF:max_$i=$AbsDir/mysql_handler-$inst.rrd:value:MAX");
1046 for (my $i = 0; $i < scalar (@inst); $i++)
1048 my $inst = $inst[$i];
1049 my $color = $colors[$i];
1051 if (length ($inst) > 18)
1053 $inst = substr ($inst, 0, 15) . '...';
1057 $inst = sprintf ('%-18s', $inst);
1061 "LINE1:avg_$i#$color:$inst",
1062 "GPRINT:min_$i:MIN:%6.1lf Min,",
1063 "GPRINT:avg_$i:AVERAGE:%6.1lf Avg,",
1064 "GPRINT:max_$i:MAX:%6.1lf Max,",
1065 "GPRINT:avg_$i:LAST:%6.1lf Last\\l");
1073 die unless (defined ($GraphDefs->{$Type}));
1077 my $file = $AbsDir . '/';
1078 my $files = get_all_files ($AbsDir);
1083 if ($RelDir =~ m#([^/]+)$#)
1089 $host = $Config->{'HostName'};
1095 if ($TimeSpan =~ m/(\d+)/)
1097 $TimeSpan = -1 * int ($1);
1101 my %t = (hour => -3600, day => -86400, week => -604800, month => -2678400, year => -31622400);
1102 die unless (defined ($t{$TimeSpan}));
1103 $TimeSpan = $t{$TimeSpan};
1106 if (scalar (@{$files->{$Type}}) == 1)
1108 $Inst = $files->{$Type}[0];
1111 push (@cmd, '-', '-a', 'PNG', '-s', $TimeSpan);
1112 push (@cmd, @{$GraphArgs->{$Type}}) if (defined ($GraphArgs->{$Type}));
1114 for (qw(Back ShadeA ShadeB Font Canvas Grid MGrid Frame Arrow))
1116 push (@cmd, '-c', uc ($_) . '#' . $Config->{'Colors'}{$_});
1119 if ((length ($Inst) == 0) and (ref ($GraphMulti->{$Type}) eq 'CODE'))
1121 push (@cmd, $GraphMulti->{$Type}->(@{$files->{$Type}}));
1125 if (length ("$Inst"))
1127 $file .= "$Type-$Inst.rrd";
1131 $file .= "$Type.rrd";
1134 die ("File not found: $file") unless (-e $file);
1136 push (@cmd, @{$GraphDefs->{$Type}});
1141 $_ =~ s/{file}/$file/g;
1142 $_ =~ s/{host}/$host/g;
1143 $_ =~ s/{inst}/$Inst/g;
1144 $_ =~ s/{type}/$Type/g;
1149 print STDOUT <<HEADER if (defined ($ENV{'GATEWAY_INTERFACE'}));
1150 Content-Type: image/png
1151 Cache-Control: no-cache
1158 open ($fh, ">/tmp/collection.log") or die ("open: $!");
1159 flock ($fh, LOCK_EX) or die ("flock: $!");
1161 print $fh join ("\n\t", @cmd) . "\n";
1168 die ('RRDs::error: ' . RRDs::error ()) if (RRDs::error ());
1173 my $files = get_all_files ($AbsDir);
1174 my $dirs = get_all_dirs ($AbsDir);
1176 print STDOUT <<HEADER if (defined ($ENV{'GATEWAY_INTERFACE'}));
1177 Content-Type: text/html
1178 Cache-Control: no-cache
1182 <title>Collection: $RelDir</title>
1183 <style type="text/css">
1184 img { border: none; display: block; }
1191 my $MySelf = defined ($ENV{'GATEWAY_INTERFACE'}) ? $ENV{'SCRIPT_NAME'} : $0;
1193 if ((length ($Type) != 0) and (length ($Inst) == 0) and (ref ($GraphMulti->{$Type}) eq 'CODE') and (scalar (@{$files->{$Type}}) > 1))
1195 print qq(\t\t<div><a href="$MySelf$RelDir">Go up</a></div>\n);
1198 for (@{$files->{$Type}})
1200 print qq(\t\t\t<li><a href="$MySelf$RelDir/$Type/$_">$_</a></li>\n);
1206 <div><img src="$MySelf$RelDir/$Type/day" /></div>
1208 <div><img src="$MySelf$RelDir/$Type/week" /></div>
1210 <div><img src="$MySelf$RelDir/$Type/month" /></div>
1212 <div><img src="$MySelf$RelDir/$Type/year" /></div>
1215 elsif (length ($Type) != 0)
1217 my $ext = length ($Inst) ? "$Type/$Inst" : $Type;
1219 if ((ref ($GraphMulti->{$Type}) eq 'CODE') and (scalar (@{$files->{$Type}}) > 1))
1221 print qq(<div><a href="$MySelf$RelDir/$Type">Go up</a></div>\n);
1225 print qq(<div><a href="$MySelf$RelDir">Go up</a></div>\n);
1230 <div><img src="$MySelf$RelDir/$ext/day" /></div>
1232 <div><img src="$MySelf$RelDir/$ext/week" /></div>
1234 <div><img src="$MySelf$RelDir/$ext/month" /></div>
1236 <div><img src="$MySelf$RelDir/$ext/year" /></div>
1243 my ($up) = $RelDir =~ m#(.*)/[^/]+$#;
1244 print qq(\t\t<div><a href="$MySelf$up">Go up</a></div>\n);
1252 print qq(<li>$AbsDir/<a href="$MySelf$RelDir/$_">$_</a></li>\n);
1257 for (sort (keys %$files))
1261 if (ref ($GraphMulti->{$type}) eq 'CODE')
1263 print qq(\t\t<a href="$MySelf$RelDir/$type" />),
1264 qq(<img src="$MySelf$RelDir/$type/day" /></a>\n);
1268 for (@{$files->{$type}})
1274 print qq(\t\t<a href="$MySelf$RelDir/$type/$inst" />),
1275 qq(<img src="$MySelf$RelDir/$type/$inst/day" /></a>\n);
1279 print qq(\t\t<a href="$MySelf$RelDir/$type" />),
1280 qq(<img src="$MySelf$RelDir/$type/day" /></a>\n);
1286 print STDOUT <<FOOTER if (defined ($ENV{'GATEWAY_INTERFACE'}));
1294 my $files = get_all_files ();
1296 print STDOUT <<HEADER if (defined ($ENV{'GATEWAY_INTERFACE'}));
1297 Content-Type: text/xml
1298 Cache-Control: no-cache
1301 print STDOUT pl2xml ($files);
1306 my $file = @_ ? shift : '/etc/collection.conf';
1310 # if (open ($fh, "< $file"))
1318 # $conf = xml2pl ($xml);
1338 FullRed => 'FF0000',
1339 FullBlue => '0000FF',
1340 FullGreen => '00E000',
1341 FullYellow => 'F0A000',
1342 FullCyan => '00A0FF',
1343 FullMagenta => 'A000FF',
1345 HalfRed => 'F8B8B8',
1346 HalfBlue => 'B8B8F8',
1347 HalfGreen => 'B8F0B8',
1348 HalfYellow => 'F4F4B8'
1350 Directory => '/var/lib/collectd',
1351 HostName => (defined ($ENV{'SERVER_NAME'}) ? $ENV{'SERVER_NAME'} : 'localhost')
1364 $AbsDir = $Config->{'Directory'};
1367 while (@info and -d $AbsDir . '/' . $Info[0])
1369 my $new = shift (@info);
1370 next if ($new =~ m/^\./);
1372 $AbsDir .= '/' . $new;
1373 $RelDir .= '/' . $new;
1380 confess ("parse_pathinfo: too many elements in pathinfo") if (scalar (@info) > 3);
1381 return unless (@info);
1383 $Type = shift (@info);
1384 return unless (@info);
1386 if ($info[-1] =~ m/^(hour|day|week|month|year)$/i)
1388 $TimeSpan = pop (@info);
1391 $Inst = shift (@info) if (@info);
1393 confess ("unrecognized elements in pathinfo") if (@info);
1398 my $dir = @_ ? shift : $Config->{'Directory'};
1402 if (opendir ($dh, $dir))
1404 while (my $thing = readdir ($dh))
1406 next if ($thing =~ m/^\./);
1411 if ($thing =~ m/^(\w+)-([\w\-\.]+)\.rrd$/)
1416 elsif ($thing =~ m/^(\w+)\.rrd$/)
1426 # Only load RRD files we can actually display..
1427 next unless (defined ($GraphDefs->{$type}));
1429 $hash->{$type} = [] unless (defined ($hash->{$type}));
1430 push (@{$hash->{$type}}, $inst);
1441 my $dir = @_ ? shift : $Config->{'Directory'};
1445 if (opendir ($dh, $dir))
1447 while (my $thing = readdir ($dh))
1449 next if ($thing =~ m/^\./);
1451 next if (!-d "$dir/$thing");
1453 push (@ret, $thing);
1459 return (@ret) if (wantarray ());
1467 my ($red, $green, $blue) = map { ord (pack ("H2", $_)) } ($color =~ m/([A-Fa-f0-9]{2})/g);
1468 #print STDERR "$color -> rgb($red,$green,$blue)\n";
1470 return ($red, $green, $blue);
1475 croak unless (scalar (@_) == 3);
1477 my ($red, $green, $blue) = @_;
1479 my $ret = sprintf ("%02X%02X%02X", $red, $green, $blue);
1480 #print STDERR "rgb($red,$green,$blue) -> $ret\n";
1485 sub color_calculate_transparent
1488 my $canvas = [color_hex2rgb (shift)];
1489 my @colors = map { [color_hex2rgb ($_)] } (@_);
1491 if (($alpha < 0.0) or ($alpha > 1.0))
1498 return (color_rgb2hex (@$canvas));
1502 return (color_rgb2hex (@{$colors[-1]}));
1505 my $ret = _color_calculate_transparent ($alpha, $canvas, @colors);
1507 return (color_rgb2hex (@$ret));
1510 sub _color_calculate_transparent
1515 my @colors = @_ ? shift : ();
1516 my $ret = [0, 0, 0];
1518 for (my $i = 0; $i < 3; $i++)
1520 $ret->[$i] = ($alpha * $color->[$i]) + ((1 - $alpha) * $canvas->[$i]);
1523 return (_color_calculate_transparent ($alpha, $ret, @colors)) if (@colors);
1532 for (my $i = 0; $i < $num; $i++)
1534 my $pos = 6 * $i / $num;
1575 push (@ret, sprintf ("%02x%02x%02x", $red, $green, $blue));