]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame_incremental - config/cfgroot/graphs.pl
ipsecctrl gefixt und connections.cgi gefixt
[people/pmueller/ipfire-2.x.git] / config / cfgroot / graphs.pl
... / ...
CommitLineData
1# Generate Graphs exported from Makegraphs to minimize system load an only generate the Graphs when displayed
2# Initialisation
3
4package Graphs;
5
6use strict;
7use RRDs;
8
9require '/var/ipfire/general-functions.pl';
10require "${General::swroot}/lang.pl";
11require "${General::swroot}/header.pl";
12
13$General::version = '2.0b';
14$General::swroot = '/var/ipfire';
15
16my $ERROR;
17my $rrdlog = "/var/log/rrd";
18my $graphs = "/srv/web/ipfire/html/graphs";
19$ENV{PATH}="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin";
20
21my %color = ();
22my %mainsettings = ();
23&General::readhash("${General::swroot}/main/settings", \%mainsettings);
24&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
25
26my %mbmon_settings = ();
27&General::readhash("${General::swroot}/mbmon/settings", \%mbmon_settings);
28
29my %mbmon_values = ();
30&General::readhash("/var/log/mbmon-values", \%mbmon_values);
31
32my $key;
33my $value;
34my @args = ();
35my $count = 0;
36
37use Encode 'from_to';
38
39my %tr=();
40if ((${Lang::language} eq 'el') ||
41 (${Lang::language} eq 'fa') ||
42 (${Lang::language} eq 'ru') ||
43 (${Lang::language} eq 'th') ||
44 (${Lang::language} eq 'vi') ||
45 (${Lang::language} eq 'zh') ||
46 (${Lang::language} eq 'zt')) {
47 eval `/bin/cat "${General::swroot}/langs/en.pl"`;
48} else {
49 %tr=%Lang::tr; # use translated version for other languages
50}
51
52
53sub updatecpugraph {
54 my $period = $_[0];
55
56 RRDs::graph ("$graphs/cpu-$period.png",
57 "--start", "-1$period", "-aPNG", "-i", "-z",
58 "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-u 100", "-r",
59 "--color", "SHADEA".$color{"color19"},
60 "--color", "SHADEB".$color{"color19"},
61 "--color", "BACK".$color{"color21"},
62 "-t $tr{'cpu usage per'} $tr{$period}",
63 "DEF:iowait=$rrdlog/cpu.rrd:iowait:AVERAGE",
64 "DEF:user=$rrdlog/cpu.rrd:user:AVERAGE",
65 "DEF:system=$rrdlog/cpu.rrd:system:AVERAGE",
66 "DEF:idle=$rrdlog/cpu.rrd:idle:AVERAGE",
67 "DEF:irq=$rrdlog/cpu.rrd:irq:AVERAGE",
68 "CDEF:total=user,system,idle,iowait,irq,+,+,+,+",
69 "CDEF:userpct=100,user,total,/,*",
70 "CDEF:systempct=100,system,total,/,*",
71 "CDEF:idlepct=100,idle,total,/,*",
72 "CDEF:iowaitpct=100,iowait,total,/,*",
73 "CDEF:irqpct=100,irq,total,/,*",
74 "AREA:iowaitpct".$color{"color14"}.":$tr{'iowait'}",
75 "STACK:userpct".$color{"color11"}.":$tr{'user cpu usage'}",
76 "STACK:irqpct".$color{"color23"}.":IRQ CPU",
77 "STACK:systempct".$color{"color13"}.":$tr{'system cpu usage'}",
78 "STACK:idlepct".$color{"color12"}.":$tr{'idle cpu usage'}\\j",
79 "COMMENT: \\j",
80 "COMMENT:$tr{'maximal'}",
81 "COMMENT:$tr{'average'}",
82 "COMMENT:$tr{'current'}\\j",
83 "GPRINT:userpct:MAX:$tr{'user cpu'}\\:%3.2lf%%",
84 "GPRINT:userpct:AVERAGE:$tr{'user cpu'}\\:%3.2lf%%",
85 "GPRINT:userpct:LAST:$tr{'user cpu'}\\:%3.2lf%%\\j",
86 "GPRINT:irqpct:MAX:IRQ CPU\\:%3.2lf%%",
87 "GPRINT:irqpct:AVERAGE:IRQ CPU\\:%3.2lf%%",
88 "GPRINT:irqpct:LAST:IRQ CPU\\:%3.2lf%%\\j",
89 "GPRINT:systempct:MAX:$tr{'system cpu'}\\:%3.2lf%%",
90 "GPRINT:systempct:AVERAGE:$tr{'system cpu'}\\:%3.2lf%%",
91 "GPRINT:systempct:LAST:$tr{'system cpu'}\\:%3.2lf%%\\j",
92 "GPRINT:idlepct:MAX:$tr{'idle cpu'}\\:%3.2lf%%",
93 "GPRINT:idlepct:AVERAGE:$tr{'idle cpu'}\\:%3.2lf%%",
94 "GPRINT:idlepct:LAST:$tr{'idle cpu'}\\:%3.2lf%%\\j",
95 "GPRINT:iowaitpct:MAX:$tr{'iowait'}\\:%3.2lf%%",
96 "GPRINT:iowaitpct:AVERAGE:$tr{'iowait'}\\:%3.2lf%%",
97 "GPRINT:iowaitpct:LAST:$tr{'iowait'}\\:%3.2lf%%\\j");
98 $ERROR = RRDs::error;
99 print "Error in RRD::graph for cpu: $ERROR\n" if $ERROR;
100}
101
102sub updateloadgraph {
103 my $period = $_[0];
104
105 RRDs::graph ("$graphs/load-$period.png",
106 "--start", "-1$period", "-aPNG",
107 "-w 600", "-h 100", "-i", "-z", "-l 0", "-r", "--alt-y-grid",
108 "-t Load Average",
109 "--color", "SHADEA".$color{"color19"},
110 "--color", "SHADEB".$color{"color19"},
111 "--color", "BACK".$color{"color21"},
112 "DEF:load1=$rrdlog/load.rrd:load1:AVERAGE",
113 "DEF:load5=$rrdlog/load.rrd:load5:AVERAGE",
114 "DEF:load15=$rrdlog/load.rrd:load15:AVERAGE",
115 "AREA:load1".$color{"color13"}.":1 Minute, letzter:",
116 "GPRINT:load1:LAST:%5.2lf",
117 "AREA:load5".$color{"color18"}.":5 Minuten, letzter:",
118 "GPRINT:load5:LAST:%5.2lf",
119 "AREA:load15".$color{"color14"}.":15 Minuten, letzter:",
120 "GPRINT:load15:LAST:%5.2lf\\j",
121 "LINE1:load5".$color{"color13"},
122 "LINE1:load1".$color{"color18"});
123 $ERROR = RRDs::error;
124 print "Error in RRD::graph for load: $ERROR\n" if $ERROR;
125}
126
127sub updatememgraph {
128 my $period = $_[0];
129
130 RRDs::graph ("$graphs/memory-$period.png",
131 "--start", "-1$period", "-aPNG", "-i", "-z",
132 "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-u 100", "-r",
133 "--color", "SHADEA".$color{"color19"},
134 "--color", "SHADEB".$color{"color19"},
135 "--color", "BACK".$color{"color21"},
136 "-t $tr{'memory usage per'} $tr{$period}",
137 "DEF:used=$rrdlog/mem.rrd:memused:AVERAGE",
138 "DEF:free=$rrdlog/mem.rrd:memfree:AVERAGE",
139 "DEF:shared=$rrdlog/mem.rrd:memshared:AVERAGE",
140 "DEF:buffer=$rrdlog/mem.rrd:membuffers:AVERAGE",
141 "DEF:cache=$rrdlog/mem.rrd:memcache:AVERAGE",
142 "CDEF:total=used,free,+",
143 "CDEF:used2=used,buffer,cache,shared,+,+,-",
144 "CDEF:usedpct=100,used2,total,/,*",
145 "CDEF:sharedpct=100,shared,total,/,*",
146 "CDEF:bufferpct=100,buffer,total,/,*",
147 "CDEF:cachepct=100,cache,total,/,*",
148 "CDEF:freepct=100,free,total,/,*",
149 "AREA:usedpct".$color{"color11"}.":$tr{'used memory'}",
150 "STACK:sharedpct".$color{"color13"}.":$tr{'shared memory'}",
151 "STACK:bufferpct".$color{"color23"}.":$tr{'buffered memory'}",
152 "STACK:cachepct".$color{"color14"}.":$tr{'cached memory'}",
153 "STACK:freepct".$color{"color12"}.":$tr{'free memory'}\\j",
154 "COMMENT: \\j",
155 "COMMENT:$tr{'maximal'}",
156 "COMMENT:$tr{'average'}",
157 "COMMENT:$tr{'current'}\\j",
158 "GPRINT:usedpct:MAX:$tr{'used memory'}\\:%3.2lf%%",
159 "GPRINT:usedpct:AVERAGE:$tr{'used memory'}\\:%3.2lf%%",
160 "GPRINT:usedpct:LAST:$tr{'used memory'}\\:%3.2lf%%\\j",
161 "GPRINT:sharedpct:MAX:$tr{'shared memory'}\\:%3.2lf%%",
162 "GPRINT:sharedpct:AVERAGE:$tr{'shared memory'}\\:%3.2lf%%",
163 "GPRINT:sharedpct:LAST:$tr{'shared memory'}\\:%3.2lf%%\\j",
164 "GPRINT:bufferpct:MAX:$tr{'buffered memory'}\\:%3.2lf%%",
165 "GPRINT:bufferpct:AVERAGE:$tr{'buffered memory'}\\:%3.2lf%%",
166 "GPRINT:bufferpct:LAST:$tr{'buffered memory'}\\:%3.2lf%%\\j",
167 "GPRINT:cachepct:MAX:$tr{'cached memory'}\\:%3.2lf%%",
168 "GPRINT:cachepct:AVERAGE:$tr{'cached memory'}\\:%3.2lf%%",
169 "GPRINT:cachepct:LAST:$tr{'cached memory'}\\:%3.2lf%%\\j",
170 "GPRINT:freepct:MAX:$tr{'free memory'}\\:%3.2lf%%",
171 "GPRINT:freepct:AVERAGE:$tr{'free memory'}\\:%3.2lf%%",
172 "GPRINT:freepct:LAST:$tr{'free memory'}\\:%3.2lf%%\\j");
173 $ERROR = RRDs::error;
174 print "Error in RRD::graph for mem: $ERROR\n" if $ERROR;
175
176 RRDs::graph ("$graphs/swap-$period.png",
177 "--start", "-1$period", "-aPNG", "-i", "-z",
178 "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-u 100", "-r",
179 "--color", "SHADEA".$color{"color19"},
180 "--color", "SHADEB".$color{"color19"},
181 "--color", "BACK".$color{"color21"},
182 "-t $tr{'swap usage per'} $tr{$period}",
183 "DEF:used=$rrdlog/mem.rrd:swapused:AVERAGE",
184 "DEF:free=$rrdlog/mem.rrd:swapfree:AVERAGE",
185 "CDEF:total=used,free,+",
186 "CDEF:usedpct=100,used,total,/,*",
187 "CDEF:freepct=100,free,total,/,*",
188 "AREA:usedpct".$color{"color11"}.":$tr{'used swap'}",
189 "STACK:freepct".$color{"color12"}.":$tr{'free swap'}\\j",
190 "COMMENT: \\j",
191 "COMMENT:$tr{'maximal'}",
192 "COMMENT:$tr{'average'}",
193 "COMMENT:$tr{'current'}\\j",
194 "GPRINT:usedpct:MAX:$tr{'used swap'}\\:%3.2lf%%",
195 "GPRINT:usedpct:AVERAGE:$tr{'used swap'}\\:%3.2lf%%",
196 "GPRINT:usedpct:LAST:$tr{'used swap'}\\:%3.2lf%%\\j",
197 "GPRINT:freepct:MAX:$tr{'free swap'}\\:%3.2lf%%",
198 "GPRINT:freepct:AVERAGE:$tr{'free swap'}\\:%3.2lf%%",
199 "GPRINT:freepct:LAST:$tr{'free swap'}\\:%3.2lf%%\\j");
200 $ERROR = RRDs::error;
201 print "Error in RRD::graph for swap: $ERROR\n" if $ERROR;
202}
203
204sub updatediskgraph {
205 my $period = $_[0];
206 my $disk = $_[1];
207
208 RRDs::graph ("$graphs/disk-$disk-$period.png",
209 "--start", "-1$period", "-aPNG", "-i", "-z",
210 "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-r",
211 "--color", "SHADEA".$color{"color19"},
212 "--color", "SHADEB".$color{"color19"},
213 "--color", "BACK".$color{"color21"},
214 "-t $tr{'disk access per'} $tr{$period} $disk",
215 "DEF:read=$rrdlog/disk-$disk.rrd:readsect:AVERAGE",
216 "DEF:write=$rrdlog/disk-$disk.rrd:writesect:AVERAGE",
217 "AREA:read".$color{"color11"}.":$tr{'sectors read from disk per second'}",
218 "STACK:write".$color{"color12"}.":$tr{'sectors written to disk per second'}\\j",
219 "COMMENT: \\j",
220 "COMMENT:$tr{'maximal'}",
221 "COMMENT:$tr{'average'}",
222 "COMMENT:$tr{'current'}\\j",
223 "GPRINT:read:MAX:$tr{'read sectors'}\\:%8.0lf",
224 "GPRINT:read:AVERAGE:$tr{'read sectors'}\\:%8.0lf",
225 "GPRINT:read:LAST:$tr{'read sectors'}\\:%8.0lf\\j",
226 "GPRINT:write:MAX:$tr{'written sectors'}\\:%8.0lf",
227 "GPRINT:write:AVERAGE:$tr{'written sectors'}\\:%8.0lf",
228 "GPRINT:write:LAST:$tr{'written sectors'}\\:%8.0lf\\j");
229 $ERROR = RRDs::error;
230 print "Error in RRD::graph for disk: $ERROR\n" if $ERROR;
231}
232
233sub updateifgraph {
234 my $interface = $_[0];
235 my $period = $_[1];
236
237 RRDs::graph ("$graphs/$interface-$period.png",
238 "--start", "-1$period", "-aPNG", "-i", "-z",
239 "--alt-y-grid", "-w 600", "-h 100",
240 "--color", "SHADEA".$color{"color19"},
241 "--color", "SHADEB".$color{"color19"},
242 "--color", "BACK".$color{"color21"},
243 "-t $tr{'traffic on'} $interface ($tr{'graph per'} $tr{$period})",
244 "-v$tr{'bytes per second'}",
245 "DEF:incoming=$rrdlog/$interface.rrd:incoming:AVERAGE",
246 "DEF:outgoing=$rrdlog/$interface.rrd:outgoing:AVERAGE",
247 "AREA:incoming".$color{"color11"}.":$tr{'incoming traffic in bytes per second'}",
248 "AREA:outgoing".$color{"color12"}.":$tr{'outgoing traffic in bytes per second'}\\j",
249 "COMMENT: \\j",
250 "COMMENT:$tr{'maximal'}",
251 "COMMENT:$tr{'average'}",
252 "COMMENT:$tr{'current'}\\j",
253 "GPRINT:incoming:MAX:$tr{'in'}\\:%8.3lf %sBps",
254 "GPRINT:incoming:AVERAGE:$tr{'in'}\\:%8.3lf %sBps",
255 "GPRINT:incoming:LAST:$tr{'in'}\\:%8.3lf %sBps\\j",
256 "GPRINT:outgoing:MAX:$tr{'out'}\\:%8.3lf %sBps",
257 "GPRINT:outgoing:AVERAGE:$tr{'out'}\\:%8.3lf %sBps",
258 "GPRINT:outgoing:LAST:$tr{'out'}\\:%8.3lf %sBps\\j");
259 $ERROR = RRDs::error;
260 print "Error in RRD::graph for $interface: $ERROR\n" if $ERROR;
261}
262
263sub updatefwhitsgraph {
264 my $period = $_[0];
265
266 RRDs::graph ("$graphs/firewallhits-$period-area.png",
267 "--start", "-1$period", "-aPNG", "-i", "-z",
268 "--alt-y-grid", "-w 600", "-h 100",
269 "--color", "SHADEA".$color{"color19"},
270 "--color", "SHADEB".$color{"color19"},
271 "--color", "BACK".$color{"color21"},
272 "-t $tr{'firewall hits per'} $tr{$period}",
273 "DEF:amount=$rrdlog/firewallhits.rrd:amount:AVERAGE",
274 "DEF:portamount=$rrdlog/firewallhits.rrd:portamount:AVERAGE",
275 "AREA:amount".$color{"color24"}.":$tr{'firewallhits'}/5 min",
276 "GPRINT:amount:MAX: $tr{'maximal'}\\: %2.2lf %S",
277 "GPRINT:amount:AVERAGE: $tr{'average'}\\: %2.2lf %S",
278 "GPRINT:amount:LAST: $tr{'current'}\\: %2.2lf %S\\j",
279 "AREA:portamount".$color{"color25"}.":$tr{'portscans'}/5 min",
280 "GPRINT:portamount:MAX: $tr{'maximal'}\\: %2.2lf %S",
281 "GPRINT:portamount:AVERAGE: $tr{'average'}\\: %2.2lf %S",
282 "GPRINT:portamount:LAST: $tr{'current'}\\: %2.2lf %S\\j");
283 $ERROR = RRDs::error;
284 print "Error in RRD::graph for Firewallhits: $ERROR\n" if $ERROR;
285}
286
287sub updatelqgraph {
288 my $period = $_[0];
289 RRDs::graph ("$graphs/lq-$period.png",
290 "--start", "-1$period", "-aPNG", "-i", "-z",
291 "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-r",
292 "-t $tr{'linkq'} ($tr{'graph per'} $tr{$period})",
293 "--lazy",
294 "--color", "SHADEA".$color{"color19"},
295 "--color", "SHADEB".$color{"color19"},
296 "--color", "BACK".$color{"color21"},
297 "-v ms / pkts (% x10)",
298 "DEF:roundtrip=$rrdlog/lq.rrd:roundtrip:AVERAGE",
299 "DEF:loss=$rrdlog/lq.rrd:loss:AVERAGE",
300 "CDEF:roundavg=roundtrip,PREV(roundtrip),+,2,/",
301 "CDEF:loss10=loss,10,*",
302 "CDEF:r0=roundtrip,30,MIN",
303 "CDEF:r1=roundtrip,70,MIN",
304 "CDEF:r2=roundtrip,150,MIN",
305 "CDEF:r3=roundtrip,300,MIN",
306 "AREA:roundtrip".$color{"color25"}.":>300 ms",
307 "AREA:r3".$color{"color18"}.":150-300 ms",
308 "AREA:r2".$color{"color14"}.":70-150 ms",
309 "AREA:r1".$color{"color17"}.":30-70 ms",
310 "AREA:r0".$color{"color12"}.":<30 ms",
311 "AREA:loss10".$color{"color13"}.":Packet loss (x10)\\j",
312 "COMMENT: \\j",
313 "COMMENT:$tr{'maximal'}",
314 "COMMENT:$tr{'average'}",
315 "COMMENT:$tr{'current'}\\j",
316 "LINE1:roundtrip#707070:",
317 "GPRINT:roundtrip:MAX:Time\\:%3.2lf ms",
318 "GPRINT:roundtrip:AVERAGE:Time\\:%3.2lf ms",
319 "GPRINT:roundtrip:LAST:Time\\:%3.2lf ms\\j",
320 "GPRINT:loss:MAX:Loss\\:%3.2lf%%",
321 "GPRINT:loss:AVERAGE:Loss\\:%3.2lf%%",
322 "GPRINT:loss:LAST:Loss\\:%3.2lf%%\\j"
323 );
324 $ERROR = RRDs::error;
325 print "Error in RRD::graph for Link Quality: $ERROR\n" if $ERROR;
326}
327
328sub updatehddgraph {
329
330 my $disk = $_[0];
331 my $period = $_[1];
332
333 RRDs::graph ("$graphs/hddtemp-$disk-$period.png",
334 "--start", "-1$period", "-aPNG", "-i", "-z",
335 "--alt-y-grid", "-w 600", "-h 100",
336 "--color", "SHADEA".$color{"color19"},
337 "--color", "SHADEB".$color{"color19"},
338 "--color", "BACK".$color{"color21"},
339 "-t $tr{'harddisk temperature'} ($tr{'graph per'} $tr{$period})",
340 "DEF:temperature=$rrdlog/hddtemp-$disk.rrd:temperature:AVERAGE",
341 "LINE2:temperature".$color{"color11"}.":$tr{'hdd temperature in'} ?C",
342 "GPRINT:temperature:MAX:$tr{'maximal'}\\:%3.0lf ?C",
343 "GPRINT:temperature:AVERAGE:$tr{'average'}\\:%3.0lf ?C",
344 "GPRINT:temperature:LAST:$tr{'current'}\\:%3.0lf ?C",
345 );
346 $ERROR = RRDs::error;
347 print "Error in RRD::graph for hdd-$disk: $ERROR\n" if $ERROR;
348}
349
350sub updatetempgraph
351{
352 my $type = "temp";
353 my $period = $_[0];
354 my $count = "11";
355
356 @args = ("$graphs/mbmon-$type-$period.png",
357 "--start", "-1$period", "-aPNG", "-i", "-z",
358 "--alt-y-grid", "-w 600", "-h 100", "--alt-autoscale",
359 "--color", "SHADEA".$color{"color19"},
360 "--color", "SHADEB".$color{"color19"},
361 "--color", "BACK".$color{"color21"},
362 "-t $tr{'mbmon temp'} ($tr{'graph per'} $tr{$period})",);
363
364 foreach $key ( sort(keys %mbmon_values) )
365 {
366 if ( (index($key, $type) != -1) && ($mbmon_settings{'LINE-'.$key} eq 'on') )
367 {
368 if ( !defined($mbmon_settings{'LABEL-'.$key}) || ($mbmon_settings{'LABEL-'.$key} eq '') )
369 {
370 $mbmon_settings{'LABEL-'.$key} = $key;
371 }
372 push (@args, "DEF:$key=$rrdlog/mbmon.rrd:$key:AVERAGE");
373 push (@args, "LINE2:".$key.$color{"color$count"}.":$mbmon_settings{'LABEL-'.$key} $tr{'mbmon temp in'} C");
374 push (@args, "GPRINT:$key:MAX:$tr{'maximal'}\\:%5.1lf C");
375 push (@args, "GPRINT:$key:AVERAGE:$tr{'average'}\\:%5.1lf C");
376 push (@args, "GPRINT:$key:LAST:$tr{'current'}\\:%5.1lf C\\j");
377 $count++;
378 }
379 }
380
381 RRDs::graph ( @args );
382 $ERROR = RRDs::error;
383 print("Error in RRD::graph for temp: $ERROR\n")if $ERROR;
384}
385
386sub updatefangraph
387{
388 my $type = "fan";
389 my $period = $_[0];
390 my $count = "11";
391
392 @args = ("$graphs/mbmon-$type-$period.png", "--start", "-1$period", "-aPNG", "-i", "-z",
393 "--alt-y-grid", "-w 600", "-h 100", "--alt-autoscale",
394 "--color", "SHADEA".$color{"color19"},
395 "--color", "SHADEB".$color{"color19"},
396 "--color", "BACK".$color{"color21"},
397 "-t $tr{'mbmon temp'} ($tr{'graph per'} $tr{$period})" );
398
399 foreach $key ( sort(keys %mbmon_values) )
400 {
401 if ( (index($key, $type) != -1) && ($mbmon_settings{'LINE-'.$key} eq 'on') )
402 {
403 if ( !defined($mbmon_settings{'LABEL-'.$key}) || ($mbmon_settings{'LABEL-'.$key} eq '') )
404 {
405 $mbmon_settings{'LABEL-'.$key} = $key;
406 }
407
408 push(@args, "DEF:$key=$rrdlog/mbmon.rrd:$key:AVERAGE");
409 push(@args, "LINE2:".$key.$color{"color$count"}.":$mbmon_settings{'LABEL-'.$key} $tr{'mbmon fan in'} rpm");
410 push(@args, "GPRINT:$key:MAX:$tr{'maximal'}\\:%5.0lf rpm");
411 push(@args, "GPRINT:$key:AVERAGE:$tr{'average'}\\:%5.0lf rpm");
412 push(@args, "GPRINT:$key:LAST:$tr{'current'}\\:%5.0lf rpm\\j");
413 $count++;
414 }
415 }
416 RRDs::graph ( @args );
417 $ERROR = RRDs::error;
418 print("Error in RRD::graph for temp: $ERROR\n")if $ERROR;
419}
420
421sub updatevoltgraph
422{
423 my $type = "volt";
424 my $period = $_[0];
425 my $count = "11";
426
427 @args = ("$graphs/mbmon-$type-$period.png", "--start", "-1$period", "-aPNG", "-i", "-z",
428 "--alt-y-grid", "-w 600", "-h 100", "--alt-autoscale",
429 "--color", "SHADEA".$color{"color19"},
430 "--color", "SHADEB".$color{"color19"},
431 "--color", "BACK".$color{"color21"},
432 "-t $tr{'mbmon temp'} ($tr{'graph per'} $tr{$period})" );
433
434 foreach $key ( sort(keys %mbmon_values) )
435 {
436 my $v = substr($key,0,1);
437 if ( ($v eq 'v') && ($mbmon_settings{'LINE-'.$key} eq 'on') )
438 {
439 if ( !defined($mbmon_settings{'LABEL-'.$key}) || ($mbmon_settings{'LABEL-'.$key} eq '') )
440 {
441 $mbmon_settings{'LABEL-'.$key} = $key;
442 }
443
444 push(@args, "DEF:$key=$rrdlog/mbmon.rrd:$key:AVERAGE");
445 push(@args, "LINE2:".$key.$color{"color$count"}.":$mbmon_settings{'LABEL-'.$key} V");
446 push(@args, "GPRINT:$key:MAX:$tr{'maximal'}\\:%5.2lf V");
447 push(@args, "GPRINT:$key:AVERAGE:$tr{'average'}\\:%5.2lf V");
448 push(@args, "GPRINT:$key:LAST:$tr{'current'}\\:%5.2lf V\\j");
449 $count++;
450 }
451 }
452
453 RRDs::graph ( @args );
454 $ERROR = RRDs::error;
455 print("Error in RRD::graph for temp: $ERROR\n")if $ERROR;
456}