]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/scripts/makegraphs
89159fbb53ecce2ed01fae436fc82c93746b6b0c
3 ############################################################################
5 # This file is part of the IPCop Firewall. #
7 # IPCop is free software; you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation; either version 2 of the License, or #
10 # (at your option) any later version. #
12 # IPCop is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with IPCop; if not, write to the Free Software #
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
21 # Copyright (C) 2004-01-19 Mark Wormgoor <mark@wormgoor.com>. #
23 ############################################################################
29 require "/var/ipfire/general-functions.pl";
30 require "${General::swroot}/lang.pl";
32 my (%settings, @ipacsum, $iface, $ERROR);
33 &General
::readhash
("${General::swroot}/ethernet/settings", \
%settings);
34 my %mbmon_settings = ();
35 &General
::readhash
("${General::swroot}/mbmon/settings", \
%mbmon_settings);
37 # Added for conversion of utf-8 characters
41 # Force language back to English (ugly hack!)
42 # Modified to only force if we are unable to convert charset
44 if ((${Lang
::language
} eq 'el') ||
45 (${Lang
::language
} eq 'fa') ||
46 (${Lang
::language
} eq 'ru') ||
47 (${Lang
::language
} eq 'th') ||
48 (${Lang
::language
} eq 'vi') ||
49 (${Lang
::language
} eq 'zh') ||
50 (${Lang
::language
} eq 'zt')) {
51 eval `/bin/cat "${General::swroot}/langs/en.pl"`;
53 %tr=%Lang::tr
; # use translated version for other languages
57 my $rrdlog = "/var/log/rrd";
58 my $graphs = "/srv/web/ipfire/html/graphs";
59 $ENV{PATH
}="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin";
60 my $hdd_device = "/dev/harddisk";
62 my %mbmon_values = ();
69 my $path_smartctl = "/usr/sbin/smartctl";
70 my $path_hddtemp = "/usr/sbin/hddtemp";
73 $colors{"1"} = "#0000FF";
74 $colors{"2"} = "#00FF00";
75 $colors{"3"} = "#FF0000";
76 $colors{"4"} = "#FFD700";
77 $colors{"5"} = "#CCCCCC";
78 $colors{"6"} = "#40E0D0";
79 $colors{"7"} = "#90EE90";
80 $colors{"8"} = "#F4A460";
82 open(MBMON_OUT
, ">/var/log/mbmon-values");
83 open(FD
, "/usr/bin/mbmon -rc1|" ) || die "ERROR: Cannot run mbmon\n" ;
87 next unless( /^([A-Za-z][^:\s]+)\s*:\s*([+\-]{0,1}[\d\.]+)/ ) ;
91 $mbmon_values{$key} = $value;
92 print(MBMON_OUT
"$key=$value\n");
98 my $interface = $_[0];
106 $bytesin += $1 if (/^[\* ]\s+incoming\s+${interface}.+\:\s+(\d+)/);
108 # Forwarded Incoming...
109 $bytesin += $1 if (/^[\* ]\s+forwarded\s+incoming\s+${interface}.+\:\s+(\d+)/);
112 $bytesout += $1 if (/^[* ]\s+outgoing\s+${interface}.+\:\s+(\d+)/);
114 # Forwarded Outgoing...
115 $bytesout += $1 if (/^[* ]\s+forwarded\s+outgoing\s+${interface}.+\:\s+(\d+)/);
117 return "$bytesin:$bytesout";
123 RRDs
::graph
("$graphs/cpu-$period.png",
124 "--start", "-1$period", "-aPNG", "-i", "-z",
125 "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-u 100", "-r",
126 "--color", "SHADEA#EAE9EE",
127 "--color", "SHADEB#EAE9EE",
128 "--color", "BACK#FFFFFF",
129 "-t $tr{'cpu usage per'} $tr{$period}",
130 "DEF:user=$rrdlog/cpu.rrd:user:AVERAGE",
131 "DEF:system=$rrdlog/cpu.rrd:system:AVERAGE",
132 "DEF:idle=$rrdlog/cpu.rrd:idle:AVERAGE",
133 "CDEF:total=user,system,idle,+,+",
134 "CDEF:userpct=100,user,total,/,*",
135 "CDEF:systempct=100,system,total,/,*",
136 "CDEF:idlepct=100,idle,total,/,*",
137 "AREA:userpct#0000FF:$tr{'user cpu usage'}\\j",
138 "STACK:systempct#FF0000:$tr{'system cpu usage'}\\j",
139 "STACK:idlepct#00FF00:$tr{'idle cpu usage'}\\j",
140 "GPRINT:userpct:MAX:$tr{'maximal'} $tr{'user cpu'}\\:%3.2lf%%",
141 "GPRINT:userpct:AVERAGE:$tr{'average'} $tr{'user cpu'}\\:%3.2lf%%",
142 "GPRINT:userpct:LAST:$tr{'current'} $tr{'user cpu'}\\:%3.2lf%%\\j",
143 "GPRINT:systempct:MAX:$tr{'maximal'} $tr{'system cpu'}\\:%3.2lf%%",
144 "GPRINT:systempct:AVERAGE:$tr{'average'} $tr{'system cpu'}\\:%3.2lf%%",
145 "GPRINT:systempct:LAST:$tr{'current'} $tr{'system cpu'}\\:%3.2lf%%\\j",
146 "GPRINT:idlepct:MAX:$tr{'maximal'} $tr{'idle cpu'}\\:%3.2lf%%",
147 "GPRINT:idlepct:AVERAGE:$tr{'average'} $tr{'idle cpu'}\\:%3.2lf%%",
148 "GPRINT:idlepct:LAST:$tr{'current'} $tr{'idle cpu'}\\:%3.2lf%%\\j");
149 $ERROR = RRDs
::error
;
150 print "Error in RRD::graph for cpu: $ERROR\n" if $ERROR;
154 if ( ! -e
"$rrdlog/cpu.rrd") {
155 RRDs
::create
("$rrdlog/cpu.rrd", "--step=300",
156 "DS:user:COUNTER:600:0:500000000",
157 "DS:system:COUNTER:600:0:500000000",
158 "DS:idle:COUNTER:600:0:500000000",
159 "RRA:AVERAGE:0.5:1:576",
160 "RRA:AVERAGE:0.5:6:672",
161 "RRA:AVERAGE:0.5:24:732",
162 "RRA:AVERAGE:0.5:144:1460");
163 $ERROR = RRDs
::error
;
164 print "Error in RRD::create for cpu: $ERROR\n" if $ERROR;
167 my ($cpu, $user, $nice, $system, $idle);
169 open STAT
, "/proc/stat";
173 ($cpu, $user, $nice, $system, $idle) = split /\s+/;
179 RRDs
::update
("$rrdlog/cpu.rrd",
180 "-t", "user:system:idle",
181 "N:$user:$system:$idle");
182 $ERROR = RRDs
::error
;
183 print "Error in RRD::update for cpu: $ERROR\n" if $ERROR;
187 sub updateloadgraph
{
190 RRDs
::graph
("$graphs/load-$period.png",
191 "--start", "-1$period", "-aPNG",
192 "-w 600", "-h 100", "-i", "-z", "-l 0", "-r", "--alt-y-grid",
194 "--color", "SHADEA#EAE9EE",
195 "--color", "SHADEB#EAE9EE",
196 "--color", "BACK#FFFFFF",
197 "DEF:load1=$rrdlog/load.rrd:load1:AVERAGE",
198 "DEF:load5=$rrdlog/load.rrd:load5:AVERAGE",
199 "DEF:load15=$rrdlog/load.rrd:load15:AVERAGE",
200 "AREA:load1#ff0000:1 Minute, letzter\:",
201 "GPRINT:load1:LAST:%5.2lf\n",
202 "AREA:load5#ff9900:5 Minuten, letzter\:",
203 "GPRINT:load5:LAST:%5.2lf\n",
204 "AREA:load15#ffff00:15 Minuten, letzter\:",
205 "GPRINT:load15:LAST:%5.2lf",
206 "LINE1:load5#ff9900:",
207 "LINE1:load1#ff0000:");
208 $ERROR = RRDs
::error
;
209 print "Error in RRD::graph for load: $ERROR\n" if $ERROR;
213 if ( ! -e
"$rrdlog/load.rrd") {
214 RRDs
::create
("$rrdlog/load.rrd", "--step=60",
215 "DS:load1:GAUGE:120:0:U",
216 "DS:load5:GAUGE:120:0:U",
217 "DS:load15:GAUGE:120:0:U",
218 "RRA:AVERAGE:0.5:1:2160",
219 "RRA:AVERAGE:0.5:5:2016",
220 "RRA:AVERAGE:0.5:15:2880",
221 "RRA:AVERAGE:0.5:60:8760");
223 $ERROR = RRDs
::error
;
224 print "Error in RRD::create for cpu: $ERROR\n" if $ERROR;
231 RRDs
::graph
("$graphs/memory-$period.png",
232 "--start", "-1$period", "-aPNG", "-i", "-z",
233 "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-u 100", "-r",
234 "--color", "SHADEA#EAE9EE",
235 "--color", "SHADEB#EAE9EE",
236 "--color", "BACK#FFFFFF",
237 "-t $tr{'memory usage per'} $tr{$period}",
238 "DEF:used=$rrdlog/mem.rrd:memused:AVERAGE",
239 "DEF:free=$rrdlog/mem.rrd:memfree:AVERAGE",
240 "DEF:shared=$rrdlog/mem.rrd:memshared:AVERAGE",
241 "DEF:buffer=$rrdlog/mem.rrd:membuffers:AVERAGE",
242 "DEF:cache=$rrdlog/mem.rrd:memcache:AVERAGE",
243 "CDEF:total=used,free,+",
244 "CDEF:used2=used,buffer,cache,shared,+,+,-",
245 "CDEF:usedpct=100,used2,total,/,*",
246 "CDEF:sharedpct=100,shared,total,/,*",
247 "CDEF:bufferpct=100,buffer,total,/,*",
248 "CDEF:cachepct=100,cache,total,/,*",
249 "CDEF:freepct=100,free,total,/,*",
250 "AREA:usedpct#0000FF:$tr{'used memory'}\\j",
251 "STACK:sharedpct#FF0000:$tr{'shared memory'}\\j",
252 "STACK:bufferpct#FF00FF:$tr{'buffered memory'}\\j",
253 "STACK:cachepct#FFFF00:$tr{'cached memory'}\\j",
254 "STACK:freepct#00FF00:$tr{'free memory'}\\j",
255 "GPRINT:usedpct:MAX:$tr{'maximal'} $tr{'used memory'}\\:%3.2lf%%",
256 "GPRINT:usedpct:AVERAGE:$tr{'average'} $tr{'used memory'}\\:%3.2lf%%",
257 "GPRINT:usedpct:LAST:$tr{'current'} $tr{'used memory'}\\:%3.2lf%%\\j",
258 "GPRINT:sharedpct:MAX:$tr{'maximal'} $tr{'shared memory'}\\:%3.2lf%%",
259 "GPRINT:sharedpct:AVERAGE:$tr{'average'} $tr{'shared memory'}\\:%3.2lf%%",
260 "GPRINT:sharedpct:LAST:$tr{'current'} $tr{'shared memory'}\\:%3.2lf%%\\j",
261 "GPRINT:bufferpct:MAX:$tr{'maximal'} $tr{'buffered memory'}\\:%3.2lf%%",
262 "GPRINT:bufferpct:AVERAGE:$tr{'average'} $tr{'buffered memory'}\\:%3.2lf%%",
263 "GPRINT:bufferpct:LAST:$tr{'current'} $tr{'buffered memory'}\\:%3.2lf%%\\j",
264 "GPRINT:cachepct:MAX:$tr{'maximal'} $tr{'cached memory'}\\:%3.2lf%%",
265 "GPRINT:cachepct:AVERAGE:$tr{'average'} $tr{'cached memory'}\\:%3.2lf%%",
266 "GPRINT:cachepct:LAST:$tr{'current'} $tr{'cached memory'}\\:%3.2lf%%\\j",
267 "GPRINT:freepct:MAX:$tr{'maximal'} $tr{'free memory'}\\:%3.2lf%%",
268 "GPRINT:freepct:AVERAGE:$tr{'average'} $tr{'free memory'}\\:%3.2lf%%",
269 "GPRINT:freepct:LAST:$tr{'current'} $tr{'free memory'}\\:%3.2lf%%\\j");
270 $ERROR = RRDs
::error
;
271 print "Error in RRD::graph for mem: $ERROR\n" if $ERROR;
273 RRDs
::graph
("$graphs/swap-$period.png",
274 "--start", "-1$period", "-aPNG", "-i", "-z",
275 "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-u 100", "-r",
276 "--color", "SHADEA#EAE9EE",
277 "--color", "SHADEB#EAE9EE",
278 "--color", "BACK#FFFFFF",
279 "-t $tr{'swap usage per'} $tr{$period}",
280 "DEF:used=$rrdlog/mem.rrd:swapused:AVERAGE",
281 "DEF:free=$rrdlog/mem.rrd:swapfree:AVERAGE",
282 "CDEF:total=used,free,+",
283 "CDEF:usedpct=100,used,total,/,*",
284 "CDEF:freepct=100,free,total,/,*",
285 "AREA:usedpct#0000FF:$tr{'used swap'}\\j",
286 "STACK:freepct#00FF00:$tr{'free swap'}\\j",
287 "GPRINT:usedpct:MAX:$tr{'maximal'} $tr{'used swap'}\\:%3.2lf%%",
288 "GPRINT:usedpct:AVERAGE:$tr{'average'} $tr{'used swap'}\\:%3.2lf%%",
289 "GPRINT:usedpct:LAST:$tr{'current'} $tr{'used swap'}\\:%3.2lf%%\\j",
290 "GPRINT:freepct:MAX:$tr{'maximal'} $tr{'free swap'}\\:%3.2lf%%",
291 "GPRINT:freepct:AVERAGE:$tr{'average'} $tr{'free swap'}\\:%3.2lf%%",
292 "GPRINT:freepct:LAST:$tr{'current'} $tr{'free swap'}\\:%3.2lf%%\\j");
293 $ERROR = RRDs
::error
;
294 print "Error in RRD::graph for swap: $ERROR\n" if $ERROR;
298 my ($memused, $memfree, $memshared, $membuffers, $memcache, $swapused, $swapfree);
299 if ( ! -e
"$rrdlog/mem.rrd") {
300 RRDs
::create
("$rrdlog/mem.rrd", "--step=300",
301 "DS:memused:ABSOLUTE:600:0:5000000000",
302 "DS:memfree:ABSOLUTE:600:0:5000000000",
303 "DS:memshared:ABSOLUTE:600:0:5000000000",
304 "DS:membuffers:ABSOLUTE:600:0:5000000000",
305 "DS:memcache:ABSOLUTE:600:0:5000000000",
306 "DS:swapused:ABSOLUTE:600:0:5000000000",
307 "DS:swapfree:ABSOLUTE:600:0:5000000000",
308 "RRA:AVERAGE:0.5:1:576",
309 "RRA:AVERAGE:0.5:6:672",
310 "RRA:AVERAGE:0.5:24:732",
311 "RRA:AVERAGE:0.5:144:1460");
312 $ERROR = RRDs
::error
;
313 print "Error in RRD::create for mem: $ERROR\n" if $ERROR;
316 open MEM
, "/proc/meminfo";
320 my @temp = split (/\s+/, $_);
323 $memshared = $temp[4];
324 $membuffers = $temp[5];
325 $memcache = $temp[6];
326 } elsif ($_ =~ /^Swap:/) {
327 my @temp = split (/\s+/, $_);
328 $swapused = $temp[2];
329 $swapfree = $temp[3];
334 RRDs
::update
("$rrdlog/mem.rrd",
335 "-t", "memused:memfree:memshared:membuffers:memcache:swapused:swapfree",
336 "N:$memused:$memfree:$memshared:$membuffers:$memcache:$swapused:$swapfree");
337 $ERROR = RRDs
::error
;
338 print "Error in RRD::update for mem: $ERROR\n" if $ERROR;
341 sub updatediskgraph
{
344 RRDs
::graph
("$graphs/disk-$period.png",
345 "--start", "-1$period", "-aPNG", "-i", "-z",
346 "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-r",
347 "--color", "SHADEA#EAE9EE",
348 "--color", "SHADEB#EAE9EE",
349 "--color", "BACK#FFFFFF",
350 "-t $tr{'disk access per'} $tr{$period}",
351 "DEF:read=$rrdlog/disk.rrd:readsect:AVERAGE",
352 "DEF:write=$rrdlog/disk.rrd:writesect:AVERAGE",
353 "AREA:read#0000FF:$tr{'sectors read from disk per second'}\\j",
354 "STACK:write#00FF00:$tr{'sectors written to disk per second'}\\j",
355 "GPRINT:read:MAX:$tr{'maximal'} $tr{'read sectors'}\\:%8.0lf",
356 "GPRINT:read:AVERAGE:$tr{'average'} $tr{'read sectors'}\\:%8.0lf",
357 "GPRINT:read:LAST:$tr{'current'} $tr{'read sectors'}\\:%8.0lf\\j",
358 "GPRINT:write:MAX:$tr{'maximal'} $tr{'written sectors'}\\:%8.0lf",
359 "GPRINT:write:AVERAGE:$tr{'average'} $tr{'written sectors'}\\:%8.0lf",
360 "GPRINT:write:LAST:$tr{'current'} $tr{'written sectors'}\\:%8.0lf\\j");
361 $ERROR = RRDs
::error
;
362 print "Error in RRD::graph for disk: $ERROR\n" if $ERROR;
366 my ($readwritereq, $readreq, $readsect, $writereq, $writesect);
367 if ( ! -e
"$rrdlog/disk.rrd") {
368 RRDs
::create
("$rrdlog/disk.rrd", "--step=300",
369 "DS:readsect:COUNTER:600:0:5000000000",
370 "DS:writesect:COUNTER:600:0:5000000000",
371 "RRA:AVERAGE:0.5:1:576",
372 "RRA:AVERAGE:0.5:6:672",
373 "RRA:AVERAGE:0.5:24:732",
374 "RRA:AVERAGE:0.5:144:1460");
375 $ERROR = RRDs
::error
;
376 print "Error in RRD::create for disk: $ERROR\n" if $ERROR;
379 my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size,
380 $atime, $mtime, $ctime, $blksize, $blocks) = stat("/dev/harddisk");
382 my $major = $rdev >> 8;
383 my $minor = $rdev & 0xFF;
385 open STAT
, "/proc/stat";
386 my @diskstat = <STAT
>;
388 foreach my $line (@diskstat)
391 my @temp = split(/\:\ /,$line);
393 my @devicestat = split(/\ /,$temp[1]);
394 foreach my $stats (@devicestat)
397 my @fields = split(/\((\d+),(\d+)\):\((\d+),(\d+),(\d+),(\d+),(\d+)/,$stats);
398 if ($major eq $fields[1] and $minor eq $fields[2])
400 $readwritereq = $fields[3];
401 $readreq = $fields[4];
402 $readsect = $fields[5];
403 $writereq = $fields[6];
404 $writesect = $fields[7];
410 if ($readsect && $writesect) {
411 RRDs
::update
("$rrdlog/disk.rrd",
412 "-t", "readsect:writesect",
413 "N:$readsect:$writesect");
414 $ERROR = RRDs
::error
;
415 print "Error in RRD::update for disk: $ERROR\n" if $ERROR;
417 print "Error in RRD::update for disk: no data available\n";
421 sub updatediskgraphnew
{
425 RRDs
::graph
("$graphs/disk-$disk-$period.png",
426 "--start", "-1$period", "-aPNG", "-i", "-z",
427 "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-r",
428 "--color", "SHADEA#EAE9EE",
429 "--color", "SHADEB#EAE9EE",
430 "--color", "BACK#FFFFFF",
431 "-t $tr{'disk access per'} $tr{$period}",
432 "DEF:read=$rrdlog/disk-$disk.rrd:readsect:AVERAGE",
433 "DEF:write=$rrdlog/disk-$disk.rrd:writesect:AVERAGE",
434 "DEF:sleep=$rrdlog/disk-$disk.rrd:sleeping:AVERAGE",
435 "CDEF:sl_state=sleep,INF,*",
437 "AREA:sl_state#a0a0a0:disk standby\\j",
438 "AREA:read#0000FF:$tr{'sectors read from disk per second'}\\j",
439 "STACK:write#00FF00:$tr{'sectors written to disk per second'}\\j",
441 "GPRINT:read:MAX:$tr{'maximal'} $tr{'read sectors'}\\:%8.0lf",
442 "GPRINT:read:AVERAGE:$tr{'average'} $tr{'read sectors'}\\:%8.0lf",
443 "GPRINT:read:LAST:$tr{'current'} $tr{'read sectors'}\\:%8.0lf\\j",
444 "GPRINT:write:MAX:$tr{'maximal'} $tr{'written sectors'}\\:%8.0lf",
445 "GPRINT:write:AVERAGE:$tr{'average'} $tr{'written sectors'}\\:%8.0lf",
446 "GPRINT:write:LAST:$tr{'current'} $tr{'written sectors'}\\:%8.0lf\\j");
447 $ERROR = RRDs
::error
;
448 print "Error in RRD::graph for disk-$disk: $ERROR\n" if $ERROR;
451 sub updatediskdatanew
{
454 my ($readwritereq, $readreq, $readsect, $writereq, $writesect);
455 if ( ! -e
"$rrdlog/disk-$disk.rrd") {
456 RRDs
::create
("$rrdlog/disk-$disk.rrd", "--step=300",
457 "DS:readsect:COUNTER:600:0:5000000000",
458 "DS:writesect:COUNTER:600:0:5000000000",
459 "DS:sleeping:GAUGE:600:0:1",
460 "RRA:AVERAGE:0.5:1:576",
461 "RRA:AVERAGE:0.5:6:672",
462 "RRA:AVERAGE:0.5:24:732",
463 "RRA:AVERAGE:0.5:144:1460");
464 $ERROR = RRDs
::error
;
465 print "Error in RRD::create for disk-$disk: $ERROR\n" if $ERROR;
468 my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size,
469 $atime, $mtime, $ctime, $blksize, $blocks) = stat("/dev/$disk");
471 my $major = $rdev >> 8;
472 my $minor = ($rdev & 0xFF) >>6;
474 open STAT
, "/proc/stat";
475 my @diskstat = <STAT
>;
477 foreach my $line (@diskstat)
480 my @temp = split(/\:\ /,$line);
482 my @devicestat = split(/\ /,$temp[1]);
483 foreach my $stats (@devicestat)
486 my @fields = split(/\((\d+),(\d+)\):\((\d+),(\d+),(\d+),(\d+),(\d+)/,$stats);
487 if ($major eq $fields[1] and $minor eq $fields[2])
489 $readwritereq = $fields[3];
490 $readreq = $fields[4];
491 $readsect = $fields[5];
492 $writereq = $fields[6];
493 $writesect = $fields[7];
500 my $lastsleepstate=0;
502 if ( -e
"/tmp/hddshutdown-$disk" ) {
503 open STAT
,"/tmp/hddshutdown-$disk";
504 $lastsleepstate = <STAT
>;
506 if ($lastsleepstate==$readwritereq) {
511 if ($readsect && $writesect) {
512 RRDs
::update
("$rrdlog/disk-$disk.rrd",
513 "-t", "readsect:writesect:sleeping",
514 "N:$readsect:$writesect:$sleeping");
515 $ERROR = RRDs
::error
;
516 print "Error in RRD::update for disk-$disk: $ERROR\n" if $ERROR;
518 print "Error in RRD::update for disk-$disk: no data available\n";
523 my $interface = $_[0];
526 RRDs
::graph
("$graphs/$interface-$period.png",
527 "--start", "-1$period", "-aPNG", "-i", "-z",
528 "--alt-y-grid", "-w 600", "-h 100",
529 "--color", "SHADEA#EAE9EE",
530 "--color", "SHADEB#EAE9EE",
531 "--color", "BACK#FFFFFF",
532 "-t $tr{'traffic on'} $interface ($tr{'graph per'} $tr{$period})",
533 "-v$tr{'bytes per second'}",
534 "DEF:incoming=$rrdlog/$interface.rrd:incoming:AVERAGE",
535 "DEF:outgoing=$rrdlog/$interface.rrd:outgoing:AVERAGE",
536 "AREA:incoming#00FF00:$tr{'incoming traffic in bytes per second'}\\j",
537 "LINE1:outgoing#0000FF:$tr{'outgoing traffic in bytes per second'}\\j",
538 "GPRINT:incoming:MAX:$tr{'maximal'} $tr{'in'}\\:%8.3lf %sBps",
539 "GPRINT:incoming:AVERAGE:$tr{'average'} $tr{'in'}\\:%8.3lf %sBps",
540 "GPRINT:incoming:LAST:$tr{'current'} $tr{'in'}\\:%8.3lf %sBps\\j",
541 "GPRINT:outgoing:MAX:$tr{'maximal'} $tr{'out'}\\:%8.3lf %sBps",
542 "GPRINT:outgoing:AVERAGE:$tr{'average'} $tr{'out'}\\:%8.3lf %sBps",
543 "GPRINT:outgoing:LAST:$tr{'current'} $tr{'out'}\\:%8.3lf %sBps\\j");
544 $ERROR = RRDs
::error
;
545 print "Error in RRD::graph for $interface: $ERROR\n" if $ERROR;
549 my $interface = $_[0];
551 if ( ! -e
"$rrdlog/$interface.rrd") {
552 RRDs
::create
("$rrdlog/$interface.rrd", "--step=300",
553 "DS:incoming:ABSOLUTE:600:0:12500000",
554 "DS:outgoing:ABSOLUTE:600:0:12500000",
555 "RRA:AVERAGE:0.5:1:576",
556 "RRA:AVERAGE:0.5:6:672",
557 "RRA:AVERAGE:0.5:24:732",
558 "RRA:AVERAGE:0.5:144:1460");
559 $ERROR = RRDs
::error
;
560 print "Error in RRD::create for $interface: $ERROR\n" if $ERROR;
563 my $traffic = gettraffic
($interface);
564 RRDs
::update
("$rrdlog/$interface.rrd",
565 "-t", "incoming:outgoing",
567 $ERROR = RRDs
::error
;
568 print "Error in RRD::update for $interface: $ERROR\n" if $ERROR;
571 sub updatefwhitsgraph
{
572 my $interval = $_[0];
574 RRDs
::graph
("$graphs/firewallhits-$interval-area.png",
575 "--start", "-1$interval", "-aPNG", "-i", "-z",
576 "--alt-y-grid", "-w 600", "-h 200",
577 "--color", "SHADEA#EAE9EE",
578 "--color", "SHADEB#EAE9EE",
579 "--color", "BACK#FFFFFF",
580 "-t firewall hits over the last $interval",
581 "DEF:amount=$rrdlog/firewallhits.rrd:amount:AVERAGE",
582 "AREA:amount#6464FF:firewallhits",
583 "GPRINT:amount:MAX: $tr{'maximal'}\\: %2.2lf %S",
584 "GPRINT:amount:AVERAGE: $tr{'average'}\\: %2.2lf %S",
585 "GPRINT:amount:LAST: $tr{'current'}\\: %2.2lf %Shits/5 min\\n",
586 "DEF:portamount=$rrdlog/firewallhits.rrd:portamount:AVERAGE",
587 "AREA:portamount#FF6464:portscans",
588 "GPRINT:portamount:MAX: $tr{'maximal'}\\: %2.2lf %S",
589 "GPRINT:portamount:AVERAGE: $tr{'average'}\\: %2.2lf %S",
590 "GPRINT:portamount:LAST: $tr{'current'}\\: %2.2lf %Shits/5 min");
591 $ERROR = RRDs
::error
;
592 print "Error in RRD::graph for Firewallhits: $ERROR\n" if $ERROR;
594 RRDs
::graph
("$graphs/firewallhits-$interval-line.png",
595 "--start", "-1$interval", "-aPNG", "-i", "-z",
596 "--alt-y-grid", "-w 600", "-h 200",
597 "--color", "SHADEA#EAE9EE",
598 "--color", "SHADEB#EAE9EE",
599 "--color", "BACK#FFFFFF",
600 "-t firewall hits over the last $interval",
601 "DEF:amount=$rrdlog/firewallhits.rrd:amount:AVERAGE",
602 "LINE2:amount#6464FF:firewallhits",
603 "GPRINT:amount:MAX: $tr{'maximal'}\\: %2.2lf %S",
604 "GPRINT:amount:AVERAGE: $tr{'average'}\\: %2.2lf %S",
605 "GPRINT:amount:LAST: $tr{'current'}\\: %2.2lf %Shits/5 min\\n",
606 "DEF:portamount=$rrdlog/firewallhits.rrd:portamount:AVERAGE",
607 "LINE2:portamount#FF6464:portscans",
608 "GPRINT:portamount:MAX: $tr{'maximal'}\\: %2.2lf %S",
609 "GPRINT:portamount:AVERAGE: $tr{'average'}\\: %2.2lf %S",
610 "GPRINT:portamount:LAST: $tr{'current'}\\: %2.2lf %Shits/5 min");
611 $ERROR = RRDs
::error
;
612 print "Error in RRD::graph for Firewallhits: $ERROR\n" if $ERROR;
615 sub updatefwhitsdata
{
622 if (! -e
"$rrdlog/firewallhits.rrd")
624 RRDs
::create
("$rrdlog/firewallhits.rrd", "--step=300",
625 "DS:amount:GAUGE:600:0:U",
626 "DS:portamount:GAUGE:600:0:U",
627 "RRA:AVERAGE:0.5:1:576",
628 "RRA:AVERAGE:0.5:6:672",
629 "RRA:AVERAGE:0.5:24:732",
630 "RRA:AVERAGE:0.5:144:1460");
631 $ERROR = RRDs
::error
;
632 print "Error in RRD::create for cpu: $ERROR\n" if $ERROR;
635 system("logtailfwhits /var/log/messages /var/log/fwhits.messages.offset >/tmp/messages.fwhits");
636 if (!(open (FILE
,'/tmp/messages.fwhits'))) {
642 if (/kernel:.*(IN=.*)$/) {
649 system("logtailfwhits /var/log/snort/alert /var/log/snort/fwhits.alert.offset >/tmp/snort.fwhits");
650 if (!(open (FILE
,'/tmp/snort.fwhits'))) {
663 if (!(open (FILE
,'/tmp/messages.fwhits'))) {
669 if (/kernel:.*(Scan.*)$/) {
676 system("rm /tmp/messages.fwhits");
677 system("rm /tmp/snort.fwhits");
679 $portamount = $portaktuell + $alertaktuell;
681 RRDs
::update
("$rrdlog/firewallhits.rrd",
682 "N:$aktuell:$portamount");
683 $ERROR = RRDs
::error
;
684 print "Error in RRD::update for Firewallhits: $ERROR\n" if $ERROR;
687 # Creates and updates a link quality database
688 # -------------------------------------------
690 if ( ! -e
"$rrdlog/lq.rrd") {
691 RRDs
::create
("$rrdlog/lq.rrd", "--step=300",
692 "DS:loss:GAUGE:600:0:100",
693 "DS:roundtrip:GAUGE:600:0:10000",
694 "RRA:AVERAGE:0.5:1:576",
695 "RRA:AVERAGE:0.5:6:672",
696 "RRA:AVERAGE:0.5:24:732",
697 "RRA:AVERAGE:0.5:144:1460");
698 $ERROR = RRDs
::error
;
699 print "Error in RRD::create for link: $ERROR\n" if $ERROR;
704 # LQ_GATEWAY is the ip of your isp's public ip facing you
705 my $LQ_GATEWAY='www.heise.de';
707 my $pingoutput = `ping -c $NUMPINGS -q $LQ_GATEWAY`;
709 my @temp = split (/\/|\
%|\s
/, $pingoutput);
710 $packetloss = $temp[17];
711 $roundtrip = $temp[28];
712 RRDs
::update
("$rrdlog/lq.rrd", "N:$packetloss:$roundtrip");
713 $ERROR = RRDs
::error
;
714 print "Error in RRD::update for line quality: $ERROR\n" if $ERROR;
719 RRDs
::graph
("$graphs/lq-$period.png",
720 "--start", "-1$period", "-aPNG", "-i", "-z",
721 "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-r",
722 "-t $tr{'linkq'} ($tr{'graph per'} $tr{$period})",
724 "--color", "SHADEA#EAE9EE",
725 "--color", "SHADEB#EAE9EE",
726 "--color", "BACK#FFFFFF",
727 "-v ms / pkts (% x10)",
728 "DEF:roundtrip=$rrdlog/lq.rrd:roundtrip:AVERAGE",
729 "DEF:loss=$rrdlog/lq.rrd:loss:AVERAGE",
730 "CDEF:roundavg=roundtrip,PREV(roundtrip),+,2,/",
731 "CDEF:loss10=loss,10,*",
732 "CDEF:r0=roundtrip,30,MIN",
733 "CDEF:r1=roundtrip,70,MIN",
734 "CDEF:r2=roundtrip,150,MIN",
735 "CDEF:r3=roundtrip,300,MIN",
736 "AREA:roundtrip#EE7000:>300 ms",
737 "AREA:r3#D88E1B:150-300 ms",
738 "AREA:r2#B9B63F:70-150 ms",
739 "AREA:r1#99E064:30-70 ms",
740 "AREA:r0#80FF80:<30 ms",
741 "AREA:loss10#800000:Packet loss (x10)",
742 "LINE1:roundtrip#707070:",
743 "GPRINT:roundtrip:MAX:$tr{'maximal'}\\:%3.2lf ms",
744 "GPRINT:roundtrip:AVERAGE:$tr{'average'}\\:%3.2lf ms",
745 "GPRINT:roundtrip:LAST:$tr{'current'}\\:%3.2lf ms\\j",
746 "GPRINT:loss:MAX:$tr{'maximal'} Loss\\:%3.2lf%%",
747 "GPRINT:loss:AVERAGE:$tr{'average'} Loss\\:%3.2lf%%",
748 "GPRINT:loss:LAST:$tr{'current'} Loss\\:%3.2lf%%\\j"
750 $ERROR = RRDs
::error
;
751 print "Error in RRD::graph for Link Quality: $ERROR\n" if $ERROR;
756 if ( ! -e
"$rrdlog/hddtemp.rrd")
758 # database did not exist -> create
759 RRDs
::create
("$rrdlog/hddtemp.rrd", "--step=300",
760 "DS:temperature:GAUGE:600:0:100",
761 "RRA:AVERAGE:0.5:1:576",
762 "RRA:AVERAGE:0.5:6:672",
763 "RRA:AVERAGE:0.5:24:732",
764 "RRA:AVERAGE:0.5:144:1460");
765 $ERROR = RRDs
::error
;
766 print "Error in RRD::create for hdd: $ERROR\n" if $ERROR;
771 my $smart_output = '';
773 if ( -e
"$path_smartctl" )
775 system("$path_smartctl -iHA $hdd_device > /var/log/hddgraph_smartctl_out");
778 if ( -e
"$path_hddtemp" )
780 $hdd_output = `$path_hddtemp -qn $hdd_device`;
782 # I know 4 response possible responses:
784 # /dev/harddisk: harddisk type: S.M.A.R.T. not available
785 # /dev/harddisk: harddisk type: no sensor
786 # /dev/harddisk: harddisk type: 37°C or °F
789 if ( index($hdd_output, "S.M.A.R.T.") != -1 )
793 elsif ( index($hdd_output, "no sensor") != -1 )
797 elsif ( index($hdd_output, "$hdd_device") != -1 )
799 $hdd_output =~ /.*:.*:\s*(\d+).*\s/;
804 $hdd_output =~ /(\d+)\s/;
808 elsif ( -e
"/var/log/hddgraph_smartctl_out" )
810 $hdd_output = `cat /var/log/hddgraph_smartctl_out | grep Temperature_`;
811 my @t = split(/\s+/,$hdd_output);
819 # print "hdd $hdd_output \n";
820 # print "temp $temp \n";
822 RRDs
::update
("$rrdlog/hddtemp.rrd", "-t", "temperature", "N:$temp");
824 $ERROR = RRDs
::error
;
825 print "Error in RRD::update for hdd: $ERROR\n" if $ERROR;
831 RRDs
::graph
("$graphs/hddtemp-$period.png",
832 "--start", "-1$period", "-aPNG", "-i", "-z",
833 "--alt-y-grid", "-w 600", "-h 100",
834 "--color", "SHADEA#EAE9EE",
835 "--color", "SHADEB#EAE9EE",
836 "--color", "BACK#FFFFFF",
837 "-t $tr{'harddisk temperature'} ($tr{'graph per'} $tr{$period})",
838 "DEF:temperature=$rrdlog/hddtemp.rrd:temperature:AVERAGE",
839 "LINE2:temperature#0000FF:$tr{'hdd temperature in'} °C",
840 "GPRINT:temperature:MAX:$tr{'maximal'}\\:%3.0lf °C",
841 "GPRINT:temperature:AVERAGE:$tr{'average'}\\:%3.0lf °C",
842 "GPRINT:temperature:LAST:$tr{'current'}\\:%3.0lf °C",
844 $ERROR = RRDs
::error
;
845 print "Error in RRD::graph for cpu: $ERROR\n" if $ERROR;
850 if ( ! -e
"$rrdlog/mbmon.rrd" )
852 # database did not exist -> create
854 @args = ("$rrdlog/mbmon.rrd");
856 push(@args, "--step=300");
857 foreach $key ( sort(keys %mbmon_values) )
859 push(@args, "DS:$key:GAUGE:600:U:U");
861 push(@args, "RRA:AVERAGE:0.5:1:576");
862 push(@args, "RRA:AVERAGE:0.5:6:672");
863 push(@args, "RRA:AVERAGE:0.5:24:732");
864 push(@args, "RRA:AVERAGE:0.5:144:1460");
866 print("create ". join( ", ", @args)) if ( $dbg );
868 RRDs
::create
(@args);
869 $ERROR = RRDs
::error
;
870 print("Error in RRD::create for mbmon: $ERROR\n") if $ERROR;
877 foreach $key ( sort(keys %mbmon_values) )
880 push(@val, $mbmon_values{$key});
883 $template = join(':', @ds);
884 $value = "N:".join(':', @val);
886 print("update template = '$template'\n") if ( $dbg );
887 print("update value = '$value'\n") if ( $dbg );
889 RRDs
::update
("$rrdlog/mbmon.rrd", "-t", $template, $value);
890 $ERROR = RRDs
::error
;
891 print("Error in RRD::update for mbmon: $ERROR\n") if $ERROR;
899 @args = ("$graphs/mbmon-$type-$period.png", "--start", "-1$period", "-aPNG", "-i", "-z",
900 "--alt-y-grid", "-w 600", "-h 100", "--alt-autoscale",
901 "--color", "SHADEA#EAE9EE",
902 "--color", "SHADEB#EAE9EE",
903 "--color", "BACK#FFFFFF",
904 "-t $tr{'mbmon temp'} ($tr{'graph per'} $tr{$period})" );
907 foreach $key ( sort(keys %mbmon_values) )
909 if ( (index($key, $type) != -1) && ($mbmon_settings{'LINE-'.$key} eq 'on') )
911 if ( !defined($mbmon_settings{'LABEL-'.$key}) || ($mbmon_settings{'LABEL-'.$key} eq '') )
913 $mbmon_settings{'LABEL-'.$key} = $key;
916 push(@args, "DEF:$key=$rrdlog/mbmon.rrd:$key:AVERAGE");
917 push(@args, "LINE2:$key$colors{$count}:$mbmon_settings{'LABEL-'.$key} $tr{'mbmon temp in'} °C");
918 push(@args, "GPRINT:$key:MAX:$tr{'maximal'}\\:%5.1lf °C");
919 push(@args, "GPRINT:$key:AVERAGE:$tr{'average'}\\:%5.1lf °C");
920 push(@args, "GPRINT:$key:LAST:$tr{'current'}\\:%5.1lf °C\\j");
928 RRDs
::graph
( @args );
929 $ERROR = RRDs
::error
;
930 print("Error in RRD::graph for temp: $ERROR\n")if $ERROR;
939 @args = ("$graphs/mbmon-$type-$period.png", "--start", "-1$period", "-aPNG", "-i", "-z",
940 "--alt-y-grid", "-w 600", "-h 100", "--alt-autoscale",
941 "--color", "SHADEA#EAE9EE",
942 "--color", "SHADEB#EAE9EE",
943 "--color", "BACK#FFFFFF",
944 "-t $tr{'mbmon temp'} ($tr{'graph per'} $tr{$period})" );
947 foreach $key ( sort(keys %mbmon_values) )
949 if ( (index($key, $type) != -1) && ($mbmon_settings{'LINE-'.$key} eq 'on') )
951 if ( !defined($mbmon_settings{'LABEL-'.$key}) || ($mbmon_settings{'LABEL-'.$key} eq '') )
953 $mbmon_settings{'LABEL-'.$key} = $key;
956 push(@args, "DEF:$key=$rrdlog/mbmon.rrd:$key:AVERAGE");
957 push(@args, "LINE2:$key$colors{$count}:$mbmon_settings{'LABEL-'.$key} $tr{'mbmon fan in'} rpm");
958 push(@args, "GPRINT:$key:MAX:$tr{'maximal'}\\:%5.0lf rpm");
959 push(@args, "GPRINT:$key:AVERAGE:$tr{'average'}\\:%5.0lf rpm");
960 push(@args, "GPRINT:$key:LAST:$tr{'current'}\\:%5.0lf rpm\\j");
968 RRDs
::graph
( @args );
969 $ERROR = RRDs
::error
;
970 print("Error in RRD::graph for temp: $ERROR\n")if $ERROR;
979 @args = ("$graphs/mbmon-$type-$period.png", "--start", "-1$period", "-aPNG", "-i", "-z",
980 "--alt-y-grid", "-w 600", "-h 100", "--alt-autoscale",
981 "--color", "SHADEA#EAE9EE",
982 "--color", "SHADEB#EAE9EE",
983 "--color", "BACK#FFFFFF",
984 "-t $tr{'mbmon temp'} ($tr{'graph per'} $tr{$period})" );
987 foreach $key ( sort(keys %mbmon_values) )
989 my $v = substr($key,0,1);
990 if ( ($v eq 'v') && ($mbmon_settings{'LINE-'.$key} eq 'on') )
992 if ( !defined($mbmon_settings{'LABEL-'.$key}) || ($mbmon_settings{'LABEL-'.$key} eq '') )
994 $mbmon_settings{'LABEL-'.$key} = $key;
997 push(@args, "DEF:$key=$rrdlog/mbmon.rrd:$key:AVERAGE");
998 push(@args, "LINE2:$key$colors{$count}:$mbmon_settings{'LABEL-'.$key} V");
999 push(@args, "GPRINT:$key:MAX:$tr{'maximal'}\\:%5.2lf V");
1000 push(@args, "GPRINT:$key:AVERAGE:$tr{'average'}\\:%5.2lf V");
1001 push(@args, "GPRINT:$key:LAST:$tr{'current'}\\:%5.2lf V\\j");
1009 RRDs
::graph
( @args );
1010 $ERROR = RRDs
::error
;
1011 print("Error in RRD::graph for temp: $ERROR\n")if $ERROR;
1016 system ('/usr/sbin/fetchipac');
1022 if ( -e
"/var/log/squid/access.log") {
1023 system ("/usr/bin/squid-graph -o=/srv/web/ipfire/html/sgraph --tcp-only < /var/log/squid/access.log >/dev/null 2>&1");
1029 if ((${Lang
::language
} eq 'cs') ||
1030 (${Lang
::language
} eq 'hu') ||
1031 (${Lang
::language
} eq 'pl') ||
1032 (${Lang
::language
} eq 'sk')) {
1033 # Czech, Hungarian, Polish and Slovak character set
1034 foreach my $key(keys %Lang::tr
) {
1035 from_to
($tr{$key}, "utf-8", "iso-8859-2");
1037 } elsif (${Lang
::language
} eq 'tr') {
1039 foreach my $key(keys %Lang::tr
) {
1040 from_to
($tr{$key}, "utf-8", "iso-8859-9");
1043 foreach my $key(keys %Lang::tr
) {
1044 from_to
($tr{$key}, "utf-8", "iso-8859-1");
1052 updatecpugraph
("day");
1053 updatecpugraph
("week");
1054 updatecpugraph
("month");
1055 updatecpugraph
("year");
1058 updateloadgraph
("day");
1059 updateloadgraph
("week");
1060 updateloadgraph
("month");
1061 updateloadgraph
("year");
1064 updatememgraph
("day");
1065 updatememgraph
("week");
1066 updatememgraph
("month");
1067 updatememgraph
("year");
1070 updatediskgraph
("day");
1071 updatediskgraph
("week");
1072 updatediskgraph
("month");
1073 updatediskgraph
("year");
1075 if (open STAT
,"/dev/hda") {
1077 updatediskdatanew
("hda");
1078 updatediskgraphnew
("hda","day");
1079 updatediskgraphnew
("hda","week");
1080 updatediskgraphnew
("hda","month");
1081 updatediskgraphnew
("hda","year");
1083 if (-e
"$graphs/disk-hda-day.png") {
1084 system("rm $graphs/disk-hda-day.png");
1088 if (open STAT
,"/dev/hdb") {
1090 updatediskdatanew
("hdb");
1091 updatediskgraphnew
("hdb","day");
1092 updatediskgraphnew
("hdb","week");
1093 updatediskgraphnew
("hdb","month");
1094 updatediskgraphnew
("hdb","year");
1096 if (-e
"$graphs/disk-hdb-day.png") {
1097 system("rm $graphs/disk-hdb-day.png");
1101 if (open STAT
,"/dev/hdc") {
1103 updatediskdatanew
("hdc");
1104 updatediskgraphnew
("hdc","day");
1105 updatediskgraphnew
("hdc","week");
1106 updatediskgraphnew
("hdc","month");
1107 updatediskgraphnew
("hdc","year");
1109 if (-e
"$graphs/disk-hdc-day.png") {
1110 system("rm $graphs/disk-hdc-day.png");
1114 if (open STAT
,"/dev/hdd") {
1116 updatediskdatanew
("hdd");
1117 updatediskgraphnew
("hdd","day");
1118 updatediskgraphnew
("hdd","week");
1119 updatediskgraphnew
("hdd","month");
1120 updatediskgraphnew
("hdd","year");
1122 if (-e
"$graphs/disk-hdd-day.png") {
1123 system("rm $graphs/disk-hdd-day.png");
1127 if (open STAT
,"/dev/hde") {
1129 updatediskdatanew
("hde");
1130 updatediskgraphnew
("hde","day");
1131 updatediskgraphnew
("hde","week");
1132 updatediskgraphnew
("hde","month");
1133 updatediskgraphnew
("hde","year");
1135 if (-e
"$graphs/disk-hde-day.png") {
1136 system("rm $graphs/disk-hde-day.png");
1140 if (open STAT
,"/dev/hdf") {
1142 updatediskdatanew
("hdf");
1143 updatediskgraphnew
("hdf","day");
1144 updatediskgraphnew
("hdf","week");
1145 updatediskgraphnew
("hdf","month");
1146 updatediskgraphnew
("hdf","year");
1148 if (-e
"$graphs/disk-hdf-day.png") {
1149 system("rm $graphs/disk-hdf-day.png");
1153 if (open STAT
,"/dev/hdg") {
1155 updatediskdatanew
("hdg");
1156 updatediskgraphnew
("hdg","day");
1157 updatediskgraphnew
("hdg","week");
1158 updatediskgraphnew
("hdg","month");
1159 updatediskgraphnew
("hdg","year");
1161 if (-e
"$graphs/disk-hdg-day.png") {
1162 system("rm $graphs/disk-hdg-day.png");
1166 if (open STAT
,"/dev/hdh") {
1168 updatediskdatanew
("hdh");
1169 updatediskgraphnew
("hdh","day");
1170 updatediskgraphnew
("hdh","week");
1171 updatediskgraphnew
("hdh","month");
1172 updatediskgraphnew
("hdh","year");
1174 if (-e
"$graphs/disk-hdh-day.png") {
1175 system("rm $graphs/disk-hdh-day.png");
1183 updatefwhitsgraph
("day");
1184 updatefwhitsgraph
("week");
1185 updatefwhitsgraph
("month");
1186 updatefwhitsgraph
("year");
1193 updatelqgraph
("day");
1194 updatelqgraph
("week");
1195 updatelqgraph
("month");
1196 updatelqgraph
("year");
1199 ### HDDTEMP-Graphs for /dev/harddisk
1202 updatehddgraph
("day");
1203 updatehddgraph
("week");
1204 updatehddgraph
("month");
1205 updatehddgraph
("year");
1209 if ( $mbmon_settings{'GRAPH_TEMP'} == 1 )
1211 updatetempgraph
("day");
1212 updatetempgraph
("week");
1213 updatetempgraph
("month");
1214 updatetempgraph
("year");
1216 if ( $mbmon_settings{'GRAPH_TEMP'} == 1 )
1218 updatefangraph
("day");
1219 updatefangraph
("week");
1220 updatefangraph
("month");
1221 updatefangraph
("year");
1223 if ( $mbmon_settings{'GRAPH_VOLT'} == 1 )
1225 updatevoltgraph
("day");
1226 updatevoltgraph
("week");
1227 updatevoltgraph
("month");
1228 updatevoltgraph
("year");
1234 @ipacsum = `/usr/sbin/ipacsum --exact -s 5m 2>/dev/null`;
1236 updateifdata
("GREEN");
1237 updateifdata
("RED");
1238 if ($settings{'CONFIG_TYPE'} =~ /^(1|3|5|7)$/ ) {
1239 updateifdata
("ORANGE");
1241 if ($settings{'CONFIG_TYPE'} =~ /^(4|5|6|7)$/ ) {
1242 updateifdata
("BLUE");
1245 if ( -e
"$rrdlog/GREEN.rrd") {
1246 updateifgraph
("GREEN", "day");
1247 updateifgraph
("GREEN", "week");
1248 updateifgraph
("GREEN", "month");
1249 updateifgraph
("GREEN", "year");
1252 if ( -e
"$rrdlog/RED.rrd") {
1253 updateifgraph
("RED", "day");
1254 updateifgraph
("RED", "week");
1255 updateifgraph
("RED", "month");
1256 updateifgraph
("RED", "year");
1259 if ($settings{'CONFIG_TYPE'} =~ /^(1|3|5|7)$/ && -e
"$rrdlog/ORANGE.rrd") {
1260 updateifgraph
("ORANGE", "day");
1261 updateifgraph
("ORANGE", "week");
1262 updateifgraph
("ORANGE", "month");
1263 updateifgraph
("ORANGE", "year");
1266 if ($settings{'CONFIG_TYPE'} =~ /^(4|5|6|7)$/ && -e
"$rrdlog/BLUE.rrd") {
1267 updateifgraph
("BLUE", "day");
1268 updateifgraph
("BLUE", "week");
1269 updateifgraph
("BLUE", "month");
1270 updateifgraph
("BLUE", "year");
1273 system("chmod -R 0777 /srv/web/ipfire/html/graphs");
1274 system("chmod -R 0777 /srv/web/ipfire/html/sgraph");