]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/scripts/makegraphs
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=`netstat -rn | grep ^0.0.0.0 | awk '{print \$2}'`;
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;
757 if ( ! -e
"$rrdlog/hddtemp-$disk.rrd")
759 # database did not exist -> create
760 RRDs
::create
("$rrdlog/hddtemp-$disk.rrd", "--step=300",
761 "DS:temperature:GAUGE:600:0:100",
762 "RRA:AVERAGE:0.5:1:576",
763 "RRA:AVERAGE:0.5:6:672",
764 "RRA:AVERAGE:0.5:24:732",
765 "RRA:AVERAGE:0.5:144:1460");
766 $ERROR = RRDs
::error
;
767 print "Error in RRD::create for hdd-$disk: $ERROR\n" if $ERROR;
772 my $smart_output = '';
774 if ( -e
"$path_smartctl" )
776 system("$path_smartctl -iHA /dev/$disk > /var/log/smartctl_out_hddtemp-$disk");
779 if ( -e
"$path_hddtemp" )
781 $hdd_output = `$path_hddtemp -qn /dev/$disk`;
783 # I know 4 response possible responses:
785 # /dev/harddisk: harddisk type: S.M.A.R.T. not available
786 # /dev/harddisk: harddisk type: no sensor
787 # /dev/harddisk: harddisk type: 37°C or °F
790 if ( index($hdd_output, "S.M.A.R.T.") != -1 )
794 elsif ( index($hdd_output, "no sensor") != -1 )
798 elsif ( index($hdd_output, "$disk") != -1 )
800 $hdd_output =~ /.*:.*:\s*(\d+).*\s/;
805 $hdd_output =~ /(\d+)\s/;
809 elsif ( -e
"/var/log/smartctl_out_hddtemp-$disk" )
811 $hdd_output = `cat /var/log/smartctl_out_hddtemp-$disk | grep Temperature_`;
812 my @t = split(/\s+/,$hdd_output);
820 # print "hdd $hdd_output \n";
821 # print "temp $temp \n";
823 RRDs
::update
("$rrdlog/hddtemp-$disk.rrd", "-t", "temperature", "N:$temp");
825 $ERROR = RRDs
::error
;
826 print "Error in RRD::update for hdd-$disk: $ERROR\n" if $ERROR;
833 RRDs
::graph
("$graphs/hddtemp-$disk-$period.png",
834 "--start", "-1$period", "-aPNG", "-i", "-z",
835 "--alt-y-grid", "-w 600", "-h 100",
836 "--color", "SHADEA#EAE9EE",
837 "--color", "SHADEB#EAE9EE",
838 "--color", "BACK#FFFFFF",
839 "-t $tr{'harddisk temperature'} ($tr{'graph per'} $tr{$period})",
840 "DEF:temperature=$rrdlog/hddtemp-$disk.rrd:temperature:AVERAGE",
841 "LINE2:temperature#0000FF:$tr{'hdd temperature in'} °C",
842 "GPRINT:temperature:MAX:$tr{'maximal'}\\:%3.0lf °C",
843 "GPRINT:temperature:AVERAGE:$tr{'average'}\\:%3.0lf °C",
844 "GPRINT:temperature:LAST:$tr{'current'}\\:%3.0lf °C",
846 $ERROR = RRDs
::error
;
847 print "Error in RRD::graph for hdd-$disk: $ERROR\n" if $ERROR;
852 if ( ! -e
"$rrdlog/mbmon.rrd" )
854 # database did not exist -> create
856 @args = ("$rrdlog/mbmon.rrd");
858 push(@args, "--step=300");
859 foreach $key ( sort(keys %mbmon_values) )
861 push(@args, "DS:$key:GAUGE:600:U:U");
863 push(@args, "RRA:AVERAGE:0.5:1:576");
864 push(@args, "RRA:AVERAGE:0.5:6:672");
865 push(@args, "RRA:AVERAGE:0.5:24:732");
866 push(@args, "RRA:AVERAGE:0.5:144:1460");
868 print("create ". join( ", ", @args)) if ( $dbg );
870 RRDs
::create
(@args);
871 $ERROR = RRDs
::error
;
872 print("Error in RRD::create for mbmon: $ERROR\n") if $ERROR;
879 foreach $key ( sort(keys %mbmon_values) )
882 push(@val, $mbmon_values{$key});
885 $template = join(':', @ds);
886 $value = "N:".join(':', @val);
888 print("update template = '$template'\n") if ( $dbg );
889 print("update value = '$value'\n") if ( $dbg );
891 RRDs
::update
("$rrdlog/mbmon.rrd", "-t", $template, $value);
892 $ERROR = RRDs
::error
;
893 print("Error in RRD::update for mbmon: $ERROR\n") if $ERROR;
901 @args = ("$graphs/mbmon-$type-$period.png", "--start", "-1$period", "-aPNG", "-i", "-z",
902 "--alt-y-grid", "-w 600", "-h 100", "--alt-autoscale",
903 "--color", "SHADEA#EAE9EE",
904 "--color", "SHADEB#EAE9EE",
905 "--color", "BACK#FFFFFF",
906 "-t $tr{'mbmon temp'} ($tr{'graph per'} $tr{$period})" );
909 foreach $key ( sort(keys %mbmon_values) )
911 if ( (index($key, $type) != -1) && ($mbmon_settings{'LINE-'.$key} eq 'on') )
913 if ( !defined($mbmon_settings{'LABEL-'.$key}) || ($mbmon_settings{'LABEL-'.$key} eq '') )
915 $mbmon_settings{'LABEL-'.$key} = $key;
918 push(@args, "DEF:$key=$rrdlog/mbmon.rrd:$key:AVERAGE");
919 push(@args, "LINE2:$key$colors{$count}:$mbmon_settings{'LABEL-'.$key} $tr{'mbmon temp in'} °C");
920 push(@args, "GPRINT:$key:MAX:$tr{'maximal'}\\:%5.1lf °C");
921 push(@args, "GPRINT:$key:AVERAGE:$tr{'average'}\\:%5.1lf °C");
922 push(@args, "GPRINT:$key:LAST:$tr{'current'}\\:%5.1lf °C\\j");
930 RRDs
::graph
( @args );
931 $ERROR = RRDs
::error
;
932 print("Error in RRD::graph for temp: $ERROR\n")if $ERROR;
941 @args = ("$graphs/mbmon-$type-$period.png", "--start", "-1$period", "-aPNG", "-i", "-z",
942 "--alt-y-grid", "-w 600", "-h 100", "--alt-autoscale",
943 "--color", "SHADEA#EAE9EE",
944 "--color", "SHADEB#EAE9EE",
945 "--color", "BACK#FFFFFF",
946 "-t $tr{'mbmon temp'} ($tr{'graph per'} $tr{$period})" );
949 foreach $key ( sort(keys %mbmon_values) )
951 if ( (index($key, $type) != -1) && ($mbmon_settings{'LINE-'.$key} eq 'on') )
953 if ( !defined($mbmon_settings{'LABEL-'.$key}) || ($mbmon_settings{'LABEL-'.$key} eq '') )
955 $mbmon_settings{'LABEL-'.$key} = $key;
958 push(@args, "DEF:$key=$rrdlog/mbmon.rrd:$key:AVERAGE");
959 push(@args, "LINE2:$key$colors{$count}:$mbmon_settings{'LABEL-'.$key} $tr{'mbmon fan in'} rpm");
960 push(@args, "GPRINT:$key:MAX:$tr{'maximal'}\\:%5.0lf rpm");
961 push(@args, "GPRINT:$key:AVERAGE:$tr{'average'}\\:%5.0lf rpm");
962 push(@args, "GPRINT:$key:LAST:$tr{'current'}\\:%5.0lf rpm\\j");
970 RRDs
::graph
( @args );
971 $ERROR = RRDs
::error
;
972 print("Error in RRD::graph for temp: $ERROR\n")if $ERROR;
981 @args = ("$graphs/mbmon-$type-$period.png", "--start", "-1$period", "-aPNG", "-i", "-z",
982 "--alt-y-grid", "-w 600", "-h 100", "--alt-autoscale",
983 "--color", "SHADEA#EAE9EE",
984 "--color", "SHADEB#EAE9EE",
985 "--color", "BACK#FFFFFF",
986 "-t $tr{'mbmon temp'} ($tr{'graph per'} $tr{$period})" );
989 foreach $key ( sort(keys %mbmon_values) )
991 my $v = substr($key,0,1);
992 if ( ($v eq 'v') && ($mbmon_settings{'LINE-'.$key} eq 'on') )
994 if ( !defined($mbmon_settings{'LABEL-'.$key}) || ($mbmon_settings{'LABEL-'.$key} eq '') )
996 $mbmon_settings{'LABEL-'.$key} = $key;
999 push(@args, "DEF:$key=$rrdlog/mbmon.rrd:$key:AVERAGE");
1000 push(@args, "LINE2:$key$colors{$count}:$mbmon_settings{'LABEL-'.$key} V");
1001 push(@args, "GPRINT:$key:MAX:$tr{'maximal'}\\:%5.2lf V");
1002 push(@args, "GPRINT:$key:AVERAGE:$tr{'average'}\\:%5.2lf V");
1003 push(@args, "GPRINT:$key:LAST:$tr{'current'}\\:%5.2lf V\\j");
1011 RRDs
::graph
( @args );
1012 $ERROR = RRDs
::error
;
1013 print("Error in RRD::graph for temp: $ERROR\n")if $ERROR;
1018 system ('/usr/sbin/fetchipac');
1024 if ( -e
"/var/log/squid/access.log") {
1025 system ("/usr/bin/squid-graph -o=/srv/web/ipfire/html/sgraph --tcp-only < /var/log/squid/access.log >/dev/null 2>&1");
1031 if ((${Lang
::language
} eq 'cs') ||
1032 (${Lang
::language
} eq 'hu') ||
1033 (${Lang
::language
} eq 'pl') ||
1034 (${Lang
::language
} eq 'sk')) {
1035 # Czech, Hungarian, Polish and Slovak character set
1036 foreach my $key(keys %Lang::tr
) {
1037 from_to
($tr{$key}, "utf-8", "iso-8859-2");
1039 } elsif (${Lang
::language
} eq 'tr') {
1041 foreach my $key(keys %Lang::tr
) {
1042 from_to
($tr{$key}, "utf-8", "iso-8859-9");
1045 foreach my $key(keys %Lang::tr
) {
1046 from_to
($tr{$key}, "utf-8", "iso-8859-1");
1054 updatecpugraph
("day");
1055 updatecpugraph
("week");
1056 updatecpugraph
("month");
1057 updatecpugraph
("year");
1060 updateloadgraph
("day");
1061 updateloadgraph
("week");
1062 updateloadgraph
("month");
1063 updateloadgraph
("year");
1066 updatememgraph
("day");
1067 updatememgraph
("week");
1068 updatememgraph
("month");
1069 updatememgraph
("year");
1072 updatediskgraph
("day");
1073 updatediskgraph
("week");
1074 updatediskgraph
("month");
1075 updatediskgraph
("year");
1077 if (open STAT
,"/dev/hda") {
1079 updatediskdatanew
("hda");
1080 updatediskgraphnew
("hda","day");
1081 updatediskgraphnew
("hda","week");
1082 updatediskgraphnew
("hda","month");
1083 updatediskgraphnew
("hda","year");
1085 if (-e
"$graphs/disk-hda-day.png") {
1086 system("rm $graphs/disk-hda-day.png");
1090 if (open STAT
,"/dev/hdb") {
1092 updatediskdatanew
("hdb");
1093 updatediskgraphnew
("hdb","day");
1094 updatediskgraphnew
("hdb","week");
1095 updatediskgraphnew
("hdb","month");
1096 updatediskgraphnew
("hdb","year");
1098 if (-e
"$graphs/disk-hdb-day.png") {
1099 system("rm $graphs/disk-hdb-day.png");
1103 if (open STAT
,"/dev/hdc") {
1105 updatediskdatanew
("hdc");
1106 updatediskgraphnew
("hdc","day");
1107 updatediskgraphnew
("hdc","week");
1108 updatediskgraphnew
("hdc","month");
1109 updatediskgraphnew
("hdc","year");
1111 if (-e
"$graphs/disk-hdc-day.png") {
1112 system("rm $graphs/disk-hdc-day.png");
1116 if (open STAT
,"/dev/hdd") {
1118 updatediskdatanew
("hdd");
1119 updatediskgraphnew
("hdd","day");
1120 updatediskgraphnew
("hdd","week");
1121 updatediskgraphnew
("hdd","month");
1122 updatediskgraphnew
("hdd","year");
1124 if (-e
"$graphs/disk-hdd-day.png") {
1125 system("rm $graphs/disk-hdd-day.png");
1129 if (open STAT
,"/dev/hde") {
1131 updatediskdatanew
("hde");
1132 updatediskgraphnew
("hde","day");
1133 updatediskgraphnew
("hde","week");
1134 updatediskgraphnew
("hde","month");
1135 updatediskgraphnew
("hde","year");
1137 if (-e
"$graphs/disk-hde-day.png") {
1138 system("rm $graphs/disk-hde-day.png");
1142 if (open STAT
,"/dev/hdf") {
1144 updatediskdatanew
("hdf");
1145 updatediskgraphnew
("hdf","day");
1146 updatediskgraphnew
("hdf","week");
1147 updatediskgraphnew
("hdf","month");
1148 updatediskgraphnew
("hdf","year");
1150 if (-e
"$graphs/disk-hdf-day.png") {
1151 system("rm $graphs/disk-hdf-day.png");
1155 if (open STAT
,"/dev/hdg") {
1157 updatediskdatanew
("hdg");
1158 updatediskgraphnew
("hdg","day");
1159 updatediskgraphnew
("hdg","week");
1160 updatediskgraphnew
("hdg","month");
1161 updatediskgraphnew
("hdg","year");
1163 if (-e
"$graphs/disk-hdg-day.png") {
1164 system("rm $graphs/disk-hdg-day.png");
1168 if (open STAT
,"/dev/hdh") {
1170 updatediskdatanew
("hdh");
1171 updatediskgraphnew
("hdh","day");
1172 updatediskgraphnew
("hdh","week");
1173 updatediskgraphnew
("hdh","month");
1174 updatediskgraphnew
("hdh","year");
1176 if (-e
"$graphs/disk-hdh-day.png") {
1177 system("rm $graphs/disk-hdh-day.png");
1185 updatefwhitsgraph
("day");
1186 updatefwhitsgraph
("week");
1187 updatefwhitsgraph
("month");
1188 updatefwhitsgraph
("year");
1195 updatelqgraph
("day");
1196 updatelqgraph
("week");
1197 updatelqgraph
("month");
1198 updatelqgraph
("year");
1201 ### HDDTEMP-Graphs for /dev/harddisk
1203 if (open STAT
,"/dev/hda") {
1205 updatehdddata
("hda");
1206 updatehddgraph
("hda","day");
1207 updatehddgraph
("hda","week");
1208 updatehddgraph
("hda","month");
1209 updatehddgraph
("hda","year");
1211 if (-e
"$graphs/hddtemp-hda-day.png") {
1212 system("rm $graphs/hddtemp-hda-day.png");
1216 if (open STAT
,"/dev/hdb") {
1218 updatehdddata
("hdb");
1219 updatehddgraph
("hdb","day");
1220 updatehddgraph
("hdb","week");
1221 updatehddgraph
("hdb","month");
1222 updatehddgraph
("hdb","year");
1224 if (-e
"$graphs/hddtemp-hdb-day.png") {
1225 system("rm $graphs/hddtemp-hdb-day.png");
1229 if (open STAT
,"/dev/hdc") {
1231 updatehdddata
("hdc");
1232 updatehddgraph
("hdc","day");
1233 updatehddgraph
("hdc","week");
1234 updatehddgraph
("hdc","month");
1235 updatehddgraph
("hdc","year");
1237 if (-e
"$graphs/hddtemp-hdc-day.png") {
1238 system("rm $graphs/hddtemp-hdc-day.png");
1242 if (open STAT
,"/dev/hdd") {
1244 updatehdddata
("hdd");
1245 updatehddgraph
("hdd","day");
1246 updatehddgraph
("hdd","week");
1247 updatehddgraph
("hdd","month");
1248 updatehddgraph
("hdd","year");
1250 if (-e
"$graphs/hddtemp-hdd-day.png") {
1251 system("rm $graphs/hddtemp-hdd-day.png");
1255 if (open STAT
,"/dev/hde") {
1257 updatehdddata
("hde");
1258 updatehddgraph
("hde","day");
1259 updatehddgraph
("hde","week");
1260 updatehddgraph
("hde","month");
1261 updatehddgraph
("hde","year");
1263 if (-e
"$graphs/hddtemp-hde-day.png") {
1264 system("rm $graphs/hddtemp-hde-day.png");
1268 if (open STAT
,"/dev/hdf") {
1270 updatehdddata
("hdf");
1271 updatehddgraph
("hdf","day");
1272 updatehddgraph
("hdf","week");
1273 updatehddgraph
("hdf","month");
1274 updatehddgraph
("hdf","year");
1276 if (-e
"$graphs/hddtemp-hdf-day.png") {
1277 system("rm $graphs/hddtemp-hdf-day.png");
1281 if (open STAT
,"/dev/hdg") {
1283 updatehdddata
("hdg");
1284 updatehddgraph
("hdg","day");
1285 updatehddgraph
("hdg","week");
1286 updatehddgraph
("hdg","month");
1287 updatehddgraph
("hdg","year");
1289 if (-e
"$graphs/hddtemp-hdg-day.png") {
1290 system("rm $graphs/hddtemp-hdg-day.png");
1294 if (open STAT
,"/dev/hdh") {
1296 updatehdddata
("hdh");
1297 updatehddgraph
("hdh","day");
1298 updatehddgraph
("hdh","week");
1299 updatehddgraph
("hdh","month");
1300 updatehddgraph
("hdh","year");
1302 if (-e
"$graphs/hddtemp-hdh-day.png") {
1303 system("rm $graphs/hddtemp-hdh-day.png");
1309 if ( $mbmon_settings{'GRAPH_TEMP'} == 1 )
1311 updatetempgraph
("day");
1312 updatetempgraph
("week");
1313 updatetempgraph
("month");
1314 updatetempgraph
("year");
1316 if ( $mbmon_settings{'GRAPH_TEMP'} == 1 )
1318 updatefangraph
("day");
1319 updatefangraph
("week");
1320 updatefangraph
("month");
1321 updatefangraph
("year");
1323 if ( $mbmon_settings{'GRAPH_VOLT'} == 1 )
1325 updatevoltgraph
("day");
1326 updatevoltgraph
("week");
1327 updatevoltgraph
("month");
1328 updatevoltgraph
("year");
1334 @ipacsum = `/usr/sbin/ipacsum --exact -s 5m 2>/dev/null`;
1336 updateifdata
("GREEN");
1337 updateifdata
("RED");
1338 if ($settings{'CONFIG_TYPE'} =~ /^(1|3|5|7)$/ ) {
1339 updateifdata
("ORANGE");
1341 if ($settings{'CONFIG_TYPE'} =~ /^(4|5|6|7)$/ ) {
1342 updateifdata
("BLUE");
1345 if ( -e
"$rrdlog/GREEN.rrd") {
1346 updateifgraph
("GREEN", "day");
1347 updateifgraph
("GREEN", "week");
1348 updateifgraph
("GREEN", "month");
1349 updateifgraph
("GREEN", "year");
1352 if ( -e
"$rrdlog/RED.rrd") {
1353 updateifgraph
("RED", "day");
1354 updateifgraph
("RED", "week");
1355 updateifgraph
("RED", "month");
1356 updateifgraph
("RED", "year");
1359 if ($settings{'CONFIG_TYPE'} =~ /^(1|3|5|7)$/ && -e
"$rrdlog/ORANGE.rrd") {
1360 updateifgraph
("ORANGE", "day");
1361 updateifgraph
("ORANGE", "week");
1362 updateifgraph
("ORANGE", "month");
1363 updateifgraph
("ORANGE", "year");
1366 if ($settings{'CONFIG_TYPE'} =~ /^(4|5|6|7)$/ && -e
"$rrdlog/BLUE.rrd") {
1367 updateifgraph
("BLUE", "day");
1368 updateifgraph
("BLUE", "week");
1369 updateifgraph
("BLUE", "month");
1370 updateifgraph
("BLUE", "year");
1373 system("chmod -R 0777 /srv/web/ipfire/html/graphs");
1374 system("chmod -R 0777 /srv/web/ipfire/html/sgraph");