Merge branch 'collectd-5.4' into collectd-5.5
[collectd.git] / contrib / php-collection / definitions.php
1 <?php // vim:fenc=utf-8:filetype=php:ts=4
2 /*
3  * Copyright (C) 2009  Bruno PrĂ©mont <bonbons AT linux-vserver.org>
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License as published by the Free Software
7  * Foundation; only version 2 of the License is applicable.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  *
18  *
19  * Most RRD Graph definitions copied from collection.cgi
20  */
21 $GraphDefs     = array();
22 $MetaGraphDefs = array();
23
24 if (is_file('definitions.local.php'))
25         require_once('definitions.local.php');
26
27 function load_graph_definitions($logarithmic = false, $tinylegend = false) {
28         global $GraphDefs, $MetaGraphDefs;
29
30         $Canvas   = 'FFFFFF';
31
32         $FullRed    = 'FF0000';
33         $FullGreen  = '00E000';
34         $FullBlue   = '0000FF';
35         $FullYellow = 'F0A000';
36         $FullCyan   = '00A0FF';
37         $FullMagenta= 'A000FF';
38
39         $HalfRed    = 'F7B7B7';
40         $HalfGreen  = 'B7EFB7';
41         $HalfBlue   = 'B7B7F7';
42         $HalfYellow = 'F3DFB7';
43         $HalfCyan   = 'B7DFF7';
44         $HalfMagenta= 'DFB7F7';
45
46         $HalfBlueGreen = '89B3C9';
47
48         $GraphDefs = array();
49         $GraphDefs['apache_bytes'] = array(
50                 '-v', 'Bits/s',
51                 'DEF:min_raw={file}:value:MIN',
52                 'DEF:avg_raw={file}:value:AVERAGE',
53                 'DEF:max_raw={file}:value:MAX',
54                 'CDEF:min=min_raw,8,*',
55                 'CDEF:avg=avg_raw,8,*',
56                 'CDEF:max=max_raw,8,*',
57                 'CDEF:mytime=avg_raw,TIME,TIME,IF',
58                 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
59                 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
60                 'CDEF:avg_sample=avg_raw,UN,0,avg_raw,IF,sample_len,*',
61                 'CDEF:avg_sum=PREV,UN,0,PREV,IF,avg_sample,+',
62                 "AREA:avg#$HalfBlue",
63                 "LINE1:avg#$FullBlue:Bit/s",
64                 'GPRINT:min:MIN:%5.1lf%s Min,',
65                 'GPRINT:avg:AVERAGE:%5.1lf%s Avg,',
66                 'GPRINT:max:MAX:%5.1lf%s Max,',
67                 'GPRINT:avg:LAST:%5.1lf%s Last',
68                 'GPRINT:avg_sum:LAST:(ca. %5.1lf%sB Total)\l');
69         $GraphDefs['apache_requests'] = array(
70                 '-v', 'Requests/s',
71                 'DEF:min={file}:value:MIN',
72                 'DEF:avg={file}:value:AVERAGE',
73                 'DEF:max={file}:value:MAX',
74                 "AREA:max#$HalfBlue",
75                 "AREA:min#$Canvas",
76                 "LINE1:avg#$FullBlue:Requests/s",
77                 'GPRINT:min:MIN:%6.2lf Min,',
78                 'GPRINT:avg:AVERAGE:%6.2lf Avg,',
79                 'GPRINT:max:MAX:%6.2lf Max,',
80                 'GPRINT:avg:LAST:%6.2lf Last');
81         $GraphDefs['apache_scoreboard'] = array(
82                 'DEF:min={file}:value:MIN',
83                 'DEF:avg={file}:value:AVERAGE',
84                 'DEF:max={file}:value:MAX',
85                 "AREA:max#$HalfBlue",
86                 "AREA:min#$Canvas",
87                 "LINE1:avg#$FullBlue:Processes",
88                 'GPRINT:min:MIN:%6.2lf Min,',
89                 'GPRINT:avg:AVERAGE:%6.2lf Avg,',
90                 'GPRINT:max:MAX:%6.2lf Max,',
91                 'GPRINT:avg:LAST:%6.2lf Last');
92         $GraphDefs['bitrate'] = array(
93                 '-v', 'Bits/s',
94                 'DEF:avg={file}:value:AVERAGE',
95                 'DEF:min={file}:value:MIN',
96                 'DEF:max={file}:value:MAX',
97                 "AREA:max#$HalfBlue",
98                 "AREA:min#$Canvas",
99                 "LINE1:avg#$FullBlue:Bits/s",
100                 'GPRINT:min:MIN:%5.1lf%s Min,',
101                 'GPRINT:avg:AVERAGE:%5.1lf%s Average,',
102                 'GPRINT:max:MAX:%5.1lf%s Max,',
103                 'GPRINT:avg:LAST:%5.1lf%s Last\l');
104         $GraphDefs['charge'] = array(
105                 '-v', 'Ah',
106                 'DEF:avg={file}:value:AVERAGE',
107                 'DEF:min={file}:value:MIN',
108                 'DEF:max={file}:value:MAX',
109                 "AREA:max#$HalfBlue",
110                 "AREA:min#$Canvas",
111                 "LINE1:avg#$FullBlue:Charge",
112                 'GPRINT:min:MIN:%5.1lf%sAh Min,',
113                 'GPRINT:avg:AVERAGE:%5.1lf%sAh Avg,',
114                 'GPRINT:max:MAX:%5.1lf%sAh Max,',
115                 'GPRINT:avg:LAST:%5.1lf%sAh Last\l');
116         $GraphDefs['counter'] = array(
117                 '-v', 'Events',
118                 'DEF:avg={file}:value:AVERAGE',
119                 'DEF:min={file}:value:MIN',
120                 'DEF:max={file}:value:MAX',
121                 "AREA:max#$HalfBlue",
122                 "AREA:min#$Canvas",
123                 "LINE1:avg#$FullBlue:Percent",
124                 'GPRINT:min:MIN:%6.2lf%% Min,',
125                 'GPRINT:avg:AVERAGE:%6.2lf%% Avg,',
126                 'GPRINT:max:MAX:%6.2lf%% Max,',
127                 'GPRINT:avg:LAST:%6.2lf%% Last\l');
128                 $GraphDefs['cpu'] = array(
129                 '-v', 'CPU load',
130                 'DEF:avg={file}:value:AVERAGE',
131                 'DEF:min={file}:value:MIN',
132                 'DEF:max={file}:value:MAX',
133                 "AREA:max#$HalfBlue",
134                 "AREA:min#$Canvas",
135                 "LINE1:avg#$FullBlue:Percent",
136                 'GPRINT:min:MIN:%6.2lf%% Min,',
137                 'GPRINT:avg:AVERAGE:%6.2lf%% Avg,',
138                 'GPRINT:max:MAX:%6.2lf%% Max,',
139                 'GPRINT:avg:LAST:%6.2lf%% Last\l');
140         $GraphDefs['current'] = array(
141                 '-v', 'Ampere',
142                 'DEF:avg={file}:value:AVERAGE',
143                 'DEF:min={file}:value:MIN',
144                 'DEF:max={file}:value:MAX',
145                 "AREA:max#$HalfBlue",
146                 "AREA:min#$Canvas",
147                 "LINE1:avg#$FullBlue:Current",
148                 'GPRINT:min:MIN:%5.1lf%sA Min,',
149                 'GPRINT:avg:AVERAGE:%5.1lf%sA Avg,',
150                 'GPRINT:max:MAX:%5.1lf%sA Max,',
151                 'GPRINT:avg:LAST:%5.1lf%sA Last\l');
152         $GraphDefs['df'] = array(
153                 '-v', 'Percent', '-l', '0',
154                 'DEF:free_avg={file}:free:AVERAGE',
155                 'DEF:free_min={file}:free:MIN',
156                 'DEF:free_max={file}:free:MAX',
157                 'DEF:used_avg={file}:used:AVERAGE',
158                 'DEF:used_min={file}:used:MIN',
159                 'DEF:used_max={file}:used:MAX',
160                 'CDEF:total=free_avg,used_avg,+',
161                 'CDEF:free_pct=100,free_avg,*,total,/',
162                 'CDEF:used_pct=100,used_avg,*,total,/',
163                 'CDEF:free_acc=free_pct,used_pct,+',
164                 'CDEF:used_acc=used_pct',
165                 "AREA:free_acc#$HalfGreen",
166                 "AREA:used_acc#$HalfRed",
167                 "LINE1:free_acc#$FullGreen:Free",
168                 'GPRINT:free_min:MIN:%5.1lf%sB Min,',
169                 'GPRINT:free_avg:AVERAGE:%5.1lf%sB Avg,',
170                 'GPRINT:free_max:MAX:%5.1lf%sB Max,',
171                 'GPRINT:free_avg:LAST:%5.1lf%sB Last\l',
172                 "LINE1:used_acc#$FullRed:Used",
173                 'GPRINT:used_min:MIN:%5.1lf%sB Min,',
174                 'GPRINT:used_avg:AVERAGE:%5.1lf%sB Avg,',
175                 'GPRINT:used_max:MAX:%5.1lf%sB Max,',
176                 'GPRINT:used_avg:LAST:%5.1lf%sB Last\l');
177         $GraphDefs['disk'] = array(
178                 'DEF:rtime_avg={file}:rtime:AVERAGE',
179                 'DEF:rtime_min={file}:rtime:MIN',
180                 'DEF:rtime_max={file}:rtime:MAX',
181                 'DEF:wtime_avg={file}:wtime:AVERAGE',
182                 'DEF:wtime_min={file}:wtime:MIN',
183                 'DEF:wtime_max={file}:wtime:MAX',
184                 'CDEF:rtime_avg_ms=rtime_avg,1000,/',
185                 'CDEF:rtime_min_ms=rtime_min,1000,/',
186                 'CDEF:rtime_max_ms=rtime_max,1000,/',
187                 'CDEF:wtime_avg_ms=wtime_avg,1000,/',
188                 'CDEF:wtime_min_ms=wtime_min,1000,/',
189                 'CDEF:wtime_max_ms=wtime_max,1000,/',
190                 'CDEF:total_avg_ms=rtime_avg_ms,wtime_avg_ms,+',
191                 'CDEF:total_min_ms=rtime_min_ms,wtime_min_ms,+',
192                 'CDEF:total_max_ms=rtime_max_ms,wtime_max_ms,+',
193                 "AREA:total_max_ms#$HalfRed",
194                 "AREA:total_min_ms#$Canvas",
195                 "LINE1:wtime_avg_ms#$FullGreen:Write",
196                 'GPRINT:wtime_min_ms:MIN:%5.1lf%s Min,',
197                 'GPRINT:wtime_avg_ms:AVERAGE:%5.1lf%s Avg,',
198                 'GPRINT:wtime_max_ms:MAX:%5.1lf%s Max,',
199                 'GPRINT:wtime_avg_ms:LAST:%5.1lf%s Last\n',
200                 "LINE1:rtime_avg_ms#$FullBlue:Read ",
201                 'GPRINT:rtime_min_ms:MIN:%5.1lf%s Min,',
202                 'GPRINT:rtime_avg_ms:AVERAGE:%5.1lf%s Avg,',
203                 'GPRINT:rtime_max_ms:MAX:%5.1lf%s Max,',
204                 'GPRINT:rtime_avg_ms:LAST:%5.1lf%s Last\n',
205                 "LINE1:total_avg_ms#$FullRed:Total",
206                 'GPRINT:total_min_ms:MIN:%5.1lf%s Min,',
207                 'GPRINT:total_avg_ms:AVERAGE:%5.1lf%s Avg,',
208                 'GPRINT:total_max_ms:MAX:%5.1lf%s Max,',
209                 'GPRINT:total_avg_ms:LAST:%5.1lf%s Last');
210         $GraphDefs['disk_octets'] = array(
211                 '-v', 'Bytes/s', '--units=si',
212                 'DEF:out_min={file}:write:MIN',
213                 'DEF:out_avg={file}:write:AVERAGE',
214                 'DEF:out_max={file}:write:MAX',
215                 'DEF:inc_min={file}:read:MIN',
216                 'DEF:inc_avg={file}:read:AVERAGE',
217                 'DEF:inc_max={file}:read:MAX',
218                 'CDEF:overlap=out_avg,inc_avg,GT,inc_avg,out_avg,IF',
219                 'CDEF:mytime=out_avg,TIME,TIME,IF',
220                 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
221                 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
222                 'CDEF:out_avg_sample=out_avg,UN,0,out_avg,IF,sample_len,*',
223                 'CDEF:out_avg_sum=PREV,UN,0,PREV,IF,out_avg_sample,+',
224                 'CDEF:inc_avg_sample=inc_avg,UN,0,inc_avg,IF,sample_len,*',
225                 'CDEF:inc_avg_sum=PREV,UN,0,PREV,IF,inc_avg_sample,+',
226                 "AREA:out_avg#$HalfGreen",
227                 "AREA:inc_avg#$HalfBlue",
228                 "AREA:overlap#$HalfBlueGreen",
229                 "LINE1:out_avg#$FullGreen:Written",
230                 'GPRINT:out_avg:AVERAGE:%5.1lf%s Avg,',
231                 'GPRINT:out_max:MAX:%5.1lf%s Max,',
232                 'GPRINT:out_avg:LAST:%5.1lf%s Last',
233                 'GPRINT:out_avg_sum:LAST:(ca. %5.1lf%sB Total)\l',
234                 "LINE1:inc_avg#$FullBlue:Read   ",
235                 'GPRINT:inc_avg:AVERAGE:%5.1lf%s Avg,',
236                 'GPRINT:inc_max:MAX:%5.1lf%s Max,',
237                 'GPRINT:inc_avg:LAST:%5.1lf%s Last',
238                 'GPRINT:inc_avg_sum:LAST:(ca. %5.1lf%sB Total)\l');
239         $GraphDefs['disk_merged'] = array(
240                 '-v', 'Merged Ops/s', '--units=si',
241                 'DEF:out_min={file}:write:MIN',
242                 'DEF:out_avg={file}:write:AVERAGE',
243                 'DEF:out_max={file}:write:MAX',
244                 'DEF:inc_min={file}:read:MIN',
245                 'DEF:inc_avg={file}:read:AVERAGE',
246                 'DEF:inc_max={file}:read:MAX',
247                 'CDEF:overlap=out_avg,inc_avg,GT,inc_avg,out_avg,IF',
248                 "AREA:out_avg#$HalfGreen",
249                 "AREA:inc_avg#$HalfBlue",
250                 "AREA:overlap#$HalfBlueGreen",
251                 "LINE1:out_avg#$FullGreen:Written",
252                 'GPRINT:out_avg:AVERAGE:%6.2lf Avg,',
253                 'GPRINT:out_max:MAX:%6.2lf Max,',
254                 'GPRINT:out_avg:LAST:%6.2lf Last\l',
255                 "LINE1:inc_avg#$FullBlue:Read   ",
256                 'GPRINT:inc_avg:AVERAGE:%6.2lf Avg,',
257                 'GPRINT:inc_max:MAX:%6.2lf Max,',
258                 'GPRINT:inc_avg:LAST:%6.2lf Last\l');
259                 $GraphDefs['disk_ops'] = array(
260                 '-v', 'Ops/s', '--units=si',
261                 'DEF:out_min={file}:write:MIN',
262                 'DEF:out_avg={file}:write:AVERAGE',
263                 'DEF:out_max={file}:write:MAX',
264                 'DEF:inc_min={file}:read:MIN',
265                 'DEF:inc_avg={file}:read:AVERAGE',
266                 'DEF:inc_max={file}:read:MAX',
267                 'CDEF:overlap=out_avg,inc_avg,GT,inc_avg,out_avg,IF',
268                 "AREA:out_avg#$HalfGreen",
269                 "AREA:inc_avg#$HalfBlue",
270                 "AREA:overlap#$HalfBlueGreen",
271                 "LINE1:out_avg#$FullGreen:Written",
272                 'GPRINT:out_avg:AVERAGE:%6.2lf Avg,',
273                 'GPRINT:out_max:MAX:%6.2lf Max,',
274                 'GPRINT:out_avg:LAST:%6.2lf Last\l',
275                 "LINE1:inc_avg#$FullBlue:Read   ",
276                 'GPRINT:inc_avg:AVERAGE:%6.2lf Avg,',
277                 'GPRINT:inc_max:MAX:%6.2lf Max,',
278                 'GPRINT:inc_avg:LAST:%6.2lf Last\l');
279         $GraphDefs['disk_time'] = array(
280                 '-v', 'Seconds/s',
281                 'DEF:out_min_raw={file}:write:MIN',
282                 'DEF:out_avg_raw={file}:write:AVERAGE',
283                 'DEF:out_max_raw={file}:write:MAX',
284                 'DEF:inc_min_raw={file}:read:MIN',
285                 'DEF:inc_avg_raw={file}:read:AVERAGE',
286                 'DEF:inc_max_raw={file}:read:MAX',
287                 'CDEF:out_min=out_min_raw,1000,/',
288                 'CDEF:out_avg=out_avg_raw,1000,/',
289                 'CDEF:out_max=out_max_raw,1000,/',
290                 'CDEF:inc_min=inc_min_raw,1000,/',
291                 'CDEF:inc_avg=inc_avg_raw,1000,/',
292                 'CDEF:inc_max=inc_max_raw,1000,/',
293                 'CDEF:overlap=out_avg,inc_avg,GT,inc_avg,out_avg,IF',
294                 "AREA:out_avg#$HalfGreen",
295                 "AREA:inc_avg#$HalfBlue",
296                 "AREA:overlap#$HalfBlueGreen",
297                 "LINE1:out_avg#$FullGreen:Written",
298                 'GPRINT:out_avg:AVERAGE:%5.1lf%ss Avg,',
299                 'GPRINT:out_max:MAX:%5.1lf%ss Max,',
300                 'GPRINT:out_avg:LAST:%5.1lf%ss Last\l',
301                 "LINE1:inc_avg#$FullBlue:Read   ",
302                 'GPRINT:inc_avg:AVERAGE:%5.1lf%ss Avg,',
303                 'GPRINT:inc_max:MAX:%5.1lf%ss Max,',
304                 'GPRINT:inc_avg:LAST:%5.1lf%ss Last\l');
305         $GraphDefs['dns_traffic'] = array(
306                 'DEF:rsp_min_raw={file}:responses:MIN',
307                 'DEF:rsp_avg_raw={file}:responses:AVERAGE',
308                 'DEF:rsp_max_raw={file}:responses:MAX',
309                 'DEF:qry_min_raw={file}:queries:MIN',
310                 'DEF:qry_avg_raw={file}:queries:AVERAGE',
311                 'DEF:qry_max_raw={file}:queries:MAX',
312                 'CDEF:rsp_min=rsp_min_raw,8,*',
313                 'CDEF:rsp_avg=rsp_avg_raw,8,*',
314                 'CDEF:rsp_max=rsp_max_raw,8,*',
315                 'CDEF:qry_min=qry_min_raw,8,*',
316                 'CDEF:qry_avg=qry_avg_raw,8,*',
317                 'CDEF:qry_max=qry_max_raw,8,*',
318                 'CDEF:overlap=rsp_avg,qry_avg,GT,qry_avg,rsp_avg,IF',
319                 'CDEF:mytime=rsp_avg_raw,TIME,TIME,IF',
320                 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
321                 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
322                 'CDEF:rsp_avg_sample=rsp_avg_raw,UN,0,rsp_avg_raw,IF,sample_len,*',
323                 'CDEF:rsp_avg_sum=PREV,UN,0,PREV,IF,rsp_avg_sample,+',
324                 'CDEF:qry_avg_sample=qry_avg_raw,UN,0,qry_avg_raw,IF,sample_len,*',
325                 'CDEF:qry_avg_sum=PREV,UN,0,PREV,IF,qry_avg_sample,+',
326                 "AREA:rsp_avg#$HalfGreen",
327                 "AREA:qry_avg#$HalfBlue",
328                 "AREA:overlap#$HalfBlueGreen",
329                 "LINE1:rsp_avg#$FullGreen:Responses",
330                 'GPRINT:rsp_avg:AVERAGE:%5.1lf%s Avg,',
331                 'GPRINT:rsp_max:MAX:%5.1lf%s Max,',
332                 'GPRINT:rsp_avg:LAST:%5.1lf%s Last',
333                 'GPRINT:rsp_avg_sum:LAST:(ca. %5.1lf%sB Total)\l',
334                 "LINE1:qry_avg#$FullBlue:Queries  ",
335 //                      'GPRINT:qry_min:MIN:%5.1lf %s Min,',
336                 'GPRINT:qry_avg:AVERAGE:%5.1lf%s Avg,',
337                 'GPRINT:qry_max:MAX:%5.1lf%s Max,',
338                 'GPRINT:qry_avg:LAST:%5.1lf%s Last',
339                 'GPRINT:qry_avg_sum:LAST:(ca. %5.1lf%sB Total)\l');
340         $GraphDefs['email_count'] = array(
341                 '-v', 'Mails',
342                 'DEF:avg={file}:value:AVERAGE',
343                 'DEF:min={file}:value:MIN',
344                 'DEF:max={file}:value:MAX',
345                 "AREA:max#$HalfMagenta",
346                 "AREA:min#$Canvas",
347                 "LINE1:avg#$FullMagenta:Count ",
348                 'GPRINT:min:MIN:%4.1lf Min,',
349                 'GPRINT:avg:AVERAGE:%4.1lf Avg,',
350                 'GPRINT:max:MAX:%4.1lf Max,',
351                 'GPRINT:avg:LAST:%4.1lf Last\l');
352         $GraphDefs['files'] = $GraphDefs['email_count'];
353         $GraphDefs['email_size'] = array(
354                 '-v', 'Bytes',
355                 'DEF:avg={file}:value:AVERAGE',
356                 'DEF:min={file}:value:MIN',
357                 'DEF:max={file}:value:MAX',
358                 "AREA:max#$HalfMagenta",
359                 "AREA:min#$Canvas",
360                 "LINE1:avg#$FullMagenta:Count ",
361                 'GPRINT:min:MIN:%4.1lf Min,',
362                 'GPRINT:avg:AVERAGE:%4.1lf Avg,',
363                 'GPRINT:max:MAX:%4.1lf Max,',
364                 'GPRINT:avg:LAST:%4.1lf Last\l');
365         $GraphDefs['bytes'] = $GraphDefs['email_size'];
366         $GraphDefs['spam_score'] = array(
367                 '-v', 'Score',
368                 'DEF:avg={file}:value:AVERAGE',
369                 'DEF:min={file}:value:MIN',
370                 'DEF:max={file}:value:MAX',
371                 "AREA:max#$HalfBlue",
372                 "AREA:min#$Canvas",
373                 "LINE1:avg#$FullBlue:Score ",
374                 'GPRINT:min:MIN:%4.1lf Min,',
375                 'GPRINT:avg:AVERAGE:%4.1lf Avg,',
376                 'GPRINT:max:MAX:%4.1lf Max,',
377                 'GPRINT:avg:LAST:%4.1lf Last\l');
378         $GraphDefs['spam_check'] = array(
379                 'DEF:avg={file}:hits:AVERAGE',
380                 'DEF:min={file}:hits:MIN',
381                 'DEF:max={file}:hits:MAX',
382                 "AREA:max#$HalfMagenta",
383                 "AREA:min#$Canvas",
384                 "LINE1:avg#$FullMagenta:Count ",
385                 'GPRINT:min:MIN:%4.1lf Min,',
386                 'GPRINT:avg:AVERAGE:%4.1lf Avg,',
387                 'GPRINT:max:MAX:%4.1lf Max,',
388                 'GPRINT:avg:LAST:%4.1lf Last\l');
389         $GraphDefs['conntrack'] = array(
390                 '-v', 'Entries',
391                 'DEF:avg={file}:entropy:AVERAGE',
392                 'DEF:min={file}:entropy:MIN',
393                 'DEF:max={file}:entropy:MAX',
394                 "AREA:max#$HalfBlue",
395                 "AREA:min#$Canvas",
396                 "LINE1:avg#$FullBlue:Count",
397                 'GPRINT:min:MIN:%4.0lf Min,',
398                 'GPRINT:avg:AVERAGE:%4.0lf Avg,',
399                 'GPRINT:max:MAX:%4.0lf Max,',
400                 'GPRINT:avg:LAST:%4.0lf Last\l');
401         $GraphDefs['entropy'] = array(
402                 '-v', 'Bits',
403                 'DEF:avg={file}:entropy:AVERAGE',
404                 'DEF:min={file}:entropy:MIN',
405                 'DEF:max={file}:entropy:MAX',
406                 "AREA:max#$HalfBlue",
407                 "AREA:min#$Canvas",
408                 "LINE1:avg#$FullBlue:Bits",
409                 'GPRINT:min:MIN:%4.0lfbit Min,',
410                 'GPRINT:avg:AVERAGE:%4.0lfbit Avg,',
411                 'GPRINT:max:MAX:%4.0lfbit Max,',
412                 'GPRINT:avg:LAST:%4.0lfbit Last\l');
413         $GraphDefs['fanspeed'] = array(
414                 '-v', 'RPM',
415                 'DEF:avg={file}:value:AVERAGE',
416                 'DEF:min={file}:value:MIN',
417                 'DEF:max={file}:value:MAX',
418                 "AREA:max#$HalfMagenta",
419                 "AREA:min#$Canvas",
420                 "LINE1:avg#$FullMagenta:RPM",
421                 'GPRINT:min:MIN:%4.1lf Min,',
422                 'GPRINT:avg:AVERAGE:%4.1lf Avg,',
423                 'GPRINT:max:MAX:%4.1lf Max,',
424                 'GPRINT:avg:LAST:%4.1lf Last\l');
425         $GraphDefs['frequency'] = array(
426                 '-v', 'Hertz',
427                 'DEF:avg={file}:frequency:AVERAGE',
428                 'DEF:min={file}:frequency:MIN',
429                 'DEF:max={file}:frequency:MAX',
430                 "AREA:max#$HalfBlue",
431                 "AREA:min#$Canvas",
432                 "LINE1:avg#$FullBlue:Frequency [Hz]",
433                 'GPRINT:min:MIN:%4.1lf Min,',
434                 'GPRINT:avg:AVERAGE:%4.1lf Avg,',
435                 'GPRINT:max:MAX:%4.1lf Max,',
436                 'GPRINT:avg:LAST:%4.1lf Last\l');
437         $GraphDefs['frequency_offset'] = array( // NTPd
438                 'DEF:ppm_avg={file}:ppm:AVERAGE',
439                 'DEF:ppm_min={file}:ppm:MIN',
440                 'DEF:ppm_max={file}:ppm:MAX',
441                 "AREA:ppm_max#$HalfBlue",
442                 "AREA:ppm_min#$Canvas",
443                 "LINE1:ppm_avg#$FullBlue:{inst}",
444                 'GPRINT:ppm_min:MIN:%5.2lf Min,',
445                 'GPRINT:ppm_avg:AVERAGE:%5.2lf Avg,',
446                 'GPRINT:ppm_max:MAX:%5.2lf Max,',
447                 'GPRINT:ppm_avg:LAST:%5.2lf Last');
448         $GraphDefs['gauge'] = array(
449                 '-v', 'Exec value',
450                 'DEF:temp_avg={file}:value:AVERAGE',
451                 'DEF:temp_min={file}:value:MIN',
452                 'DEF:temp_max={file}:value:MAX',
453                 "AREA:temp_max#$HalfBlue",
454                 "AREA:temp_min#$Canvas",
455                 "LINE1:temp_avg#$FullBlue:Exec value",
456                 'GPRINT:temp_min:MIN:%6.2lf Min,',
457                 'GPRINT:temp_avg:AVERAGE:%6.2lf Avg,',
458                 'GPRINT:temp_max:MAX:%6.2lf Max,',
459                 'GPRINT:temp_avg:LAST:%6.2lf Last\l');
460         $GraphDefs['hddtemp'] = array(
461                 '-v', '°C',
462                 'DEF:temp_avg={file}:value:AVERAGE',
463                 'DEF:temp_min={file}:value:MIN',
464                 'DEF:temp_max={file}:value:MAX',
465                 "AREA:temp_max#$HalfRed",
466                 "AREA:temp_min#$Canvas",
467                 "LINE1:temp_avg#$FullRed:Temperature",
468                 'GPRINT:temp_min:MIN:%4.1lf Min,',
469                 'GPRINT:temp_avg:AVERAGE:%4.1lf Avg,',
470                 'GPRINT:temp_max:MAX:%4.1lf Max,',
471                 'GPRINT:temp_avg:LAST:%4.1lf Last\l');
472         $GraphDefs['humidity'] = array(
473                 '-v', 'Percent',
474                 'DEF:temp_avg={file}:value:AVERAGE',
475                 'DEF:temp_min={file}:value:MIN',
476                 'DEF:temp_max={file}:value:MAX',
477                 "AREA:temp_max#$HalfGreen",
478                 "AREA:temp_min#$Canvas",
479                 "LINE1:temp_avg#$FullGreen:Temperature",
480                 'GPRINT:temp_min:MIN:%4.1lf%% Min,',
481                 'GPRINT:temp_avg:AVERAGE:%4.1lf%% Avg,',
482                 'GPRINT:temp_max:MAX:%4.1lf%% Max,',
483                 'GPRINT:temp_avg:LAST:%4.1lf%% Last\l');
484         $GraphDefs['if_errors'] = array(
485                 '-v', 'Errors/s', '--units=si',
486                 'DEF:tx_min={file}:tx:MIN',
487                 'DEF:tx_avg={file}:tx:AVERAGE',
488                 'DEF:tx_max={file}:tx:MAX',
489                 'DEF:rx_min={file}:rx:MIN',
490                 'DEF:rx_avg={file}:rx:AVERAGE',
491                 'DEF:rx_max={file}:rx:MAX',
492                 'CDEF:overlap=tx_avg,rx_avg,GT,rx_avg,tx_avg,IF',
493                 'CDEF:mytime=tx_avg,TIME,TIME,IF',
494                 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
495                 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
496                 'CDEF:tx_avg_sample=tx_avg,UN,0,tx_avg,IF,sample_len,*',
497                 'CDEF:tx_avg_sum=PREV,UN,0,PREV,IF,tx_avg_sample,+',
498                 'CDEF:rx_avg_sample=rx_avg,UN,0,rx_avg,IF,sample_len,*',
499                 'CDEF:rx_avg_sum=PREV,UN,0,PREV,IF,rx_avg_sample,+',
500                 "AREA:tx_avg#$HalfGreen",
501                 "AREA:rx_avg#$HalfBlue",
502                 "AREA:overlap#$HalfBlueGreen",
503                 "LINE1:tx_avg#$FullGreen:TX",
504                 'GPRINT:tx_avg:AVERAGE:%5.1lf%s Avg,',
505                 'GPRINT:tx_max:MAX:%5.1lf%s Max,',
506                 'GPRINT:tx_avg:LAST:%5.1lf%s Last',
507                 'GPRINT:tx_avg_sum:LAST:(ca. %4.0lf%s Total)\l',
508                 "LINE1:rx_avg#$FullBlue:RX",
509 //                      'GPRINT:rx_min:MIN:%5.1lf %s Min,',
510                 'GPRINT:rx_avg:AVERAGE:%5.1lf%s Avg,',
511                 'GPRINT:rx_max:MAX:%5.1lf%s Max,',
512                 'GPRINT:rx_avg:LAST:%5.1lf%s Last',
513                 'GPRINT:rx_avg_sum:LAST:(ca. %4.0lf%s Total)\l');
514         $GraphDefs['if_collisions'] = array(
515                 '-v', 'Collisions/s', '--units=si',
516                 'DEF:min_raw={file}:value:MIN',
517                 'DEF:avg_raw={file}:value:AVERAGE',
518                 'DEF:max_raw={file}:value:MAX',
519                 'CDEF:min=min_raw,8,*',
520                 'CDEF:avg=avg_raw,8,*',
521                 'CDEF:max=max_raw,8,*',
522                 "AREA:max#$HalfBlue",
523                 "AREA:min#$Canvas",
524                 "LINE1:avg#$FullBlue:Collisions/s",
525                 'GPRINT:min:MIN:%5.1lf %s Min,',
526                 'GPRINT:avg:AVERAGE:%5.1lf%s Avg,',
527                 'GPRINT:max:MAX:%5.1lf%s Max,',
528                 'GPRINT:avg:LAST:%5.1lf%s Last\l');
529         $GraphDefs['if_dropped'] = array(
530                 '-v', 'Packets/s', '--units=si',
531                 'DEF:tx_min={file}:tx:MIN',
532                 'DEF:tx_avg={file}:tx:AVERAGE',
533                 'DEF:tx_max={file}:tx:MAX',
534                 'DEF:rx_min={file}:rx:MIN',
535                 'DEF:rx_avg={file}:rx:AVERAGE',
536                 'DEF:rx_max={file}:rx:MAX',
537                 'CDEF:overlap=tx_avg,rx_avg,GT,rx_avg,tx_avg,IF',
538                 'CDEF:mytime=tx_avg,TIME,TIME,IF',
539                 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
540                 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
541                 'CDEF:tx_avg_sample=tx_avg,UN,0,tx_avg,IF,sample_len,*',
542                 'CDEF:tx_avg_sum=PREV,UN,0,PREV,IF,tx_avg_sample,+',
543                 'CDEF:rx_avg_sample=rx_avg,UN,0,rx_avg,IF,sample_len,*',
544                 'CDEF:rx_avg_sum=PREV,UN,0,PREV,IF,rx_avg_sample,+',
545                 "AREA:tx_avg#$HalfGreen",
546                 "AREA:rx_avg#$HalfBlue",
547                 "AREA:overlap#$HalfBlueGreen",
548                 "LINE1:tx_avg#$FullGreen:TX",
549                 'GPRINT:tx_avg:AVERAGE:%5.1lf%s Avg,',
550                 'GPRINT:tx_max:MAX:%5.1lf%s Max,',
551                 'GPRINT:tx_avg:LAST:%5.1lf%s Last',
552                 'GPRINT:tx_avg_sum:LAST:(ca. %4.0lf%s Total)\l',
553                 "LINE1:rx_avg#$FullBlue:RX",
554 //                      'GPRINT:rx_min:MIN:%5.1lf %s Min,',
555                 'GPRINT:rx_avg:AVERAGE:%5.1lf%s Avg,',
556                 'GPRINT:rx_max:MAX:%5.1lf%s Max,',
557                 'GPRINT:rx_avg:LAST:%5.1lf%s Last',
558                 'GPRINT:rx_avg_sum:LAST:(ca. %4.0lf%s Total)\l');
559         $GraphDefs['if_packets'] = array(
560                 '-v', 'Packets/s', '--units=si',
561                 'DEF:tx_min={file}:tx:MIN',
562                 'DEF:tx_avg={file}:tx:AVERAGE',
563                 'DEF:tx_max={file}:tx:MAX',
564                 'DEF:rx_min={file}:rx:MIN',
565                 'DEF:rx_avg={file}:rx:AVERAGE',
566                 'DEF:rx_max={file}:rx:MAX',
567                 'CDEF:overlap=tx_avg,rx_avg,GT,rx_avg,tx_avg,IF',
568                 'CDEF:mytime=tx_avg,TIME,TIME,IF',
569                 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
570                 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
571                 'CDEF:tx_avg_sample=tx_avg,UN,0,tx_avg,IF,sample_len,*',
572                 'CDEF:tx_avg_sum=PREV,UN,0,PREV,IF,tx_avg_sample,+',
573                 'CDEF:rx_avg_sample=rx_avg,UN,0,rx_avg,IF,sample_len,*',
574                 'CDEF:rx_avg_sum=PREV,UN,0,PREV,IF,rx_avg_sample,+',
575                 "AREA:tx_avg#$HalfGreen",
576                 "AREA:rx_avg#$HalfBlue",
577                 "AREA:overlap#$HalfBlueGreen",
578                 "LINE1:tx_avg#$FullGreen:TX",
579                 'GPRINT:tx_avg:AVERAGE:%5.1lf%s Avg,',
580                 'GPRINT:tx_max:MAX:%5.1lf%s Max,',
581                 'GPRINT:tx_avg:LAST:%5.1lf%s Last',
582                 'GPRINT:tx_avg_sum:LAST:(ca. %4.0lf%s Total)\l',
583                 "LINE1:rx_avg#$FullBlue:RX",
584 //                      'GPRINT:rx_min:MIN:%5.1lf %s Min,',
585                 'GPRINT:rx_avg:AVERAGE:%5.1lf%s Avg,',
586                 'GPRINT:rx_max:MAX:%5.1lf%s Max,',
587                 'GPRINT:rx_avg:LAST:%5.1lf%s Last',
588                 'GPRINT:rx_avg_sum:LAST:(ca. %4.0lf%s Total)\l');
589         $GraphDefs['if_rx_errors'] = array(
590                 '-v', 'Errors/s', '--units=si',
591                 'DEF:min={file}:value:MIN',
592                 'DEF:avg={file}:value:AVERAGE',
593                 'DEF:max={file}:value:MAX',
594                 'CDEF:mytime=avg,TIME,TIME,IF',
595                 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
596                 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
597                 'CDEF:avg_sample=avg,UN,0,avg,IF,sample_len,*',
598                 'CDEF:avg_sum=PREV,UN,0,PREV,IF,avg_sample,+',
599                 "AREA:avg#$HalfBlue",
600                 "LINE1:avg#$FullBlue:Errors/s",
601                 'GPRINT:avg:AVERAGE:%3.1lf%s Avg,',
602                 'GPRINT:max:MAX:%3.1lf%s Max,',
603                 'GPRINT:avg:LAST:%3.1lf%s Last',
604                 'GPRINT:avg_sum:LAST:(ca. %2.0lf%s Total)\l');
605         $GraphDefs['ipt_bytes'] = array(
606                 '-v', 'Bits/s',
607                 'DEF:min_raw={file}:value:MIN',
608                 'DEF:avg_raw={file}:value:AVERAGE',
609                 'DEF:max_raw={file}:value:MAX',
610                 'CDEF:min=min_raw,8,*',
611                 'CDEF:avg=avg_raw,8,*',
612                 'CDEF:max=max_raw,8,*',
613                 'CDEF:mytime=avg_raw,TIME,TIME,IF',
614                 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
615                 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
616                 'CDEF:avg_sample=avg_raw,UN,0,avg_raw,IF,sample_len,*',
617                 'CDEF:avg_sum=PREV,UN,0,PREV,IF,avg_sample,+',
618                 "AREA:max#$HalfBlue",
619                 "AREA:min#$Canvas",
620                 "LINE1:avg#$FullBlue:Bits/s",
621 //                      'GPRINT:min:MIN:%5.1lf %s Min,',
622                 'GPRINT:avg:AVERAGE:%5.1lf%s Avg,',
623                 'GPRINT:max:MAX:%5.1lf%s Max,',
624                 'GPRINT:avg:LAST:%5.1lf%s Last',
625                 'GPRINT:avg_sum:LAST:(ca. %5.1lf%sB Total)\l');
626         $GraphDefs['ipt_packets'] = array(
627                 '-v', 'Packets/s',
628                 'DEF:min_raw={file}:value:MIN',
629                 'DEF:avg_raw={file}:value:AVERAGE',
630                 'DEF:max_raw={file}:value:MAX',
631                 'CDEF:min=min_raw,8,*',
632                 'CDEF:avg=avg_raw,8,*',
633                 'CDEF:max=max_raw,8,*',
634                 "AREA:max#$HalfBlue",
635                 "AREA:min#$Canvas",
636                 "LINE1:avg#$FullBlue:Packets/s",
637                 'GPRINT:min:MIN:%5.1lf %s Min,',
638                 'GPRINT:avg:AVERAGE:%5.1lf%s Avg,',
639                 'GPRINT:max:MAX:%5.1lf%s Max,',
640                 'GPRINT:avg:LAST:%5.1lf%s Last\l');
641         $GraphDefs['irq'] = array(
642                 '-v', 'Issues/s',
643                 'DEF:avg={file}:value:AVERAGE',
644                 'DEF:min={file}:value:MIN',
645                 'DEF:max={file}:value:MAX',
646                 "AREA:max#$HalfBlue",
647                 "AREA:min#$Canvas",
648                 "LINE1:avg#$FullBlue:Issues/s",
649                 'GPRINT:min:MIN:%6.2lf Min,',
650                 'GPRINT:avg:AVERAGE:%6.2lf Avg,',
651                 'GPRINT:max:MAX:%6.2lf Max,',
652                 'GPRINT:avg:LAST:%6.2lf Last\l');
653         $GraphDefs['load'] = array(
654                 '-v', 'System load',
655                 'DEF:s_avg={file}:shortterm:AVERAGE',
656                 'DEF:s_min={file}:shortterm:MIN',
657                 'DEF:s_max={file}:shortterm:MAX',
658                 'DEF:m_avg={file}:midterm:AVERAGE',
659                 'DEF:m_min={file}:midterm:MIN',
660                 'DEF:m_max={file}:midterm:MAX',
661                 'DEF:l_avg={file}:longterm:AVERAGE',
662                 'DEF:l_min={file}:longterm:MIN',
663                 'DEF:l_max={file}:longterm:MAX',
664                 "AREA:s_max#$HalfGreen",
665                 "AREA:s_min#$Canvas",
666                 "LINE1:s_avg#$FullGreen: 1m average",
667                 'GPRINT:s_min:MIN:%4.2lf Min,',
668                 'GPRINT:s_avg:AVERAGE:%4.2lf Avg,',
669                 'GPRINT:s_max:MAX:%4.2lf Max,',
670                 'GPRINT:s_avg:LAST:%4.2lf Last\n',
671                 "LINE1:m_avg#$FullBlue: 5m average",
672                 'GPRINT:m_min:MIN:%4.2lf Min,',
673                 'GPRINT:m_avg:AVERAGE:%4.2lf Avg,',
674                 'GPRINT:m_max:MAX:%4.2lf Max,',
675                 'GPRINT:m_avg:LAST:%4.2lf Last\n',
676                 "LINE1:l_avg#$FullRed:15m average",
677                 'GPRINT:l_min:MIN:%4.2lf Min,',
678                 'GPRINT:l_avg:AVERAGE:%4.2lf Avg,',
679                 'GPRINT:l_max:MAX:%4.2lf Max,',
680                 'GPRINT:l_avg:LAST:%4.2lf Last');
681         $GraphDefs['load_percent'] = array(
682                 'DEF:avg={file}:percent:AVERAGE',
683                 'DEF:min={file}:percent:MIN',
684                 'DEF:max={file}:percent:MAX',
685                 "AREA:max#$HalfBlue",
686                 "AREA:min#$Canvas",
687                 "LINE1:avg#$FullBlue:Load",
688                 'GPRINT:min:MIN:%5.1lf%s%% Min,',
689                 'GPRINT:avg:AVERAGE:%5.1lf%s%% Avg,',
690                 'GPRINT:max:MAX:%5.1lf%s%% Max,',
691                 'GPRINT:avg:LAST:%5.1lf%s%% Last\l');
692         $GraphDefs['mails'] = array(
693                 'DEF:rawgood={file}:good:AVERAGE',
694                 'DEF:rawspam={file}:spam:AVERAGE',
695                 'CDEF:good=rawgood,UN,0,rawgood,IF',
696                 'CDEF:spam=rawspam,UN,0,rawspam,IF',
697                 'CDEF:negspam=spam,-1,*',
698                 "AREA:good#$HalfGreen",
699                 "LINE1:good#$FullGreen:Good mails",
700                 'GPRINT:good:AVERAGE:%4.1lf Avg,',
701                 'GPRINT:good:MAX:%4.1lf Max,',
702                 'GPRINT:good:LAST:%4.1lf Last\n',
703                 "AREA:negspam#$HalfRed",
704                 "LINE1:negspam#$FullRed:Spam mails",
705                 'GPRINT:spam:AVERAGE:%4.1lf Avg,',
706                 'GPRINT:spam:MAX:%4.1lf Max,',
707                 'GPRINT:spam:LAST:%4.1lf Last',
708                 'HRULE:0#000000');
709         $GraphDefs['memory'] = array(
710                 '-b', '1024', '-v', 'Bytes',
711                 'DEF:avg={file}:value:AVERAGE',
712                 'DEF:min={file}:value:MIN',
713                 'DEF:max={file}:value:MAX',
714                 "AREA:max#$HalfBlue",
715                 "AREA:min#$Canvas",
716                 "LINE1:avg#$FullBlue:Memory",
717                 'GPRINT:min:MIN:%5.1lf%sbyte Min,',
718                 'GPRINT:avg:AVERAGE:%5.1lf%sbyte Avg,',
719                 'GPRINT:max:MAX:%5.1lf%sbyte Max,',
720                 'GPRINT:avg:LAST:%5.1lf%sbyte Last\l');
721         $GraphDefs['old_memory'] = array(
722                 'DEF:used_avg={file}:used:AVERAGE',
723                 'DEF:free_avg={file}:free:AVERAGE',
724                 'DEF:buffers_avg={file}:buffers:AVERAGE',
725                 'DEF:cached_avg={file}:cached:AVERAGE',
726                 'DEF:used_min={file}:used:MIN',
727                 'DEF:free_min={file}:free:MIN',
728                 'DEF:buffers_min={file}:buffers:MIN',
729                 'DEF:cached_min={file}:cached:MIN',
730                 'DEF:used_max={file}:used:MAX',
731                 'DEF:free_max={file}:free:MAX',
732                 'DEF:buffers_max={file}:buffers:MAX',
733                 'DEF:cached_max={file}:cached:MAX',
734                 'CDEF:cached_avg_nn=cached_avg,UN,0,cached_avg,IF',
735                 'CDEF:buffers_avg_nn=buffers_avg,UN,0,buffers_avg,IF',
736                 'CDEF:free_cached_buffers_used=free_avg,cached_avg_nn,+,buffers_avg_nn,+,used_avg,+',
737                 'CDEF:cached_buffers_used=cached_avg,buffers_avg_nn,+,used_avg,+',
738                 'CDEF:buffers_used=buffers_avg,used_avg,+',
739                 "AREA:free_cached_buffers_used#$HalfGreen",
740                 "AREA:cached_buffers_used#$HalfBlue",
741                 "AREA:buffers_used#$HalfYellow",
742                 "AREA:used_avg#$HalfRed",
743                 "LINE1:free_cached_buffers_used#$FullGreen:Free        ",
744                 'GPRINT:free_min:MIN:%5.1lf%s Min,',
745                 'GPRINT:free_avg:AVERAGE:%5.1lf%s Avg,',
746                 'GPRINT:free_max:MAX:%5.1lf%s Max,',
747                 'GPRINT:free_avg:LAST:%5.1lf%s Last\n',
748                 "LINE1:cached_buffers_used#$FullBlue:Page cache  ",
749                 'GPRINT:cached_min:MIN:%5.1lf%s Min,',
750                 'GPRINT:cached_avg:AVERAGE:%5.1lf%s Avg,',
751                 'GPRINT:cached_max:MAX:%5.1lf%s Max,',
752                 'GPRINT:cached_avg:LAST:%5.1lf%s Last\n',
753                 "LINE1:buffers_used#$FullYellow:Buffer cache",
754                 'GPRINT:buffers_min:MIN:%5.1lf%s Min,',
755                 'GPRINT:buffers_avg:AVERAGE:%5.1lf%s Avg,',
756                 'GPRINT:buffers_max:MAX:%5.1lf%s Max,',
757                 'GPRINT:buffers_avg:LAST:%5.1lf%s Last\n',
758                 "LINE1:used_avg#$FullRed:Used        ",
759                 'GPRINT:used_min:MIN:%5.1lf%s Min,',
760                 'GPRINT:used_avg:AVERAGE:%5.1lf%s Avg,',
761                 'GPRINT:used_max:MAX:%5.1lf%s Max,',
762                 'GPRINT:used_avg:LAST:%5.1lf%s Last');
763         $GraphDefs['mysql_commands'] = array(
764                 '-v', 'Issues/s',
765                 "DEF:val_avg={file}:value:AVERAGE",
766                 "DEF:val_min={file}:value:MIN",
767                 "DEF:val_max={file}:value:MAX",
768                 "AREA:val_max#$HalfBlue",
769                 "AREA:val_min#$Canvas",
770                 "LINE1:val_avg#$FullBlue:Issues/s",
771                 'GPRINT:val_min:MIN:%5.2lf Min,',
772                 'GPRINT:val_avg:AVERAGE:%5.2lf Avg,',
773                 'GPRINT:val_max:MAX:%5.2lf Max,',
774                 'GPRINT:val_avg:LAST:%5.2lf Last');
775         $GraphDefs['mysql_handler'] = array(
776                 '-v', 'Issues/s',
777                 "DEF:val_avg={file}:value:AVERAGE",
778                 "DEF:val_min={file}:value:MIN",
779                 "DEF:val_max={file}:value:MAX",
780                 "AREA:val_max#$HalfBlue",
781                 "AREA:val_min#$Canvas",
782                 "LINE1:val_avg#$FullBlue:Issues/s",
783                 'GPRINT:val_min:MIN:%5.2lf Min,',
784                 'GPRINT:val_avg:AVERAGE:%5.2lf Avg,',
785                 'GPRINT:val_max:MAX:%5.2lf Max,',
786                 'GPRINT:val_avg:LAST:%5.2lf Last');
787         $GraphDefs['mysql_octets'] = array(
788                 '-v', 'Bits/s',
789                 'DEF:out_min={file}:tx:MIN',
790                 'DEF:out_avg={file}:tx:AVERAGE',
791                 'DEF:out_max={file}:tx:MAX',
792                 'DEF:inc_min={file}:rx:MIN',
793                 'DEF:inc_avg={file}:rx:AVERAGE',
794                 'DEF:inc_max={file}:rx:MAX',
795                 'CDEF:mytime=out_avg,TIME,TIME,IF',
796                 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
797                 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
798                 'CDEF:out_avg_sample=out_avg,UN,0,out_avg,IF,sample_len,*',
799                 'CDEF:out_avg_sum=PREV,UN,0,PREV,IF,out_avg_sample,+',
800                 'CDEF:inc_avg_sample=inc_avg,UN,0,inc_avg,IF,sample_len,*',
801                 'CDEF:inc_avg_sum=PREV,UN,0,PREV,IF,inc_avg_sample,+',
802                 'CDEF:out_bit_min=out_min,8,*',
803                 'CDEF:out_bit_avg=out_avg,8,*',
804                 'CDEF:out_bit_max=out_max,8,*',
805                 'CDEF:inc_bit_min=inc_min,8,*',
806                 'CDEF:inc_bit_avg=inc_avg,8,*',
807                 'CDEF:inc_bit_max=inc_max,8,*',
808                 'CDEF:overlap=out_bit_avg,inc_bit_avg,GT,inc_bit_avg,out_bit_avg,IF',
809                 "AREA:out_bit_avg#$HalfGreen",
810                 "AREA:inc_bit_avg#$HalfBlue",
811                 "AREA:overlap#$HalfBlueGreen",
812                 "LINE1:out_bit_avg#$FullGreen:Written",
813                 'GPRINT:out_bit_avg:AVERAGE:%5.1lf%s Avg,',
814                 'GPRINT:out_bit_max:MAX:%5.1lf%s Max,',
815                 'GPRINT:out_bit_avg:LAST:%5.1lf%s Last',
816                 'GPRINT:out_avg_sum:LAST:(ca. %5.1lf%sB Total)\l',
817                 "LINE1:inc_bit_avg#$FullBlue:Read   ",
818                 'GPRINT:inc_bit_avg:AVERAGE:%5.1lf%s Avg,',
819                 'GPRINT:inc_bit_max:MAX:%5.1lf%s Max,',
820                 'GPRINT:inc_bit_avg:LAST:%5.1lf%s Last',
821                 'GPRINT:inc_avg_sum:LAST:(ca. %5.1lf%sB Total)\l');
822         $GraphDefs['mysql_qcache'] = array(
823                 '-v', 'Queries/s',
824                 "DEF:hits_min={file}:hits:MIN",
825                 "DEF:hits_avg={file}:hits:AVERAGE",
826                 "DEF:hits_max={file}:hits:MAX",
827                 "DEF:inserts_min={file}:inserts:MIN",
828                 "DEF:inserts_avg={file}:inserts:AVERAGE",
829                 "DEF:inserts_max={file}:inserts:MAX",
830                 "DEF:not_cached_min={file}:not_cached:MIN",
831                 "DEF:not_cached_avg={file}:not_cached:AVERAGE",
832                 "DEF:not_cached_max={file}:not_cached:MAX",
833                 "DEF:lowmem_prunes_min={file}:lowmem_prunes:MIN",
834                 "DEF:lowmem_prunes_avg={file}:lowmem_prunes:AVERAGE",
835                 "DEF:lowmem_prunes_max={file}:lowmem_prunes:MAX",
836                 "DEF:queries_min={file}:queries_in_cache:MIN",
837                 "DEF:queries_avg={file}:queries_in_cache:AVERAGE",
838                 "DEF:queries_max={file}:queries_in_cache:MAX",
839                 "CDEF:unknown=queries_avg,UNKN,+",
840                 "CDEF:not_cached_agg=hits_avg,inserts_avg,+,not_cached_avg,+",
841                 "CDEF:inserts_agg=hits_avg,inserts_avg,+",
842                 "CDEF:hits_agg=hits_avg",
843                 "AREA:not_cached_agg#$HalfYellow",
844                 "AREA:inserts_agg#$HalfBlue",
845                 "AREA:hits_agg#$HalfGreen",
846                 "LINE1:not_cached_agg#$FullYellow:Not Cached      ",
847                 'GPRINT:not_cached_min:MIN:%5.2lf Min,',
848                 'GPRINT:not_cached_avg:AVERAGE:%5.2lf Avg,',
849                 'GPRINT:not_cached_max:MAX:%5.2lf Max,',
850                 'GPRINT:not_cached_avg:LAST:%5.2lf Last\l',
851                 "LINE1:inserts_agg#$FullBlue:Inserts         ",
852                 'GPRINT:inserts_min:MIN:%5.2lf Min,',
853                 'GPRINT:inserts_avg:AVERAGE:%5.2lf Avg,',
854                 'GPRINT:inserts_max:MAX:%5.2lf Max,',
855                 'GPRINT:inserts_avg:LAST:%5.2lf Last\l',
856                 "LINE1:hits_agg#$FullGreen:Hits            ",
857                 'GPRINT:hits_min:MIN:%5.2lf Min,',
858                 'GPRINT:hits_avg:AVERAGE:%5.2lf Avg,',
859                 'GPRINT:hits_max:MAX:%5.2lf Max,',
860                 'GPRINT:hits_avg:LAST:%5.2lf Last\l',
861                 "LINE1:lowmem_prunes_avg#$FullRed:Lowmem Prunes   ",
862                 'GPRINT:lowmem_prunes_min:MIN:%5.2lf Min,',
863                 'GPRINT:lowmem_prunes_avg:AVERAGE:%5.2lf Avg,',
864                 'GPRINT:lowmem_prunes_max:MAX:%5.2lf Max,',
865                 'GPRINT:lowmem_prunes_avg:LAST:%5.2lf Last\l',
866                 "LINE1:unknown#$Canvas:Queries in cache",
867                 'GPRINT:queries_min:MIN:%5.0lf Min,',
868                 'GPRINT:queries_avg:AVERAGE:%5.0lf Avg,',
869                 'GPRINT:queries_max:MAX:%5.0lf Max,',
870                 'GPRINT:queries_avg:LAST:%5.0lf Last\l');
871         $GraphDefs['mysql_threads'] = array(
872                 '-v', 'Threads',
873                 "DEF:running_min={file}:running:MIN",
874                 "DEF:running_avg={file}:running:AVERAGE",
875                 "DEF:running_max={file}:running:MAX",
876                 "DEF:connected_min={file}:connected:MIN",
877                 "DEF:connected_avg={file}:connected:AVERAGE",
878                 "DEF:connected_max={file}:connected:MAX",
879                 "DEF:cached_min={file}:cached:MIN",
880                 "DEF:cached_avg={file}:cached:AVERAGE",
881                 "DEF:cached_max={file}:cached:MAX",
882                 "DEF:created_min={file}:created:MIN",
883                 "DEF:created_avg={file}:created:AVERAGE",
884                 "DEF:created_max={file}:created:MAX",
885                 "CDEF:unknown=created_avg,UNKN,+",
886                 "CDEF:cached_agg=connected_avg,cached_avg,+",
887                 "AREA:cached_agg#$HalfGreen",
888                 "AREA:connected_avg#$HalfBlue",
889                 "AREA:running_avg#$HalfRed",
890                 "LINE1:cached_agg#$FullGreen:Cached   ",
891                 'GPRINT:cached_min:MIN:%5.1lf Min,',
892                 'GPRINT:cached_avg:AVERAGE:%5.1lf Avg,',
893                 'GPRINT:cached_max:MAX:%5.1lf Max,',
894                 'GPRINT:cached_avg:LAST:%5.1lf Last\l',
895                 "LINE1:connected_avg#$FullBlue:Connected",
896                 'GPRINT:connected_min:MIN:%5.1lf Min,',
897                 'GPRINT:connected_avg:AVERAGE:%5.1lf Avg,',
898                 'GPRINT:connected_max:MAX:%5.1lf Max,',
899                 'GPRINT:connected_avg:LAST:%5.1lf Last\l',
900                 "LINE1:running_avg#$FullRed:Running  ",
901                 'GPRINT:running_min:MIN:%5.1lf Min,',
902                 'GPRINT:running_avg:AVERAGE:%5.1lf Avg,',
903                 'GPRINT:running_max:MAX:%5.1lf Max,',
904                 'GPRINT:running_avg:LAST:%5.1lf Last\l',
905                 "LINE1:unknown#$Canvas:Created  ",
906                 'GPRINT:created_min:MIN:%5.0lf Min,',
907                 'GPRINT:created_avg:AVERAGE:%5.0lf Avg,',
908                 'GPRINT:created_max:MAX:%5.0lf Max,',
909                 'GPRINT:created_avg:LAST:%5.0lf Last\l');
910         $GraphDefs['nfs_procedure'] = array(
911                 '-v', 'Issues/s',
912                 'DEF:avg={file}:value:AVERAGE',
913                 'DEF:min={file}:value:MIN',
914                 'DEF:max={file}:value:MAX',
915                 "AREA:max#$HalfBlue",
916                 "AREA:min#$Canvas",
917                 "LINE1:avg#$FullBlue:Issues/s",
918                 'GPRINT:min:MIN:%6.2lf Min,',
919                 'GPRINT:avg:AVERAGE:%6.2lf Avg,',
920                 'GPRINT:max:MAX:%6.2lf Max,',
921                 'GPRINT:avg:LAST:%6.2lf Last\l');
922         $GraphDefs['nfs3_procedures'] = array(
923                 "DEF:null_avg={file}:null:AVERAGE",
924                 "DEF:getattr_avg={file}:getattr:AVERAGE",
925                 "DEF:setattr_avg={file}:setattr:AVERAGE",
926                 "DEF:lookup_avg={file}:lookup:AVERAGE",
927                 "DEF:access_avg={file}:access:AVERAGE",
928                 "DEF:readlink_avg={file}:readlink:AVERAGE",
929                 "DEF:read_avg={file}:read:AVERAGE",
930                 "DEF:write_avg={file}:write:AVERAGE",
931                 "DEF:create_avg={file}:create:AVERAGE",
932                 "DEF:mkdir_avg={file}:mkdir:AVERAGE",
933                 "DEF:symlink_avg={file}:symlink:AVERAGE",
934                 "DEF:mknod_avg={file}:mknod:AVERAGE",
935                 "DEF:remove_avg={file}:remove:AVERAGE",
936                 "DEF:rmdir_avg={file}:rmdir:AVERAGE",
937                 "DEF:rename_avg={file}:rename:AVERAGE",
938                 "DEF:link_avg={file}:link:AVERAGE",
939                 "DEF:readdir_avg={file}:readdir:AVERAGE",
940                 "DEF:readdirplus_avg={file}:readdirplus:AVERAGE",
941                 "DEF:fsstat_avg={file}:fsstat:AVERAGE",
942                 "DEF:fsinfo_avg={file}:fsinfo:AVERAGE",
943                 "DEF:pathconf_avg={file}:pathconf:AVERAGE",
944                 "DEF:commit_avg={file}:commit:AVERAGE",
945                 "DEF:null_max={file}:null:MAX",
946                 "DEF:getattr_max={file}:getattr:MAX",
947                 "DEF:setattr_max={file}:setattr:MAX",
948                 "DEF:lookup_max={file}:lookup:MAX",
949                 "DEF:access_max={file}:access:MAX",
950                 "DEF:readlink_max={file}:readlink:MAX",
951                 "DEF:read_max={file}:read:MAX",
952                 "DEF:write_max={file}:write:MAX",
953                 "DEF:create_max={file}:create:MAX",
954                 "DEF:mkdir_max={file}:mkdir:MAX",
955                 "DEF:symlink_max={file}:symlink:MAX",
956                 "DEF:mknod_max={file}:mknod:MAX",
957                 "DEF:remove_max={file}:remove:MAX",
958                 "DEF:rmdir_max={file}:rmdir:MAX",
959                 "DEF:rename_max={file}:rename:MAX",
960                 "DEF:link_max={file}:link:MAX",
961                 "DEF:readdir_max={file}:readdir:MAX",
962                 "DEF:readdirplus_max={file}:readdirplus:MAX",
963                 "DEF:fsstat_max={file}:fsstat:MAX",
964                 "DEF:fsinfo_max={file}:fsinfo:MAX",
965                 "DEF:pathconf_max={file}:pathconf:MAX",
966                 "DEF:commit_max={file}:commit:MAX",
967                 "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,+,+,+,+,+,+,+,+,+,+,+,+,+,+",
968                 "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,+,+,+,+,+,+,+,+,+,+,+,+,+,+",
969                 "CDEF:stack_read=read_avg",
970                 "CDEF:stack_getattr=stack_read,getattr_avg,+",
971                 "CDEF:stack_access=stack_getattr,access_avg,+",
972                 "CDEF:stack_lookup=stack_access,lookup_avg,+",
973                 "CDEF:stack_write=stack_lookup,write_avg,+",
974                 "CDEF:stack_commit=stack_write,commit_avg,+",
975                 "CDEF:stack_setattr=stack_commit,setattr_avg,+",
976                 "CDEF:stack_other=stack_setattr,other_avg,+",
977                 "AREA:stack_other#$HalfRed",
978                 "AREA:stack_setattr#$HalfGreen",
979                 "AREA:stack_commit#$HalfYellow",
980                 "AREA:stack_write#$HalfGreen",
981                 "AREA:stack_lookup#$HalfBlue",
982                 "AREA:stack_access#$HalfMagenta",
983                 "AREA:stack_getattr#$HalfCyan",
984                 "AREA:stack_read#$HalfBlue",
985                 "LINE1:stack_other#$FullRed:Other  ",
986                 'GPRINT:other_max:MAX:%5.1lf Max,',
987                 'GPRINT:other_avg:AVERAGE:%5.1lf Avg,',
988                 'GPRINT:other_avg:LAST:%5.1lf Last\l',
989                 "LINE1:stack_setattr#$FullGreen:setattr",
990                 'GPRINT:setattr_max:MAX:%5.1lf Max,',
991                 'GPRINT:setattr_avg:AVERAGE:%5.1lf Avg,',
992                 'GPRINT:setattr_avg:LAST:%5.1lf Last\l',
993                 "LINE1:stack_commit#$FullYellow:commit ",
994                 'GPRINT:commit_max:MAX:%5.1lf Max,',
995                 'GPRINT:commit_avg:AVERAGE:%5.1lf Avg,',
996                 'GPRINT:commit_avg:LAST:%5.1lf Last\l',
997                 "LINE1:stack_write#$FullGreen:write  ",
998                 'GPRINT:write_max:MAX:%5.1lf Max,',
999                 'GPRINT:write_avg:AVERAGE:%5.1lf Avg,',
1000                 'GPRINT:write_avg:LAST:%5.1lf Last\l',
1001                 "LINE1:stack_lookup#$FullBlue:lookup ",
1002                 'GPRINT:lookup_max:MAX:%5.1lf Max,',
1003                 'GPRINT:lookup_avg:AVERAGE:%5.1lf Avg,',
1004                 'GPRINT:lookup_avg:LAST:%5.1lf Last\l',
1005                 "LINE1:stack_access#$FullMagenta:access ",
1006                 'GPRINT:access_max:MAX:%5.1lf Max,',
1007                 'GPRINT:access_avg:AVERAGE:%5.1lf Avg,',
1008                 'GPRINT:access_avg:LAST:%5.1lf Last\l',
1009                 "LINE1:stack_getattr#$FullCyan:getattr",
1010                 'GPRINT:getattr_max:MAX:%5.1lf Max,',
1011                 'GPRINT:getattr_avg:AVERAGE:%5.1lf Avg,',
1012                 'GPRINT:getattr_avg:LAST:%5.1lf Last\l',
1013                 "LINE1:stack_read#$FullBlue:read   ",
1014                 'GPRINT:read_max:MAX:%5.1lf Max,',
1015                 'GPRINT:read_avg:AVERAGE:%5.1lf Avg,',
1016                 'GPRINT:read_avg:LAST:%5.1lf Last\l');
1017         $GraphDefs['opcode'] = array(
1018                 'DEF:avg={file}:value:AVERAGE',
1019                 'DEF:min={file}:value:MIN',
1020                 'DEF:max={file}:value:MAX',
1021                 "AREA:max#$HalfBlue",
1022                 "AREA:min#$Canvas",
1023                 "LINE1:avg#$FullBlue:Queries/s",
1024                 'GPRINT:min:MIN:%9.3lf Min,',
1025                 'GPRINT:avg:AVERAGE:%9.3lf Average,',
1026                 'GPRINT:max:MAX:%9.3lf Max,',
1027                 'GPRINT:avg:LAST:%9.3lf Last\l');
1028         $GraphDefs['partition'] = array(
1029                 "DEF:rbyte_avg={file}:rbytes:AVERAGE",
1030                 "DEF:rbyte_min={file}:rbytes:MIN",
1031                 "DEF:rbyte_max={file}:rbytes:MAX",
1032                 "DEF:wbyte_avg={file}:wbytes:AVERAGE",
1033                 "DEF:wbyte_min={file}:wbytes:MIN",
1034                 "DEF:wbyte_max={file}:wbytes:MAX",
1035                 'CDEF:overlap=wbyte_avg,rbyte_avg,GT,rbyte_avg,wbyte_avg,IF',
1036                 "AREA:wbyte_avg#$HalfGreen",
1037                 "AREA:rbyte_avg#$HalfBlue",
1038                 "AREA:overlap#$HalfBlueGreen",    "LINE1:wbyte_avg#$FullGreen:Write",
1039                 'GPRINT:wbyte_min:MIN:%5.1lf%s Min,',
1040                 'GPRINT:wbyte_avg:AVERAGE:%5.1lf%s Avg,',
1041                 'GPRINT:wbyte_max:MAX:%5.1lf%s Max,',
1042                 'GPRINT:wbyte_avg:LAST:%5.1lf%s Last\l',
1043                 "LINE1:rbyte_avg#$FullBlue:Read ",
1044                 'GPRINT:rbyte_min:MIN:%5.1lf%s Min,',
1045                 'GPRINT:rbyte_avg:AVERAGE:%5.1lf%s Avg,',
1046                 'GPRINT:rbyte_max:MAX:%5.1lf%s Max,',
1047                 'GPRINT:rbyte_avg:LAST:%5.1lf%s Last\l');
1048         $GraphDefs['percent'] = array(
1049                 '-v', 'Percent',
1050                 'DEF:avg={file}:percent:AVERAGE',
1051                 'DEF:min={file}:percent:MIN',
1052                 'DEF:max={file}:percent:MAX',
1053                 "AREA:max#$HalfBlue",
1054                 "AREA:min#$Canvas",
1055                 "LINE1:avg#$FullBlue:Percent",
1056                 'GPRINT:min:MIN:%5.1lf%% Min,',
1057                 'GPRINT:avg:AVERAGE:%5.1lf%% Avg,',
1058                 'GPRINT:max:MAX:%5.1lf%% Max,',
1059                 'GPRINT:avg:LAST:%5.1lf%% Last\l');
1060         $GraphDefs['ping'] = array(
1061                 'DEF:ping_avg={file}:ping:AVERAGE',
1062                 'DEF:ping_min={file}:ping:MIN',
1063                 'DEF:ping_max={file}:ping:MAX',
1064                 "AREA:ping_max#$HalfBlue",
1065                 "AREA:ping_min#$Canvas",
1066                 "LINE1:ping_avg#$FullBlue:Ping",
1067                 'GPRINT:ping_min:MIN:%4.1lf ms Min,',
1068                 'GPRINT:ping_avg:AVERAGE:%4.1lf ms Avg,',
1069                 'GPRINT:ping_max:MAX:%4.1lf ms Max,',
1070                 'GPRINT:ping_avg:LAST:%4.1lf ms Last');
1071         $GraphDefs['power'] = array(
1072                 '-v', 'Watt',
1073                 'DEF:avg={file}:value:AVERAGE',
1074                 'DEF:min={file}:value:MIN',
1075                 'DEF:max={file}:value:MAX',
1076                 "AREA:max#$HalfBlue",
1077                 "AREA:min#$Canvas",
1078                 "LINE1:avg#$FullBlue:Watt",
1079                 'GPRINT:min:MIN:%5.1lf%sW Min,',
1080                 'GPRINT:avg:AVERAGE:%5.1lf%sW Avg,',
1081                 'GPRINT:max:MAX:%5.1lf%sW Max,',
1082                 'GPRINT:avg:LAST:%5.1lf%sW Last\l');
1083         $GraphDefs['processes'] = array(
1084                 "DEF:running_avg={file}:running:AVERAGE",
1085                 "DEF:running_min={file}:running:MIN",
1086                 "DEF:running_max={file}:running:MAX",
1087                 "DEF:sleeping_avg={file}:sleeping:AVERAGE",
1088                 "DEF:sleeping_min={file}:sleeping:MIN",
1089                 "DEF:sleeping_max={file}:sleeping:MAX",
1090                 "DEF:zombies_avg={file}:zombies:AVERAGE",
1091                 "DEF:zombies_min={file}:zombies:MIN",
1092                 "DEF:zombies_max={file}:zombies:MAX",
1093                 "DEF:stopped_avg={file}:stopped:AVERAGE",
1094                 "DEF:stopped_min={file}:stopped:MIN",
1095                 "DEF:stopped_max={file}:stopped:MAX",
1096                 "DEF:paging_avg={file}:paging:AVERAGE",
1097                 "DEF:paging_min={file}:paging:MIN",
1098                 "DEF:paging_max={file}:paging:MAX",
1099                 "DEF:blocked_avg={file}:blocked:AVERAGE",
1100                 "DEF:blocked_min={file}:blocked:MIN",
1101                 "DEF:blocked_max={file}:blocked:MAX",
1102                 'CDEF:paging_acc=sleeping_avg,running_avg,stopped_avg,zombies_avg,blocked_avg,paging_avg,+,+,+,+,+',
1103                 'CDEF:blocked_acc=sleeping_avg,running_avg,stopped_avg,zombies_avg,blocked_avg,+,+,+,+',
1104                 'CDEF:zombies_acc=sleeping_avg,running_avg,stopped_avg,zombies_avg,+,+,+',
1105                 'CDEF:stopped_acc=sleeping_avg,running_avg,stopped_avg,+,+',
1106                 'CDEF:running_acc=sleeping_avg,running_avg,+',
1107                 'CDEF:sleeping_acc=sleeping_avg',
1108                 "AREA:paging_acc#$HalfYellow",
1109                 "AREA:blocked_acc#$HalfCyan",
1110                 "AREA:zombies_acc#$HalfRed",
1111                 "AREA:stopped_acc#$HalfMagenta",
1112                 "AREA:running_acc#$HalfGreen",
1113                 "AREA:sleeping_acc#$HalfBlue",
1114                 "LINE1:paging_acc#$FullYellow:Paging  ",
1115                 'GPRINT:paging_min:MIN:%5.1lf Min,',
1116                 'GPRINT:paging_avg:AVERAGE:%5.1lf Average,',
1117                 'GPRINT:paging_max:MAX:%5.1lf Max,',
1118                 'GPRINT:paging_avg:LAST:%5.1lf Last\l',
1119                 "LINE1:blocked_acc#$FullCyan:Blocked ",
1120                 'GPRINT:blocked_min:MIN:%5.1lf Min,',
1121                 'GPRINT:blocked_avg:AVERAGE:%5.1lf Average,',
1122                 'GPRINT:blocked_max:MAX:%5.1lf Max,',
1123                 'GPRINT:blocked_avg:LAST:%5.1lf Last\l',
1124                 "LINE1:zombies_acc#$FullRed:Zombies ",
1125                 'GPRINT:zombies_min:MIN:%5.1lf Min,',
1126                 'GPRINT:zombies_avg:AVERAGE:%5.1lf Average,',
1127                 'GPRINT:zombies_max:MAX:%5.1lf Max,',
1128                 'GPRINT:zombies_avg:LAST:%5.1lf Last\l',
1129                 "LINE1:stopped_acc#$FullMagenta:Stopped ",
1130                 'GPRINT:stopped_min:MIN:%5.1lf Min,',
1131                 'GPRINT:stopped_avg:AVERAGE:%5.1lf Average,',
1132                 'GPRINT:stopped_max:MAX:%5.1lf Max,',
1133                 'GPRINT:stopped_avg:LAST:%5.1lf Last\l',
1134                 "LINE1:running_acc#$FullGreen:Running ",
1135                 'GPRINT:running_min:MIN:%5.1lf Min,',
1136                 'GPRINT:running_avg:AVERAGE:%5.1lf Average,',
1137                 'GPRINT:running_max:MAX:%5.1lf Max,',
1138                 'GPRINT:running_avg:LAST:%5.1lf Last\l',
1139                 "LINE1:sleeping_acc#$FullBlue:Sleeping",
1140                 'GPRINT:sleeping_min:MIN:%5.1lf Min,',
1141                 'GPRINT:sleeping_avg:AVERAGE:%5.1lf Average,',
1142                 'GPRINT:sleeping_max:MAX:%5.1lf Max,',
1143                 'GPRINT:sleeping_avg:LAST:%5.1lf Last\l');
1144         $GraphDefs['ps_count'] = array(
1145                 '-v', 'Processes',
1146                 'DEF:procs_avg={file}:processes:AVERAGE',
1147                 'DEF:procs_min={file}:processes:MIN',
1148                 'DEF:procs_max={file}:processes:MAX',
1149                 'DEF:thrds_avg={file}:threads:AVERAGE',
1150                 'DEF:thrds_min={file}:threads:MIN',
1151                 'DEF:thrds_max={file}:threads:MAX',
1152                 "AREA:thrds_avg#$HalfBlue",
1153                 "AREA:procs_avg#$HalfRed",
1154                 "LINE1:thrds_avg#$FullBlue:Threads  ",
1155                 'GPRINT:thrds_min:MIN:%5.1lf Min,',
1156                 'GPRINT:thrds_avg:AVERAGE:%5.1lf Avg,',
1157                 'GPRINT:thrds_max:MAX:%5.1lf Max,',
1158                 'GPRINT:thrds_avg:LAST:%5.1lf Last\l',
1159                 "LINE1:procs_avg#$FullRed:Processes",
1160                 'GPRINT:procs_min:MIN:%5.1lf Min,',
1161                 'GPRINT:procs_avg:AVERAGE:%5.1lf Avg,',
1162                 'GPRINT:procs_max:MAX:%5.1lf Max,',
1163                 'GPRINT:procs_avg:LAST:%5.1lf Last\l');
1164         $GraphDefs['ps_cputime'] = array(
1165                 '-v', 'Jiffies',
1166                 'DEF:user_avg_raw={file}:user:AVERAGE',
1167                 'DEF:user_min_raw={file}:user:MIN',
1168                 'DEF:user_max_raw={file}:user:MAX',
1169                 'DEF:syst_avg_raw={file}:syst:AVERAGE',
1170                 'DEF:syst_min_raw={file}:syst:MIN',
1171                 'DEF:syst_max_raw={file}:syst:MAX',
1172                 'CDEF:user_avg=user_avg_raw,1000000,/',
1173                 'CDEF:user_min=user_min_raw,1000000,/',
1174                 'CDEF:user_max=user_max_raw,1000000,/',
1175                 'CDEF:syst_avg=syst_avg_raw,1000000,/',
1176                 'CDEF:syst_min=syst_min_raw,1000000,/',
1177                 'CDEF:syst_max=syst_max_raw,1000000,/',
1178                 'CDEF:user_syst=syst_avg,UN,0,syst_avg,IF,user_avg,+',
1179                 "AREA:user_syst#$HalfBlue",
1180                 "AREA:syst_avg#$HalfRed",
1181                 "LINE1:user_syst#$FullBlue:User  ",
1182                 'GPRINT:user_min:MIN:%5.1lf%s Min,',
1183                 'GPRINT:user_avg:AVERAGE:%5.1lf%s Avg,',
1184                 'GPRINT:user_max:MAX:%5.1lf%s Max,',
1185                 'GPRINT:user_avg:LAST:%5.1lf%s Last\l',
1186                 "LINE1:syst_avg#$FullRed:System",
1187                 'GPRINT:syst_min:MIN:%5.1lf%s Min,',
1188                 'GPRINT:syst_avg:AVERAGE:%5.1lf%s Avg,',
1189                 'GPRINT:syst_max:MAX:%5.1lf%s Max,',
1190                 'GPRINT:syst_avg:LAST:%5.1lf%s Last\l');
1191         $GraphDefs['ps_pagefaults'] = array(
1192                 '-v', 'Pagefaults/s',
1193                 'DEF:minor_avg={file}:minflt:AVERAGE',
1194                 'DEF:minor_min={file}:minflt:MIN',
1195                 'DEF:minor_max={file}:minflt:MAX',
1196                 'DEF:major_avg={file}:majflt:AVERAGE',
1197                 'DEF:major_min={file}:majflt:MIN',
1198                 'DEF:major_max={file}:majflt:MAX',
1199                 'CDEF:minor_major=major_avg,UN,0,major_avg,IF,minor_avg,+',
1200                 "AREA:minor_major#$HalfBlue",
1201                 "AREA:major_avg#$HalfRed",
1202                 "LINE1:minor_major#$FullBlue:Minor",
1203                 'GPRINT:minor_min:MIN:%5.1lf%s Min,',
1204                 'GPRINT:minor_avg:AVERAGE:%5.1lf%s Avg,',
1205                 'GPRINT:minor_max:MAX:%5.1lf%s Max,',
1206                 'GPRINT:minor_avg:LAST:%5.1lf%s Last\l',
1207                 "LINE1:major_avg#$FullRed:Major",
1208                 'GPRINT:major_min:MIN:%5.1lf%s Min,',
1209                 'GPRINT:major_avg:AVERAGE:%5.1lf%s Avg,',
1210                 'GPRINT:major_max:MAX:%5.1lf%s Max,',
1211                 'GPRINT:major_avg:LAST:%5.1lf%s Last\l');
1212         $GraphDefs['ps_rss'] = array(
1213                 '-v', 'Bytes',
1214                 'DEF:avg={file}:value:AVERAGE',
1215                 'DEF:min={file}:value:MIN',
1216                 'DEF:max={file}:value:MAX',
1217                 "AREA:avg#$HalfBlue",
1218                 "LINE1:avg#$FullBlue:RSS",
1219                 'GPRINT:min:MIN:%5.1lf%s Min,',
1220                 'GPRINT:avg:AVERAGE:%5.1lf%s Avg,',
1221                 'GPRINT:max:MAX:%5.1lf%s Max,',
1222                 'GPRINT:avg:LAST:%5.1lf%s Last\l');
1223         $GraphDefs['ps_state'] = array(
1224                 '-v', 'Processes',
1225                 'DEF:avg={file}:value:AVERAGE',
1226                 'DEF:min={file}:value:MIN',
1227                 'DEF:max={file}:value:MAX',
1228                 "AREA:max#$HalfBlue",
1229                 "AREA:min#$Canvas",
1230                 "LINE1:avg#$FullBlue:Processes",
1231                 'GPRINT:min:MIN:%6.2lf Min,',
1232                 'GPRINT:avg:AVERAGE:%6.2lf Avg,',
1233                 'GPRINT:max:MAX:%6.2lf Max,',
1234                 'GPRINT:avg:LAST:%6.2lf Last\l');
1235         $GraphDefs['qtype'] = array(
1236                 'DEF:avg={file}:value:AVERAGE',
1237                 'DEF:min={file}:value:MIN',
1238                 'DEF:max={file}:value:MAX',
1239                 "AREA:max#$HalfBlue",
1240                 "AREA:min#$Canvas",
1241                 "LINE1:avg#$FullBlue:Queries/s",
1242                 'GPRINT:min:MIN:%9.3lf Min,',
1243                 'GPRINT:avg:AVERAGE:%9.3lf Average,',
1244                 'GPRINT:max:MAX:%9.3lf Max,',
1245                 'GPRINT:avg:LAST:%9.3lf Last\l');
1246         $GraphDefs['rcode'] = array(
1247                 'DEF:avg={file}:value:AVERAGE',
1248                 'DEF:min={file}:value:MIN',
1249                 'DEF:max={file}:value:MAX',
1250                 "AREA:max#$HalfBlue",
1251                 "AREA:min#$Canvas",
1252                 "LINE1:avg#$FullBlue:Queries/s",
1253                 'GPRINT:min:MIN:%9.3lf Min,',
1254                 'GPRINT:avg:AVERAGE:%9.3lf Average,',
1255                 'GPRINT:max:MAX:%9.3lf Max,',
1256                 'GPRINT:avg:LAST:%9.3lf Last\l');
1257         $GraphDefs['swap'] = array(
1258                 '-v', 'Bytes', '-b', '1024',
1259                 'DEF:avg={file}:value:AVERAGE',
1260                 'DEF:min={file}:value:MIN',
1261                 'DEF:max={file}:value:MAX',
1262                 "AREA:max#$HalfBlue",
1263                 "AREA:min#$Canvas",
1264                 "LINE1:avg#$FullBlue:Bytes",
1265                 'GPRINT:min:MIN:%6.2lf%sByte Min,',
1266                 'GPRINT:avg:AVERAGE:%6.2lf%sByte Avg,',
1267                 'GPRINT:max:MAX:%6.2lf%sByte Max,',
1268                 'GPRINT:avg:LAST:%6.2lf%sByte Last\l');
1269         $GraphDefs['old_swap'] = array(
1270                 'DEF:used_avg={file}:used:AVERAGE',
1271                 'DEF:used_min={file}:used:MIN',
1272                 'DEF:used_max={file}:used:MAX',
1273                 'DEF:free_avg={file}:free:AVERAGE',
1274                 'DEF:free_min={file}:free:MIN',
1275                 'DEF:free_max={file}:free:MAX',
1276                 'DEF:cach_avg={file}:cached:AVERAGE',
1277                 'DEF:cach_min={file}:cached:MIN',
1278                 'DEF:cach_max={file}:cached:MAX',
1279                 'DEF:resv_avg={file}:resv:AVERAGE',
1280                 'DEF:resv_min={file}:resv:MIN',
1281                 'DEF:resv_max={file}:resv:MAX',
1282                 'CDEF:cach_avg_notnull=cach_avg,UN,0,cach_avg,IF',
1283                 'CDEF:resv_avg_notnull=resv_avg,UN,0,resv_avg,IF',
1284                 'CDEF:used_acc=used_avg',
1285                 'CDEF:resv_acc=used_acc,resv_avg_notnull,+',
1286                 'CDEF:cach_acc=resv_acc,cach_avg_notnull,+',
1287                 'CDEF:free_acc=cach_acc,free_avg,+',
1288                 "AREA:free_acc#$HalfGreen",
1289                 "AREA:cach_acc#$HalfBlue",
1290                 "AREA:resv_acc#$HalfYellow",
1291                 "AREA:used_acc#$HalfRed",
1292                 "LINE1:free_acc#$FullGreen:Free    ",
1293                 'GPRINT:free_min:MIN:%5.1lf%s Min,',
1294                 'GPRINT:free_avg:AVERAGE:%5.1lf%s Avg,',
1295                 'GPRINT:free_max:MAX:%5.1lf%s Max,',
1296                 'GPRINT:free_avg:LAST:%5.1lf%s Last\n',
1297                 "LINE1:cach_acc#$FullBlue:Cached  ",
1298                 'GPRINT:cach_min:MIN:%5.1lf%s Min,',
1299                 'GPRINT:cach_avg:AVERAGE:%5.1lf%s Avg,',
1300                 'GPRINT:cach_max:MAX:%5.1lf%s Max,',
1301                 'GPRINT:cach_avg:LAST:%5.1lf%s Last\l',
1302                 "LINE1:resv_acc#$FullYellow:Reserved",
1303                 'GPRINT:resv_min:MIN:%5.1lf%s Min,',
1304                 'GPRINT:resv_avg:AVERAGE:%5.1lf%s Avg,',
1305                 'GPRINT:resv_max:MAX:%5.1lf%s Max,',
1306                 'GPRINT:resv_avg:LAST:%5.1lf%s Last\n',
1307                 "LINE1:used_acc#$FullRed:Used    ",
1308                 'GPRINT:used_min:MIN:%5.1lf%s Min,',
1309                 'GPRINT:used_avg:AVERAGE:%5.1lf%s Avg,',
1310                 'GPRINT:used_max:MAX:%5.1lf%s Max,',
1311                 'GPRINT:used_avg:LAST:%5.1lf%s Last\l');
1312         $GraphDefs['tcp_connections'] = array(
1313                 '-v', 'Connections',
1314                 'DEF:avg={file}:value:AVERAGE',
1315                 'DEF:min={file}:value:MIN',
1316                 'DEF:max={file}:value:MAX',
1317                 "AREA:max#$HalfBlue",
1318                 "AREA:min#$Canvas",
1319                 "LINE1:avg#$FullBlue:Connections",
1320                 'GPRINT:min:MIN:%4.1lf Min,',
1321                 'GPRINT:avg:AVERAGE:%4.1lf Avg,',
1322                 'GPRINT:max:MAX:%4.1lf Max,',
1323                 'GPRINT:avg:LAST:%4.1lf Last\l');
1324         $GraphDefs['temperature'] = array(
1325                 '-v', 'Celsius',
1326                 'DEF:temp_avg={file}:value:AVERAGE',
1327                 'DEF:temp_min={file}:value:MIN',
1328                 'DEF:temp_max={file}:value:MAX',
1329                 'CDEF:average=temp_avg,0.2,*,PREV,UN,temp_avg,PREV,IF,0.8,*,+',
1330                 "AREA:temp_max#$HalfRed",
1331                 "AREA:temp_min#$Canvas",
1332                 "LINE1:temp_avg#$FullRed:Temperature",
1333                 'GPRINT:temp_min:MIN:%4.1lf Min,',
1334                 'GPRINT:temp_avg:AVERAGE:%4.1lf Avg,',
1335                 'GPRINT:temp_max:MAX:%4.1lf Max,',
1336                 'GPRINT:temp_avg:LAST:%4.1lf Last\l');
1337         $GraphDefs['timeleft'] = array(
1338                 '-v', 'Minutes',
1339                 'DEF:avg={file}:timeleft:AVERAGE',
1340                 'DEF:min={file}:timeleft:MIN',
1341                 'DEF:max={file}:timeleft:MAX',
1342                 "AREA:max#$HalfBlue",
1343                 "AREA:min#$Canvas",
1344                 "LINE1:avg#$FullBlue:Time left [min]",
1345                 'GPRINT:min:MIN:%5.1lf%s Min,',
1346                 'GPRINT:avg:AVERAGE:%5.1lf%s Avg,',
1347                 'GPRINT:max:MAX:%5.1lf%s Max,',
1348                 'GPRINT:avg:LAST:%5.1lf%s Last\l');
1349         $GraphDefs['time_offset'] = array( # NTPd
1350                 'DEF:s_avg={file}:seconds:AVERAGE',
1351                 'DEF:s_min={file}:seconds:MIN',
1352                 'DEF:s_max={file}:seconds:MAX',
1353                 "AREA:s_max#$HalfBlue",
1354                 "AREA:s_min#$Canvas",
1355                 "LINE1:s_avg#$FullBlue:{inst}",
1356                 'GPRINT:s_min:MIN:%7.3lf%s Min,',
1357                 'GPRINT:s_avg:AVERAGE:%7.3lf%s Avg,',
1358                 'GPRINT:s_max:MAX:%7.3lf%s Max,',
1359                 'GPRINT:s_avg:LAST:%7.3lf%s Last');
1360         $GraphDefs['if_octets'] = array(
1361                 '-v', 'Bits/s', '--units=si',
1362                 'DEF:out_min_raw={file}:tx:MIN',
1363                 'DEF:out_avg_raw={file}:tx:AVERAGE',
1364                 'DEF:out_max_raw={file}:tx:MAX',
1365                 'DEF:inc_min_raw={file}:rx:MIN',
1366                 'DEF:inc_avg_raw={file}:rx:AVERAGE',
1367                 'DEF:inc_max_raw={file}:rx:MAX',
1368                 'CDEF:out_min=out_min_raw,8,*',
1369                 'CDEF:out_avg=out_avg_raw,8,*',
1370                 'CDEF:out_max=out_max_raw,8,*',
1371                 'CDEF:inc_min=inc_min_raw,8,*',
1372                 'CDEF:inc_avg=inc_avg_raw,8,*',
1373                 'CDEF:inc_max=inc_max_raw,8,*',
1374                 'CDEF:overlap=out_avg,inc_avg,GT,inc_avg,out_avg,IF',
1375                 'CDEF:mytime=out_avg_raw,TIME,TIME,IF',
1376                 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
1377                 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
1378                 'CDEF:out_avg_sample=out_avg_raw,UN,0,out_avg_raw,IF,sample_len,*',
1379                 'CDEF:out_avg_sum=PREV,UN,0,PREV,IF,out_avg_sample,+',
1380                 'CDEF:inc_avg_sample=inc_avg_raw,UN,0,inc_avg_raw,IF,sample_len,*',
1381                 'CDEF:inc_avg_sum=PREV,UN,0,PREV,IF,inc_avg_sample,+',
1382                 "AREA:out_avg#$HalfGreen",
1383                 "AREA:inc_avg#$HalfBlue",
1384                 "AREA:overlap#$HalfBlueGreen",
1385                 "LINE1:out_avg#$FullGreen:Outgoing",
1386                 'GPRINT:out_avg:AVERAGE:%5.1lf%s Avg,',
1387                 'GPRINT:out_max:MAX:%5.1lf%s Max,',
1388                 'GPRINT:out_avg:LAST:%5.1lf%s Last',
1389                 'GPRINT:out_avg_sum:LAST:(ca. %5.1lf%sB Total)\l',
1390                 "LINE1:inc_avg#$FullBlue:Incoming",
1391 //                      'GPRINT:inc_min:MIN:%5.1lf %s Min,',
1392                 'GPRINT:inc_avg:AVERAGE:%5.1lf%s Avg,',
1393                 'GPRINT:inc_max:MAX:%5.1lf%s Max,',
1394                 'GPRINT:inc_avg:LAST:%5.1lf%s Last',
1395                 'GPRINT:inc_avg_sum:LAST:(ca. %5.1lf%sB Total)\l');
1396         $GraphDefs['cpufreq'] = array(
1397                 'DEF:cpufreq_avg={file}:value:AVERAGE',
1398                 'DEF:cpufreq_min={file}:value:MIN',
1399                 'DEF:cpufreq_max={file}:value:MAX',
1400                 "AREA:cpufreq_max#$HalfBlue",
1401                 "AREA:cpufreq_min#$Canvas",
1402                 "LINE1:cpufreq_avg#$FullBlue:Frequency",
1403                 'GPRINT:cpufreq_min:MIN:%5.1lf%s Min,',
1404                 'GPRINT:cpufreq_avg:AVERAGE:%5.1lf%s Avg,',
1405                 'GPRINT:cpufreq_max:MAX:%5.1lf%s Max,',
1406                 'GPRINT:cpufreq_avg:LAST:%5.1lf%s Last\l');
1407         $GraphDefs['multimeter'] = array(
1408                 'DEF:multimeter_avg={file}:value:AVERAGE',
1409                 'DEF:multimeter_min={file}:value:MIN',
1410                 'DEF:multimeter_max={file}:value:MAX',
1411                 "AREA:multimeter_max#$HalfBlue",
1412                 "AREA:multimeter_min#$Canvas",
1413                 "LINE1:multimeter_avg#$FullBlue:Multimeter",
1414                 'GPRINT:multimeter_min:MIN:%4.1lf Min,',
1415                 'GPRINT:multimeter_avg:AVERAGE:%4.1lf Average,',
1416                 'GPRINT:multimeter_max:MAX:%4.1lf Max,',
1417                 'GPRINT:multimeter_avg:LAST:%4.1lf Last\l');
1418         $GraphDefs['users'] = array(
1419                 '-v', 'Users',
1420                 'DEF:users_avg={file}:users:AVERAGE',
1421                 'DEF:users_min={file}:users:MIN',
1422                 'DEF:users_max={file}:users:MAX',
1423                 "AREA:users_max#$HalfBlue",
1424                 "AREA:users_min#$Canvas",
1425                 "LINE1:users_avg#$FullBlue:Users",
1426                 'GPRINT:users_min:MIN:%4.1lf Min,',
1427                 'GPRINT:users_avg:AVERAGE:%4.1lf Average,',
1428                 'GPRINT:users_max:MAX:%4.1lf Max,',
1429                 'GPRINT:users_avg:LAST:%4.1lf Last\l');
1430         $GraphDefs['voltage'] = array(
1431                 '-v', 'Voltage',
1432                 'DEF:avg={file}:value:AVERAGE',
1433                 'DEF:min={file}:value:MIN',
1434                 'DEF:max={file}:value:MAX',
1435                 "AREA:max#$HalfBlue",
1436                 "AREA:min#$Canvas",
1437                 "LINE1:avg#$FullBlue:Voltage",
1438                 'GPRINT:min:MIN:%5.1lf%sV Min,',
1439                 'GPRINT:avg:AVERAGE:%5.1lf%sV Avg,',
1440                 'GPRINT:max:MAX:%5.1lf%sV Max,',
1441                 'GPRINT:avg:LAST:%5.1lf%sV Last\l');
1442         $GraphDefs['vmpage_action'] = array(
1443                 '-v', 'Actions',
1444                 'DEF:avg={file}:value:AVERAGE',
1445                 'DEF:min={file}:value:MIN',
1446                 'DEF:max={file}:value:MAX',
1447                 "AREA:max#$HalfBlue",
1448                 "AREA:min#$Canvas",
1449                 "LINE1:avg#$FullBlue:Action",
1450                 'GPRINT:min:MIN:%5.1lf%sV Min,',
1451                 'GPRINT:avg:AVERAGE:%5.1lf%sV Avg,',
1452                 'GPRINT:max:MAX:%5.1lf%sV Max,',
1453                 'GPRINT:avg:LAST:%5.1lf%sV Last\l');
1454         $GraphDefs['vmpage_faults'] = $GraphDefs['ps_pagefaults'];
1455         $GraphDefs['vmpage_io'] = array(
1456                 '-v', 'Bytes/s',
1457                 'DEF:out_min={file}:out:MIN',
1458                 'DEF:out_avg={file}:out:AVERAGE',
1459                 'DEF:out_max={file}:out:MAX',
1460                 'DEF:inc_min={file}:in:MIN',
1461                 'DEF:inc_avg={file}:in:AVERAGE',
1462                 'DEF:inc_max={file}:in:MAX',
1463                 'CDEF:overlap=out_avg,inc_avg,GT,inc_avg,out_avg,IF',
1464                 'CDEF:mytime=out_avg,TIME,TIME,IF',
1465                 'CDEF:sample_len_raw=mytime,PREV(mytime),-',
1466                 'CDEF:sample_len=sample_len_raw,UN,0,sample_len_raw,IF',
1467                 'CDEF:out_avg_sample=out_avg,UN,0,out_avg,IF,sample_len,*',
1468                 'CDEF:out_avg_sum=PREV,UN,0,PREV,IF,out_avg_sample,+',
1469                 'CDEF:inc_avg_sample=inc_avg,UN,0,inc_avg,IF,sample_len,*',
1470                 'CDEF:inc_avg_sum=PREV,UN,0,PREV,IF,inc_avg_sample,+',
1471                 "AREA:out_avg#$HalfGreen",
1472                 "AREA:inc_avg#$HalfBlue",
1473                 "AREA:overlap#$HalfBlueGreen",
1474                 "LINE1:out_avg#$FullGreen:Written",
1475                 'GPRINT:out_avg:AVERAGE:%5.1lf%s Avg,',
1476                 'GPRINT:out_max:MAX:%5.1lf%s Max,',
1477                 'GPRINT:out_avg:LAST:%5.1lf%s Last',
1478                 'GPRINT:out_avg_sum:LAST:(ca. %5.1lf%sB Total)\l',
1479                 "LINE1:inc_avg#$FullBlue:Read   ",
1480                 'GPRINT:inc_avg:AVERAGE:%5.1lf%s Avg,',
1481                 'GPRINT:inc_max:MAX:%5.1lf%s Max,',
1482                 'GPRINT:inc_avg:LAST:%5.1lf%s Last',
1483                 'GPRINT:inc_avg_sum:LAST:(ca. %5.1lf%sB Total)\l');
1484         $GraphDefs['vmpage_number'] = array(
1485                 '-v', 'Count',
1486                 'DEF:avg={file}:value:AVERAGE',
1487                 'DEF:min={file}:value:MIN',
1488                 'DEF:max={file}:value:MAX',
1489                 "AREA:avg#$HalfBlue",
1490                 "LINE1:avg#$FullBlue:Count",
1491                 'GPRINT:min:MIN:%5.1lf%s Min,',
1492                 'GPRINT:avg:AVERAGE:%5.1lf%s Avg,',
1493                 'GPRINT:max:MAX:%5.1lf%s Max,',
1494                 'GPRINT:avg:LAST:%5.1lf%s Last\l');
1495         $GraphDefs['vs_threads'] = array(
1496                 "DEF:total_avg={file}:total:AVERAGE",
1497                 "DEF:total_min={file}:total:MIN",
1498                 "DEF:total_max={file}:total:MAX",
1499                 "DEF:running_avg={file}:running:AVERAGE",
1500                 "DEF:running_min={file}:running:MIN",
1501                 "DEF:running_max={file}:running:MAX",
1502                 "DEF:uninterruptible_avg={file}:uninterruptible:AVERAGE",
1503                 "DEF:uninterruptible_min={file}:uninterruptible:MIN",
1504                 "DEF:uninterruptible_max={file}:uninterruptible:MAX",
1505                 "DEF:onhold_avg={file}:onhold:AVERAGE",
1506                 "DEF:onhold_min={file}:onhold:MIN",
1507                 "DEF:onhold_max={file}:onhold:MAX",
1508                 "LINE1:total_avg#$FullYellow:Total   ",
1509                 'GPRINT:total_min:MIN:%5.1lf Min,',
1510                 'GPRINT:total_avg:AVERAGE:%5.1lf Avg.,',
1511                 'GPRINT:total_max:MAX:%5.1lf Max,',
1512                 'GPRINT:total_avg:LAST:%5.1lf Last\l',
1513                 "LINE1:running_avg#$FullRed:Running ",
1514                 'GPRINT:running_min:MIN:%5.1lf Min,',
1515                 'GPRINT:running_avg:AVERAGE:%5.1lf Avg.,',
1516                 'GPRINT:running_max:MAX:%5.1lf Max,',
1517                 'GPRINT:running_avg:LAST:%5.1lf Last\l',
1518                 "LINE1:uninterruptible_avg#$FullGreen:Unintr  ",
1519                 'GPRINT:uninterruptible_min:MIN:%5.1lf Min,',
1520                 'GPRINT:uninterruptible_avg:AVERAGE:%5.1lf Avg.,',
1521                 'GPRINT:uninterruptible_max:MAX:%5.1lf Max,',
1522                 'GPRINT:uninterruptible_avg:LAST:%5.1lf Last\l',
1523                 "LINE1:onhold_avg#$FullBlue:Onhold  ",
1524                 'GPRINT:onhold_min:MIN:%5.1lf Min,',
1525                 'GPRINT:onhold_avg:AVERAGE:%5.1lf Avg.,',
1526                 'GPRINT:onhold_max:MAX:%5.1lf Max,',
1527                 'GPRINT:onhold_avg:LAST:%5.1lf Last\l');
1528         $GraphDefs['vs_memory'] = array(
1529                 'DEF:vm_avg={file}:vm:AVERAGE',
1530                 'DEF:vm_min={file}:vm:MIN',
1531                 'DEF:vm_max={file}:vm:MAX',
1532                 'DEF:vml_avg={file}:vml:AVERAGE',
1533                 'DEF:vml_min={file}:vml:MIN',
1534                 'DEF:vml_max={file}:vml:MAX',
1535                 'DEF:rss_avg={file}:rss:AVERAGE',
1536                 'DEF:rss_min={file}:rss:MIN',
1537                 'DEF:rss_max={file}:rss:MAX',
1538                 'DEF:anon_avg={file}:anon:AVERAGE',
1539                 'DEF:anon_min={file}:anon:MIN',
1540                 'DEF:anon_max={file}:anon:MAX',
1541                 "LINE1:vm_avg#$FullYellow:VM     ",
1542                 'GPRINT:vm_min:MIN:%5.1lf%s Min,',
1543                 'GPRINT:vm_avg:AVERAGE:%5.1lf%s Avg.,',
1544                 'GPRINT:vm_max:MAX:%5.1lf%s Avg.,',
1545                 'GPRINT:vm_avg:LAST:%5.1lf%s Last\l',
1546                 "LINE1:vml_avg#$FullRed:Locked ",
1547                 'GPRINT:vml_min:MIN:%5.1lf%s Min,',
1548                 'GPRINT:vml_avg:AVERAGE:%5.1lf%s Avg.,',
1549                 'GPRINT:vml_max:MAX:%5.1lf%s Avg.,',
1550                 'GPRINT:vml_avg:LAST:%5.1lf%s Last\l',
1551                 "LINE1:rss_avg#$FullGreen:RSS    ",
1552                 'GPRINT:rss_min:MIN:%5.1lf%s Min,',
1553                 'GPRINT:rss_avg:AVERAGE:%5.1lf%s Avg.,',
1554                 'GPRINT:rss_max:MAX:%5.1lf%s Avg.,',
1555                 'GPRINT:rss_avg:LAST:%5.1lf%s Last\l',
1556                 "LINE1:anon_avg#$FullBlue:Anon.  ",
1557                 'GPRINT:anon_min:MIN:%5.1lf%s Min,',
1558                 'GPRINT:anon_avg:AVERAGE:%5.1lf%s Avg.,',
1559                 'GPRINT:anon_max:MAX:%5.1lf%s Avg.,',
1560                 'GPRINT:anon_avg:LAST:%5.1lf%s Last\l');
1561         $GraphDefs['vs_processes'] = array(
1562                 '-v', 'Processes',
1563                 'DEF:proc_avg={file}:value:AVERAGE',
1564                 'DEF:proc_min={file}:value:MIN',
1565                 'DEF:proc_max={file}:value:MAX',
1566                 "AREA:proc_max#$HalfBlue",
1567                 "AREA:proc_min#$Canvas",
1568                 "LINE1:proc_avg#$FullBlue:Processes",
1569                 'GPRINT:proc_min:MIN:%4.1lf Min,',
1570                 'GPRINT:proc_avg:AVERAGE:%4.1lf Avg.,',
1571                 'GPRINT:proc_max:MAX:%4.1lf Max,',
1572                 'GPRINT:proc_avg:LAST:%4.1lf Last\l');
1573         $GraphDefs['if_multicast'] = $GraphDefs['ipt_packets'];
1574         $GraphDefs['if_tx_errors'] = $GraphDefs['if_rx_errors'];
1575
1576         $MetaGraphDefs['files_count']       = 'meta_graph_files_count';
1577         $MetaGraphDefs['files_size']        = 'meta_graph_files_size';
1578         $MetaGraphDefs['cpu']               = 'meta_graph_cpu';
1579         $MetaGraphDefs['if_rx_errors']      = 'meta_graph_if_rx_errors';
1580         $MetaGraphDefs['if_tx_errors']      = 'meta_graph_if_rx_errors';
1581         $MetaGraphDefs['memory']            = 'meta_graph_memory';
1582         $MetaGraphDefs['vs_memory']         = 'meta_graph_vs_memory';
1583         $MetaGraphDefs['vs_threads']        = 'meta_graph_vs_threads';
1584         $MetaGraphDefs['nfs_procedure']     = 'meta_graph_nfs_procedure';
1585         $MetaGraphDefs['ps_state']          = 'meta_graph_ps_state';
1586         $MetaGraphDefs['swap']              = 'meta_graph_swap';
1587         $MetaGraphDefs['apache_scoreboard'] = 'meta_graph_apache_scoreboard';
1588         $MetaGraphDefs['mysql_commands']    = 'meta_graph_mysql_commands';
1589         $MetaGraphDefs['mysql_handler']     = 'meta_graph_mysql_commands';
1590         $MetaGraphDefs['tcp_connections']   = 'meta_graph_tcp_connections';
1591         $MetaGraphDefs['dns_opcode']        = 'meta_graph_dns_event';
1592         $MetaGraphDefs['dns_qtype']         = 'meta_graph_dns_event';
1593         $MetaGraphDefs['dns_qtype_cached']  = 'meta_graph_dns_event';
1594         $MetaGraphDefs['dns_rcode']         = 'meta_graph_dns_event';
1595         $MetaGraphDefs['dns_request']       = 'meta_graph_dns_event';
1596         $MetaGraphDefs['dns_resolver']      = 'meta_graph_dns_event';
1597         $MetaGraphDefs['dns_update']        = 'meta_graph_dns_event';
1598         $MetaGraphDefs['dns_zops']          = 'meta_graph_dns_event';
1599         $MetaGraphDefs['dns_response']      = 'meta_graph_dns_event';
1600         $MetaGraphDefs['dns_query']         = 'meta_graph_dns_event';
1601         $MetaGraphDefs['dns_reject']        = 'meta_graph_dns_event';
1602         $MetaGraphDefs['dns_notify']        = 'meta_graph_dns_event';
1603         $MetaGraphDefs['dns_transfer']      = 'meta_graph_dns_event';
1604
1605         if (function_exists('load_graph_definitions_local'))
1606                 load_graph_definitions_local($logarithmic, $tinylegend);
1607
1608         if ($logarithmic)
1609                 foreach ($GraphDefs as &$GraphDef)
1610                         array_unshift($GraphDef, '-o');
1611         if ($tinylegend)
1612                 foreach ($GraphDefs as &$GraphDef)
1613                         for ($i = count($GraphDef)-1; $i >=0; $i--)
1614                                 if (strncmp('GPRINT:', $GraphDef[$i], 7) == 0)
1615                                         unset($GraphDef[$i]);
1616 }
1617
1618 function meta_graph_files_count($host, $plugin, $plugin_instance, $type, $type_instances, $opts = array()) {
1619         global $config;
1620         $sources = array();
1621
1622         $title = "$host/$plugin".(!is_null($plugin_instance) ? "-$plugin_instance" : '')."/$type";
1623         if (!isset($opts['title']))
1624                 $opts['title'] = $title;
1625         $opts['rrd_opts'] = array('-v', 'Mails');
1626
1627         $files = array();
1628         $opts['colors'] = array(
1629                 'incoming' => '00e000',
1630                 'active'   => 'a0e000',
1631                 'deferred' => 'a00050'
1632         );
1633
1634         $type_instances = array('incoming', 'active', 'deferred');
1635         while (list($k, $inst) = each($type_instances)) {
1636                 $file  = '';
1637                 foreach ($config['datadirs'] as $datadir)
1638                         if (is_file($datadir.'/'.$title.'-'.$inst.'.rrd')) {
1639                                 $file = $datadir.'/'.$title.'-'.$inst.'.rrd';
1640                                 break;
1641                         }
1642                 if ($file == '')
1643                         continue;
1644
1645                 $sources[] = array('name'=>$inst, 'file'=>$file);
1646         }
1647
1648         return collectd_draw_meta_stack($opts, $sources);
1649 }
1650
1651 function meta_graph_files_size($host, $plugin, $plugin_instance, $type, $type_instances, $opts = array()) {
1652         global $config;
1653         $sources = array();
1654
1655         $title = "$host/$plugin".(!is_null($plugin_instance) ? "-$plugin_instance" : '')."/$type";
1656         if (!isset($opts['title']))
1657                 $opts['title'] = $title;
1658         $opts['rrd_opts'] = array('-v', 'Bytes');
1659
1660         $files = array();
1661         $opts['colors'] = array(
1662                 'incoming' => '00e000',
1663                 'active'   => 'a0e000',
1664                 'deferred' => 'a00050'
1665         );
1666
1667         $type_instances = array('incoming', 'active', 'deferred');
1668         while (list($k, $inst) = each($type_instances)) {
1669                 $file  = '';
1670                 foreach ($config['datadirs'] as $datadir)
1671                         if (is_file($datadir.'/'.$title.'-'.$inst.'.rrd')) {
1672                                 $file = $datadir.'/'.$title.'-'.$inst.'.rrd';
1673                                 break;
1674                         }
1675                 if ($file == '')
1676                         continue;
1677
1678                 $sources[] = array('name'=>$inst, 'file'=>$file);
1679         }
1680
1681         return collectd_draw_meta_stack($opts, $sources);
1682 }
1683
1684 function meta_graph_cpu($host, $plugin, $plugin_instance, $type, $type_instances, $opts = array()) {
1685         global $config;
1686         $sources = array();
1687
1688         $title = "$host/$plugin".(!is_null($plugin_instance) ? "-$plugin_instance" : '')."/$type";
1689         if (!isset($opts['title']))
1690                 $opts['title'] = $title;
1691         $opts['rrd_opts'] = array('-v', 'Percent', '-r', '-u', '100');
1692
1693         $files = array();
1694         $opts['colors'] = array(
1695                 'idle'      => 'ffffff',
1696                 'nice'      => '00e000',
1697                 'user'      => '0000ff',
1698                 'wait'      => 'ffb000',
1699                 'system'    => 'ff0000',
1700                 'softirq'   => 'ff00ff',
1701                 'interrupt' => 'a000a0',
1702                 'steal'     => '000000'
1703         );
1704
1705         $type_instances = array('idle', 'wait', 'nice', 'user', 'system', 'softirq', 'interrupt', 'steal');
1706         while (list($k, $inst) = each($type_instances)) {
1707                 $file  = '';
1708                 foreach ($config['datadirs'] as $datadir)
1709                         if (is_file($datadir.'/'.$title.'-'.$inst.'.rrd')) {
1710                                 $file = $datadir.'/'.$title.'-'.$inst.'.rrd';
1711                                 break;
1712                         }
1713                 if ($file == '')
1714                         continue;
1715
1716                 $sources[] = array('name'=>$inst, 'file'=>$file);
1717         }
1718
1719         return collectd_draw_meta_stack($opts, $sources);
1720 }
1721
1722 function meta_graph_memory($host, $plugin, $plugin_instance, $type, $type_instances, $opts = array()) {
1723         global $config;
1724         $sources = array();
1725
1726         $title = "$host/$plugin".(!is_null($plugin_instance) ? "-$plugin_instance" : '')."/$type";
1727         if (!isset($opts['title']))
1728                 $opts['title'] = $title;
1729         $opts['number_format'] = '%5.1lf%s';
1730         $opts['rrd_opts']      = array('-b', '1024', '-v', 'Bytes');
1731
1732         $files = array();
1733         $opts['colors'] = array(
1734                 // Linux - System memoery
1735                 'free'     => '00e000',
1736                 'cached'   => '0000ff',
1737                 'buffered' => 'ffb000',
1738                 'used'     => 'ff0000',
1739                 // Bind - Server memory
1740                 'TotalUse'    => '00e000',
1741                 'InUse'       => 'ff0000',
1742                 'BlockSize'   => '8888dd',
1743                 'ContextSize' => '444499',
1744                 'Lost'        => '222222'
1745         );
1746
1747         $type_instances = array('free', 'cached', 'buffered', 'used',   'TotalUse', 'InUse', 'BlockSize', 'ContextSize', 'Lost');
1748         while (list($k, $inst) = each($type_instances)) {
1749                 $file = '';
1750                 foreach ($config['datadirs'] as $datadir)
1751                         if (is_file($datadir.'/'.$title.'-'.$inst.'.rrd')) {
1752                                 $file = $datadir.'/'.$title.'-'.$inst.'.rrd';
1753                                 break;
1754                         }
1755                 if ($file == '')
1756                         continue;
1757
1758                 $sources[] = array('name'=>$inst, 'file'=>$file);
1759         }
1760
1761         if ($plugin == 'bind')
1762                 return collectd_draw_meta_line($opts, $sources);
1763         else
1764                 return collectd_draw_meta_stack($opts, $sources);
1765 }
1766
1767 function meta_graph_vs_threads($host, $plugin, $plugin_instance, $type, $type_instances, $opts = array()) {
1768         global $config;
1769         $sources = array();
1770
1771         $title = "$host/$plugin".(!is_null($plugin_instance) ? "-$plugin_instance" : '')."/$type";
1772         if (!isset($opts['title']))
1773                 $opts['title'] = $title;
1774         $opts['number_format'] = '%5.1lf%s';
1775         $opts['rrd_opts']      = array('-v', 'Threads');
1776
1777         $files = array();
1778         $opts['colors'] = array(
1779                 'total'   => 'F0A000',
1780                 'running'  => 'FF0000',
1781                 'onhold'  => '00E000',
1782                 'uninterruptable' => '0000FF'
1783         );
1784
1785         $type_instances = array('total', 'running', 'onhold', 'uninterruptable');
1786         while (list($k, $inst) = each($type_instances)) {
1787                 $file = '';
1788                 foreach ($config['datadirs'] as $datadir)
1789                         if (is_file($datadir.'/'.$title.'-'.$inst.'.rrd')) {
1790                                 $file = $datadir.'/'.$title.'-'.$inst.'.rrd';
1791                                 break;
1792                         }
1793                 if ($file == '')
1794                         continue;
1795
1796                 $sources[] = array('name'=>$inst, 'file'=>$file);
1797         }
1798
1799         return collectd_draw_meta_line($opts, $sources);
1800 }
1801
1802 function meta_graph_vs_memory($host, $plugin, $plugin_instance, $type, $type_instances, $opts = array()) {
1803         global $config;
1804         $sources = array();
1805
1806         $title = "$host/$plugin".(!is_null($plugin_instance) ? "-$plugin_instance" : '')."/$type";
1807         if (!isset($opts['title']))
1808                 $opts['title'] = $title;
1809         $opts['number_format'] = '%5.1lf%s';
1810         $opts['rrd_opts']      = array('-b', '1024', '-v', 'Bytes');
1811
1812         $files = array();
1813         $opts['colors'] = array(
1814                 'vm'   => 'F0A000',
1815                 'vml'  => 'FF0000',
1816                 'rss'  => '00E000',
1817                 'anon' => '0000FF'
1818         );
1819
1820         $type_instances = array('anon', 'rss', 'vml', 'vm');
1821         while (list($k, $inst) = each($type_instances)) {
1822                 $file = '';
1823                 foreach ($config['datadirs'] as $datadir)
1824                         if (is_file($datadir.'/'.$title.'-'.$inst.'.rrd')) {
1825                                 $file = $datadir.'/'.$title.'-'.$inst.'.rrd';
1826                                 break;
1827                         }
1828                 if ($file == '')
1829                         continue;
1830
1831                 $sources[] = array('name'=>$inst, 'file'=>$file);
1832         }
1833
1834         return collectd_draw_meta_line($opts, $sources);
1835 }
1836
1837 function meta_graph_if_rx_errors($host, $plugin, $plugin_instance, $type, $type_instances, $opts = array()) {
1838         global $config;
1839         $sources = array();
1840
1841         $title = "$host/$plugin".(!is_null($plugin_instance) ? "-$plugin_instance" : '')."/$type";
1842         if (!isset($opts['title']))
1843                 $opts['title'] = $title;
1844         $opts['number_format'] = '%5.2lf';
1845         $opts['rrd_opts']      = array('-v', 'Errors/s');
1846
1847         $files = array();
1848
1849         while (list($k, $inst) = each($type_instances)) {
1850                 $file = '';
1851                 foreach ($config['datadirs'] as $datadir)
1852                         if (is_file($datadir.'/'.$title.'-'.$inst.'.rrd')) {
1853                                 $file = $datadir.'/'.$title.'-'.$inst.'.rrd';
1854                                 break;
1855                         }
1856                 if ($file == '')
1857                         continue;
1858
1859                 $sources[] = array('name'=>$inst, 'file'=>$file);
1860         }
1861
1862         return collectd_draw_meta_stack($opts, $sources);
1863 }
1864
1865 function meta_graph_mysql_commands($host, $plugin, $plugin_instance, $type, $type_instances, $opts = array()) {
1866         global $config;
1867         $sources = array();
1868
1869         $title = "$host/$plugin".(!is_null($plugin_instance) ? "-$plugin_instance" : '')."/$type";
1870         if (!isset($opts['title']))
1871                 $opts['title'] = $title;
1872         $opts['rrd_opts'] = array('-v', 'Issues/s');
1873         $opts['number_format'] = '%5.2lf';
1874
1875         $files = array();
1876
1877         while (list($k, $inst) = each($type_instances)) {
1878                 $file  = '';
1879                 foreach ($config['datadirs'] as $datadir)
1880                         if (is_file($datadir.'/'.$title.'-'.$inst.'.rrd')) {
1881                                 $file = $datadir.'/'.$title.'-'.$inst.'.rrd';
1882                                 break;
1883                         }
1884                 if ($file == '')
1885                         continue;
1886
1887                 $sources[] = array('name'=>$inst, 'file'=>$file);
1888         }
1889
1890         return collectd_draw_meta_stack($opts, $sources);
1891 }
1892
1893 function meta_graph_nfs_procedure($host, $plugin, $plugin_instance, $type, $type_instances, $opts = array()) {
1894         global $config;
1895         $sources = array();
1896
1897         $title = "$host/$plugin".(!is_null($plugin_instance) ? "-$plugin_instance" : '')."/$type";
1898         if (!isset($opts['title']))
1899                 $opts['title'] = $title;
1900         $opts['number_format'] = '%5.1lf%s';
1901         $opts['rrd_opts'] = array('-v', 'Ops/s');
1902
1903         $files = array();
1904
1905         while (list($k, $inst) = each($type_instances)) {
1906                 $file  = '';
1907                 foreach ($config['datadirs'] as $datadir)
1908                         if (is_file($datadir.'/'.$title.'-'.$inst.'.rrd')) {
1909                                 $file = $datadir.'/'.$title.'-'.$inst.'.rrd';
1910                                 break;
1911                         }
1912                 if ($file == '')
1913                         continue;
1914
1915                 $sources[] = array('name'=>$inst, 'file'=>$file);
1916         }
1917
1918         return collectd_draw_meta_stack($opts, $sources);
1919 }
1920
1921 function meta_graph_ps_state($host, $plugin, $plugin_instance, $type, $type_instances, $opts = array()) {
1922         global $config;
1923         $sources = array();
1924
1925         $title = "$host/$plugin".(!is_null($plugin_instance) ? "-$plugin_instance" : '')."/$type";
1926         if (!isset($opts['title']))
1927                 $opts['title'] = $title;
1928         $opts['rrd_opts'] = array('-v', 'Processes');
1929
1930         $files = array();
1931         $opts['colors'] = array(
1932                 'running'  => '00e000',
1933                 'sleeping' => '0000ff',
1934                 'paging'   => 'ffb000',
1935                 'zombies'  => 'ff0000',
1936                 'blocked'  => 'ff00ff',
1937                 'stopped'  => 'a000a0'
1938         );
1939
1940         $type_instances = array('paging', 'blocked', 'zombies', 'stopped', 'running', 'sleeping');
1941         while (list($k, $inst) = each($type_instances)) {
1942                 $file = '';
1943                 foreach ($config['datadirs'] as $datadir)
1944                         if (is_file($datadir.'/'.$title.'-'.$inst.'.rrd')) {
1945                                 $file = $datadir.'/'.$title.'-'.$inst.'.rrd';
1946                                 break;
1947                         }
1948                 if ($file == '')
1949                         continue;
1950
1951                 $sources[] = array('name'=>$inst, 'file'=>$file);
1952         }
1953
1954         return collectd_draw_meta_stack($opts, $sources);
1955 }
1956
1957 function meta_graph_swap($host, $plugin, $plugin_instance, $type, $type_instances, $opts = array()) {
1958         global $config;
1959         $sources = array();
1960
1961         $title = "$host/$plugin".(!is_null($plugin_instance) ? "-$plugin_instance" : '')."/$type";
1962         if (!isset($opts['title']))
1963                 $opts['title'] = $title;
1964         $opts['number_format'] = '%5.1lf%s';
1965         $opts['rrd_opts']      = array('-b', '1024', '-v', 'Bytes');
1966
1967         $files = array();
1968         $opts['colors'] = array(
1969                 'free'     => '00e000',
1970                 'cached'   => '0000ff',
1971                 'used'     => 'ff0000'
1972         );
1973
1974         $type_instances = array('free', 'cached', 'used');
1975         while (list($k, $inst) = each($type_instances)) {
1976                 $file = '';
1977                 foreach ($config['datadirs'] as $datadir)
1978                         if (is_file($datadir.'/'.$title.'-'.$inst.'.rrd')) {
1979                                 $file = $datadir.'/'.$title.'-'.$inst.'.rrd';
1980                                 break;
1981                         }
1982                 if ($file == '')
1983                         continue;
1984
1985                 $sources[] = array('name'=>$inst, 'file'=>$file);
1986         }
1987
1988         return collectd_draw_meta_stack($opts, $sources);
1989 }
1990
1991 function meta_graph_apache_scoreboard($host, $plugin, $plugin_instance, $type, $type_instances, $opts = array()) {
1992         global $config;
1993         $sources = array();
1994
1995         $title = "$host/$plugin".(!is_null($plugin_instance) ? "-$plugin_instance" : '')."/$type";
1996         if (!isset($opts['title']))
1997                 $opts['title'] = $title;
1998         $opts['number_format'] = '%6.2lf%s';
1999         $opts['rrd_opts']      = array('-v', 'Processes');
2000
2001         $files = array();
2002         $opts['colors'] = array(
2003                 'open'         => '00e000',
2004                 'waiting'      => '0000ff',
2005                 'starting'     => 'a00000',
2006                 'reading'      => 'ff0000',
2007                 'sending'      => '00ff00',
2008                 'keepalive'    => 'f000f0',
2009                 'dnslookup'    => '00a000',
2010                 'logging'      => '008080',
2011                 'closing'      => 'a000a0',
2012                 'finishing'    => '000080',
2013                 'idle_cleanup' => '000000',
2014         );
2015
2016         $type_instances = array(/* 'open',*/ 'waiting', 'starting', 'reading', 'sending', 'keepalive', 'dnslookup', 'logging', 'closing', 'finishing', 'idle_cleanup');
2017         while (list($k, $inst) = each($type_instances)) {
2018                 $file = '';
2019                 foreach ($config['datadirs'] as $datadir)
2020                         if (is_file($datadir.'/'.$title.'-'.$inst.'.rrd')) {
2021                                 $file = $datadir.'/'.$title.'-'.$inst.'.rrd';
2022                                 break;
2023                         }
2024                 if ($file == '')
2025                         continue;
2026
2027                 $sources[] = array('name'=>$inst, 'file'=>$file, 'ds'=>'value');
2028         }
2029
2030         return collectd_draw_meta_stack($opts, $sources);
2031 }
2032
2033 function meta_graph_tcp_connections($host, $plugin, $plugin_instance, $type, $type_instances, $opts = array()) {
2034         global $config;
2035         $sources = array();
2036
2037         $title = "$host/$plugin".(!is_null($plugin_instance) ? "-$plugin_instance" : '')."/$type";
2038         if (!isset($opts['title']))
2039                 $opts['title'] = $title;
2040         $opts['number_format'] = '%6.2lf%s';
2041         $opts['rrd_opts']      = array('-v', 'Connections');
2042
2043         $files = array();
2044         $opts['colors'] = array(
2045                 'ESTABLISHED' => '00e000',
2046                 'SYN_SENT'    => '00e0ff',
2047                 'SYN_RECV'    => '00e0a0',
2048                 'FIN_WAIT1'   => 'f000f0',
2049                 'FIN_WAIT2'   => 'f000a0',
2050                 'TIME_WAIT'   => 'ffb000',
2051                 'CLOSE'       => '0000f0',
2052                 'CLOSE_WAIT'  => '0000a0',
2053                 'LAST_ACK'    => '000080',
2054                 'LISTEN'      => 'ff0000',
2055                 'CLOSING'     => '000000'
2056         );
2057
2058         $type_instances = array('ESTABLISHED', 'SYN_SENT', 'SYN_RECV', 'FIN_WAIT1', 'FIN_WAIT2', 'TIME_WAIT', 'CLOSE', 'CLOSE_WAIT', 'LAST_ACK', 'CLOSING', 'LISTEN');
2059         while (list($k, $inst) = each($type_instances)) {
2060                 $file = '';
2061                 foreach ($config['datadirs'] as $datadir)
2062                         if (is_file($datadir.'/'.$title.'-'.$inst.'.rrd')) {
2063                                 $file = $datadir.'/'.$title.'-'.$inst.'.rrd';
2064                                 break;
2065                         }
2066                 if ($file == '')
2067                         continue;
2068
2069                 $sources[] = array('name'=>$inst, 'file'=>$file, 'ds'=>'value');
2070         }
2071
2072         return collectd_draw_meta_stack($opts, $sources);
2073 }
2074
2075 function meta_graph_dns_event($host, $plugin, $plugin_instance, $type, $type_instances, $opts = array()) {
2076         global $config;
2077         $sources = array();
2078
2079         $title = "$host/$plugin".(!is_null($plugin_instance) ? "-$plugin_instance" : '')."/$type";
2080         if (!isset($opts['title']))
2081                 $opts['title'] = $title;
2082         $opts['rrd_opts'] = array('-v', 'Events', '-r', '-l', '0');
2083
2084         $files = array();
2085 //      $opts['colors'] = array(
2086 //      );
2087
2088 //      $type_instances = array('IQUERY', 'NOTIFY');
2089         while (list($k, $inst) = each($type_instances)) {
2090                 $file  = '';
2091                 $title = $opts['title'];
2092                 foreach ($config['datadirs'] as $datadir)
2093                         if (is_file($datadir.'/'.$title.'-'.$inst.'.rrd')) {
2094                                 $file = $datadir.'/'.$title.'-'.$inst.'.rrd';
2095                                 break;
2096                         }
2097                 if ($file == '')
2098                         continue;
2099
2100                 $sources[] = array('name'=>$inst, 'file'=>$file);
2101         }
2102         return collectd_draw_meta_stack($opts, $sources);
2103 }
2104
2105 ?>