]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/scripts/makegraphs
Samba default Freigabe angepasst
[people/pmueller/ipfire-2.x.git] / src / scripts / makegraphs
1 #!/usr/bin/perl
2
3 ############################################################################
4 # #
5 # This file is part of the IPCop Firewall. #
6 # #
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. #
11 # #
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. #
16 # #
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 #
20 # #
21 # Copyright (C) 2004-01-19 Mark Wormgoor <mark@wormgoor.com>. #
22 # #
23 ############################################################################
24
25 use strict;
26 #use warnings;
27
28 use RRDs;
29 require "/var/ipfire/general-functions.pl";
30 require "${General::swroot}/lang.pl";
31
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);
36
37 # Added for conversion of utf-8 characters
38 use Encode 'from_to';
39 my %tr=();
40
41 system("chmod 777 /srv/web/ipfire/html/graphs");
42
43 # Force language back to English (ugly hack!)
44 # Modified to only force if we are unable to convert charset
45 # from utf-8
46 if ((${Lang::language} eq 'el') ||
47 (${Lang::language} eq 'fa') ||
48 (${Lang::language} eq 'ru') ||
49 (${Lang::language} eq 'th') ||
50 (${Lang::language} eq 'vi') ||
51 (${Lang::language} eq 'zh') ||
52 (${Lang::language} eq 'zt')) {
53 eval `/bin/cat "${General::swroot}/langs/en.pl"`;
54 } else {
55 %tr=%Lang::tr; # use translated version for other languages
56 }
57
58 # Settings
59 my $rrdlog = "/var/log/rrd";
60 my $graphs = "/srv/web/ipfire/html/graphs";
61 $ENV{PATH}="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin";
62 my $hdd_device = "/dev/harddisk";
63 my $temp = '';
64 my %mbmon_values = ();
65 my $key;
66 my $value;
67 my @args = ();
68 my $count = 0;
69 my $ERROR;
70 my $dbg = 0;
71 my $path_smartctl = "/usr/sbin/smartctl";
72 my $path_hddtemp = "/usr/sbin/hddtemp";
73
74 my %color = ();
75 my %mainsettings = ();
76 &General::readhash("${General::swroot}/main/settings", \%mainsettings);
77 &General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
78
79 open(MBMON_OUT, ">/var/log/mbmon-values");
80 open(FD, "/usr/bin/mbmon -rc1|" ) || die "ERROR: Cannot run mbmon\n" ;
81
82 while( $_ = <FD> )
83 {
84 next unless( /^([A-Za-z][^:\s]+)\s*:\s*([+\-]{0,1}[\d\.]+)/ ) ;
85 $key = $1 ;
86 $value = $2 ;
87 $key =~ y/A-Z/a-z/ ;
88 $mbmon_values{$key} = $value;
89 print(MBMON_OUT "$key=$value\n");
90 }
91 close(FD);
92 close(MBMON_OUT);
93
94 sub gettraffic {
95 my $interface = $_[0];
96
97 my $bytesin=0;
98 my $bytesout=0;
99
100 foreach (@ipacsum)
101 {
102 # Incoming...
103 $bytesin += $1 if (/^[\* ]\s+incoming\s+${interface}.+\:\s+(\d+)/);
104
105 # Forwarded Incoming...
106 $bytesin += $1 if (/^[\* ]\s+forwarded\s+incoming\s+${interface}.+\:\s+(\d+)/);
107
108 # Outgoing...
109 $bytesout += $1 if (/^[* ]\s+outgoing\s+${interface}.+\:\s+(\d+)/);
110
111 # Forwarded Outgoing...
112 $bytesout += $1 if (/^[* ]\s+forwarded\s+outgoing\s+${interface}.+\:\s+(\d+)/);
113 }
114 return "$bytesin:$bytesout";
115 }
116
117 sub updatecpudata {
118 if ( ! -e "$rrdlog/cpu.rrd") {
119 RRDs::create ("$rrdlog/cpu.rrd", "--step=300",
120 "DS:user:COUNTER:600:0:500000000",
121 "DS:system:COUNTER:600:0:500000000",
122 "DS:idle:COUNTER:600:0:500000000",
123 "DS:iowait:COUNTER:600:0:500000000",
124 "DS:irq:COUNTER:600:0:500000000",
125 "RRA:AVERAGE:0.5:1:576",
126 "RRA:AVERAGE:0.5:6:672",
127 "RRA:AVERAGE:0.5:24:732",
128 "RRA:AVERAGE:0.5:144:1460");
129 $ERROR = RRDs::error;
130 print "Error in RRD::create for cpu: $ERROR\n" if $ERROR;
131 }
132
133 my ($cpu, $user, $nice, $system, $idle, $iowait, $irq, $softirq);
134
135 open STAT, "/proc/stat";
136 while(<STAT>) {
137 chomp;
138 /^cpu\s/ or next;
139 ($cpu, $user, $nice, $system, $idle, $iowait, $irq, $softirq) = split /\s+/;
140 last;
141 }
142 close STAT;
143 $user += $nice;
144 $irq += $softirq;
145
146
147 RRDs::update ("$rrdlog/cpu.rrd",
148 "-t", "user:system:idle:iowait:irq",
149 "N:$user:$system:$idle:$iowait:$irq");
150 $ERROR = RRDs::error;
151 print "Error in RRD::update for cpu: $ERROR\n" if $ERROR;
152
153 }
154
155 sub updateloaddata {
156 if ( ! -e "$rrdlog/load.rrd") {
157 RRDs::create ("$rrdlog/load.rrd", "--step=60",
158 "DS:load1:GAUGE:120:0:U",
159 "DS:load5:GAUGE:120:0:U",
160 "DS:load15:GAUGE:120:0:U",
161 "RRA:AVERAGE:0.5:1:2160",
162 "RRA:AVERAGE:0.5:5:2016",
163 "RRA:AVERAGE:0.5:15:2880",
164 "RRA:AVERAGE:0.5:60:8760");
165
166 $ERROR = RRDs::error;
167 print "Error in RRD::create for cpu: $ERROR\n" if $ERROR;
168 }
169 }
170
171 sub updatememdata {
172 my ($memused, $memfree, $memshared, $membuffers, $memcache, $swapused, $swapfree, $swaptotal);
173 if ( ! -e "$rrdlog/mem.rrd") {
174 RRDs::create ("$rrdlog/mem.rrd", "--step=300",
175 "DS:memused:ABSOLUTE:600:0:5000000000",
176 "DS:memfree:ABSOLUTE:600:0:5000000000",
177 "DS:memshared:ABSOLUTE:600:0:5000000000",
178 "DS:membuffers:ABSOLUTE:600:0:5000000000",
179 "DS:memcache:ABSOLUTE:600:0:5000000000",
180 "DS:swapused:ABSOLUTE:600:0:5000000000",
181 "DS:swapfree:ABSOLUTE:600:0:5000000000",
182 "RRA:AVERAGE:0.5:1:576",
183 "RRA:AVERAGE:0.5:6:672",
184 "RRA:AVERAGE:0.5:24:732",
185 "RRA:AVERAGE:0.5:144:1460");
186 $ERROR = RRDs::error;
187 print "Error in RRD::create for mem: $ERROR\n" if $ERROR;
188 }
189
190 open MEM, "/proc/meminfo";
191 while(<MEM>) {
192 chomp;
193 if ($_ =~ /^MemTotal:/) {
194 my @temp = split (/\s+/, $_);
195 $memused = $temp[1];
196 } elsif ($_ =~ /^MemFree:/) {
197 my @temp = split (/\s+/, $_);
198 $memfree = $temp[1];
199 } elsif ($_ =~ /^Cached:/) {
200 my @temp = split (/\s+/, $_);
201 $memcache = $temp[1];
202 } elsif ($_ =~ /^Buffers:/) {
203 my @temp = split (/\s+/, $_);
204 $membuffers = $temp[1];
205 } elsif ($_ =~ /^SwapTotal:/) {
206 my @temp = split (/\s+/, $_);
207 $swaptotal = $temp[1];
208 } elsif ($_ =~ /^SwapFree:/) {
209 my @temp = split (/\s+/, $_);
210 $swapfree = $temp[1];
211 }
212 }
213 close MEM;
214
215 system("/bin/df > /tmp/diskfree");
216 open DF, "/tmp/diskfree";
217 while(<DF>) {
218 chomp;
219 if ($_ =~ /^shm/) {
220 my @temp = split (/\s+/, $_);
221 $memshared = $temp[2];
222 }
223 }
224 close DF;
225 system("/bin/rm -f /tmp/diskfree");
226
227 $swapused = $swaptotal-$swapfree;
228 RRDs::update ("$rrdlog/mem.rrd",
229 "-t", "memused:memfree:memshared:membuffers:memcache:swapused:swapfree",
230 "N:$memused:$memfree:$memshared:$membuffers:$memcache:$swapused:$swapfree");
231 $ERROR = RRDs::error;
232 print "Error in RRD::update for mem: $ERROR\n" if $ERROR;
233 }
234
235 sub updatediskdata {
236 my $disk = $_[0];
237 my ($readsect, $writesect, $trash);
238 my @array = split(/\//,$disk);
239 if ( ! -e "$rrdlog/disk-".$array[$#array].".rrd") {
240 RRDs::create ("$rrdlog/disk-".$array[$#array].".rrd", "--step=300",
241 "DS:readsect:COUNTER:600:0:5000000000",
242 "DS:writesect:COUNTER:600:0:5000000000",
243 "RRA:AVERAGE:0.5:1:576",
244 "RRA:AVERAGE:0.5:6:672",
245 "RRA:AVERAGE:0.5:24:732",
246 "RRA:AVERAGE:0.5:144:1460");
247 $ERROR = RRDs::error;
248 print "Error in RRD::create for disk $disk: $ERROR\n" if $ERROR;
249 }
250
251 my $Zeilen = `/usr/bin/iostat $disk | tail -2 | head -1`;
252 ($trash, $trash, $trash, $trash, $readsect, $writesect) = split(/\s+/,$Zeilen);
253
254 print "\nread:".$readsect."write:".$writesect."\n";
255
256 if ($readsect && $writesect) {
257 RRDs::update ("$rrdlog/disk-".$array[$#array].".rrd",
258 "-t", "readsect:writesect",
259 "N:$readsect:$writesect");
260 $ERROR = RRDs::error;
261 print "Error in RRD::update for disk $disk: $ERROR\n" if $ERROR;
262 } else {
263 print "Error in RRD::update for disk: $disk no data available\n";
264 }
265 }
266
267 sub updateifdata {
268 my $interface = $_[0];
269
270 if ( ! -e "$rrdlog/$interface.rrd") {
271 RRDs::create ("$rrdlog/$interface.rrd", "--step=300",
272 "DS:incoming:ABSOLUTE:600:0:12500000",
273 "DS:outgoing:ABSOLUTE:600:0:12500000",
274 "RRA:AVERAGE:0.5:1:576",
275 "RRA:AVERAGE:0.5:6:672",
276 "RRA:AVERAGE:0.5:24:732",
277 "RRA:AVERAGE:0.5:144:1460");
278 $ERROR = RRDs::error;
279 print "Error in RRD::create for $interface: $ERROR\n" if $ERROR;
280 }
281
282 my $traffic = gettraffic ($interface);
283 RRDs::update ("$rrdlog/$interface.rrd",
284 "-t", "incoming:outgoing",
285 "N:$traffic");
286 $ERROR = RRDs::error;
287 print "Error in RRD::update for $interface: $ERROR\n" if $ERROR;
288 }
289
290 sub updatefwhitsdata {
291 my $portamount=0;
292 my $alertaktuell=0;
293 my $aktuell=0;
294 my $portaktuell=0;
295 my $skip=0;
296
297 if (! -e "$rrdlog/firewallhits.rrd")
298 {
299 RRDs::create ("$rrdlog/firewallhits.rrd", "--step=300",
300 "DS:amount:GAUGE:600:0:U",
301 "DS:portamount:GAUGE:600:0:U",
302 "RRA:AVERAGE:0.5:1:576",
303 "RRA:AVERAGE:0.5:6:672",
304 "RRA:AVERAGE:0.5:24:732",
305 "RRA:AVERAGE:0.5:144:1460");
306 $ERROR = RRDs::error;
307 print "Error in RRD::create for cpu: $ERROR\n" if $ERROR;
308 }
309
310 system("logtailfwhits /var/log/messages /var/log/fwhits.messages.offset >/tmp/messages.fwhits");
311 if (!(open (FILE,'/tmp/messages.fwhits'))) {
312 $skip=1;
313 }
314 $aktuell = 0;
315 if (!$skip) {
316 while (<FILE>) {
317 if (/kernel:.*(IN=.*)$/) {
318 $aktuell++;
319 }
320 }
321 close (FILE);
322 }
323
324 system("logtailfwhits /var/log/snort/alert /var/log/snort/fwhits.alert.offset >/tmp/snort.fwhits");
325 if (!(open (FILE,'/tmp/snort.fwhits'))) {
326 $skip=1;
327 }
328 $alertaktuell = 0;
329 if (!$skip) {
330 while (<FILE>) {
331 if (/scan.*$/) {
332 $alertaktuell++;
333 }
334 }
335 close (FILE);
336 }
337
338 if (!(open (FILE,'/tmp/messages.fwhits'))) {
339 $skip=1;
340 }
341 $portaktuell = 0;
342 if (!$skip) {
343 while (<FILE>) {
344 if (/kernel:.*(Scan.*)$/) {
345 $portaktuell++;
346 }
347 }
348 close (FILE);
349 }
350
351 system("rm /tmp/messages.fwhits");
352 system("rm /tmp/snort.fwhits");
353
354 $portamount = $portaktuell + $alertaktuell;
355 chomp($portamount);
356 RRDs::update ("$rrdlog/firewallhits.rrd",
357 "N:$aktuell:$portamount");
358 $ERROR = RRDs::error;
359 print "Error in RRD::update for Firewallhits: $ERROR\n" if $ERROR;
360 }
361
362 # Creates and updates a link quality database
363 # -------------------------------------------
364 sub updatelq {
365 if ( ! -e "$rrdlog/lq.rrd") {
366 RRDs::create ("$rrdlog/lq.rrd", "--step=300",
367 "DS:loss:GAUGE:600:0:100",
368 "DS:roundtrip:GAUGE:600:0:10000",
369 "RRA:AVERAGE:0.5:1:576",
370 "RRA:AVERAGE:0.5:6:672",
371 "RRA:AVERAGE:0.5:24:732",
372 "RRA:AVERAGE:0.5:144:1460");
373 $ERROR = RRDs::error;
374 print "Error in RRD::create for link: $ERROR\n" if $ERROR;
375 }
376 my $packetloss=0;
377 my $roundtrip=0;
378 my $test=0;
379 # LQ_GATEWAY is the ip of your isp's public ip facing you
380 my $LQ_GATEWAY=`cat /var/ipfire/red/remote-ipaddress`;
381 chomp($LQ_GATEWAY);
382 my $NUMPINGS=5;
383 my $pingoutput = `/usr/bin/ping -w 10 -c $NUMPINGS -q $LQ_GATEWAY | tail -2`;
384 my @temp = split (/\/|\%|\s/, $pingoutput);
385 $packetloss = $temp[5];
386 $roundtrip = $temp[17];
387
388 print "Paketlos->".$packetloss."<-Roundtrip->".$roundtrip."<-\n";
389
390 if ( $packetloss eq "100" ){
391 my $pingoutput = `/usr/bin/ping -w 10 -c $NUMPINGS -q ping.ipfire.org | tail -2`;
392 my @temp = split (/\/|\%|\s/, $pingoutput);
393 $packetloss = $temp[5];
394 $roundtrip = $temp[17];
395
396 print "Paketlos->".$packetloss."<-Roundtrip->".$roundtrip."<-\n";
397 }
398
399 RRDs::update ("$rrdlog/lq.rrd", "N:$packetloss:$roundtrip");
400 $ERROR = RRDs::error;
401 print "Error in RRD::update for line quality: $ERROR\n" if $ERROR;
402 }
403
404 sub updatehdddata
405 {
406 my $disk = $_[0];
407 my $standby;
408 my @array = split(/\//,$disk);
409
410 if ( ! -e "$rrdlog/hddshutdown-".$array[$#array].".rrd")
411 {
412 # database did not exist -> create
413 RRDs::create ("$rrdlog/hddshutdown-".$array[$#array].".rrd", "--step=300",
414 "DS:standby:GAUGE:600:0:1",
415 "RRA:AVERAGE:0.5:1:576",
416 "RRA:AVERAGE:0.5:6:672",
417 "RRA:AVERAGE:0.5:24:732",
418 "RRA:AVERAGE:0.5:144:1460");
419 $ERROR = RRDs::error;
420 print "Error in RRD::create for hddshutdown-".$array[$#array].": $ERROR\n" if $ERROR;
421 }
422
423 if (-e "/tmp/hddshutdown-".$array[$#array]) {$standby = 1;}
424 else {$standby = 0;}
425
426 RRDs::update ("$rrdlog/hddshutdown-".$array[$#array].".rrd", "-t", "standby", "N:$standby");
427 $ERROR = RRDs::error;
428 print "Error in RRD::update for hddshutdown-".$array[$#array].": $ERROR\n" if $ERROR;
429
430 if ( ! -e "$rrdlog/hddtemp-".$array[$#array].".rrd")
431 {
432 # database did not exist -> create
433 RRDs::create ("$rrdlog/hddtemp-".$array[$#array].".rrd", "--step=300",
434 "DS:temperature:GAUGE:600:0:100",
435 "RRA:AVERAGE:0.5:1:576",
436 "RRA:AVERAGE:0.5:6:672",
437 "RRA:AVERAGE:0.5:24:732",
438 "RRA:AVERAGE:0.5:144:1460");
439 $ERROR = RRDs::error;
440 print "Error in RRD::create for hdd-".$array[$#array].": $ERROR\n" if $ERROR;
441 }
442
443 # Temperaturlesen wÃrde die Platte aufwecken!!!
444 if (!$standby)
445 {
446 $temp = 0;
447 my $hdd_output = '';
448 my $smart_output = '';
449
450 if ( -e "$path_smartctl" )
451 {
452 system("$path_smartctl -iHA -d ata /dev/$disk > /var/log/smartctl_out_hddtemp-$disk");
453 }
454
455 if ( -e "$path_hddtemp" )
456 {
457 $hdd_output = `$path_hddtemp -qn /dev/$disk`;
458
459 # I know 4 response possible responses:
460 #
461 # /dev/harddisk: harddisk type: S.M.A.R.T. not available
462 # /dev/harddisk: harddisk type: no sensor
463 # /dev/harddisk: harddisk type: 37?C or ?F
464 # 37
465
466 if ( index($hdd_output, "S.M.A.R.T.") != -1 )
467 {
468 $temp = 0;
469 }
470 elsif ( index($hdd_output, "no sensor") != -1 )
471 {
472 $temp = 1;
473 }
474 elsif ( index($hdd_output, "$disk") != -1 )
475 {
476 $hdd_output =~ /.*:.*:\s*(\d+).*\s/;
477 $temp = $1;
478 }
479 else
480 {
481 $hdd_output =~ /(\d+)\s/;
482 $temp = $1;
483 }
484 }
485 elsif ( -e "/var/log/smartctl_out_hddtemp-".$array[$#array] )
486 {
487 $hdd_output = `cat /var/log/smartctl_out_hddtemp-".$array[$#array]." | grep Temperature_`;
488 my @t = split(/\s+/,$hdd_output);
489 $temp = $t[9];
490 }
491 else
492 {
493 $temp = 0;
494 }
495
496
497 print "Temperature for ".$array[$#array]."->".$temp."<-\n";
498 # Nur ins RDD wenn nicht 0 (sonst klappt die min Anzeige nicht)
499 if ($temp)
500 {
501 RRDs::update ("$rrdlog/hddtemp-".$array[$#array].".rrd", "-t", "temperature", "N:$temp");
502 $ERROR = RRDs::error;
503 print "Error in RRD::update for hdd-".$array[$#array].": $ERROR\n" if $ERROR;
504 }
505 }
506 }
507
508 sub updatembmondata
509 {
510 if ( ! -e "$rrdlog/mbmon.rrd" )
511 {
512 # database did not exist -> create
513
514 @args = ("$rrdlog/mbmon.rrd");
515
516 push(@args, "--step=300");
517 foreach $key ( sort(keys %mbmon_values) )
518 {
519 push(@args, "DS:$key:GAUGE:600:U:U");
520 }
521 push(@args, "RRA:AVERAGE:0.5:1:576");
522 push(@args, "RRA:AVERAGE:0.5:6:672");
523 push(@args, "RRA:AVERAGE:0.5:24:732");
524 push(@args, "RRA:AVERAGE:0.5:144:1460");
525
526 print("create ". join( ", ", @args)) if ( $dbg );
527
528 RRDs::create (@args);
529 $ERROR = RRDs::error;
530 print("Error in RRD::create for mbmon: $ERROR\n") if $ERROR;
531 }
532
533 my @ds;
534 my @val;
535 my $template;
536
537 foreach $key ( sort(keys %mbmon_values) )
538 {
539 push(@ds, $key);
540 push(@val, $mbmon_values{$key});
541 }
542
543 $template = join(':', @ds);
544 $value = "N:".join(':', @val);
545
546 print("update template = '$template'\n") if ( $dbg );
547 print("update value = '$value'\n") if ( $dbg );
548
549 RRDs::update("$rrdlog/mbmon.rrd", "-t", $template, $value);
550 $ERROR = RRDs::error;
551 print("Error in RRD::update for mbmon: $ERROR\n") if $ERROR;
552 }
553
554 ## Update ipac logs
555 system ('/usr/sbin/fetchipac');
556 sleep 8;
557
558 ###
559 ### Squid Graphs
560 ###
561 if ( -e "/var/log/squid/access.log") {
562 system ("/usr/bin/squid-graph -o=/srv/web/ipfire/html/sgraph --tcp-only < /var/log/squid/access.log >/dev/null 2>&1");
563 }
564
565 ###
566 ### utf8 conversion
567 ###
568 if ((${Lang::language} eq 'cs') ||
569 (${Lang::language} eq 'hu') ||
570 (${Lang::language} eq 'pl') ||
571 (${Lang::language} eq 'sk')) {
572 # Czech, Hungarian, Polish and Slovak character set
573 foreach my $key(keys %Lang::tr) {
574 from_to($tr{$key}, "utf-8", "iso-8859-2");
575 }
576 } elsif (${Lang::language} eq 'tr') {
577 # Turkish
578 foreach my $key(keys %Lang::tr) {
579 from_to($tr{$key}, "utf-8", "iso-8859-9");
580 }
581 } else {
582 foreach my $key(keys %Lang::tr) {
583 from_to($tr{$key}, "utf-8", "iso-8859-1");
584 }
585 }
586
587 ###
588 ### System graphs
589 ###
590 updatecpudata();
591 updateloaddata();
592 updatememdata();
593
594 ###
595 ### HDD graphs
596 ###
597
598
599 my @disks = `kudzu -qps -c HD | grep device: | cut -d" " -f2 | sort | uniq`;
600 system("unlink /tmp/hddstatus && touch /tmp/hddstatus");
601 print "\nFound following amount of disks:".@disks."\n";
602 foreach (@disks){
603 my $disk = $_;
604 chomp $disk;
605 print "Working on disk ".$disk.".\n";
606
607 my $status = "";
608 my $diskstats = "";
609 my $newdiskstats = "";
610 my @array = split(/\//,$disk);
611
612 $diskstats = `cat /tmp/hddstats-$array[$#array]`;
613 chomp $diskstats;
614 my $newdiskstats = `/usr/bin/iostat -d -t $disk | tail -2 | head -1 | awk '{ print \$5","\$6}'`;
615 chomp $newdiskstats;
616 my $status = `hdparm -C /dev/$disk | tail -1 | cut -d: -f2`;
617 chomp $status;
618
619 if ($status !~/standby/ || $diskstats ne $newdiskstats)
620 {
621 if (-e "/tmp/hddshutdown-".$array[$#array])
622 {
623 system("unlink /tmp/hddshutdown-".$array[$#array]);
624 }
625 }
626
627 if (-e "/tmp/hddshutdown-".$array[$#array])
628 {
629 $status = " standby\n";
630 }
631 else
632 {
633 $status = " active\n";
634 }
635
636
637 open(DATEI, ">>/tmp/hddstatus") || die "Datei nicht gefunden";
638 print DATEI $disk."-".$status;
639 close(DATEI);
640
641 updatediskdata($disk);
642 updatehdddata($disk);
643
644 }
645
646 ###
647 ### Firewallhits
648 ###
649 updatefwhitsdata();
650
651 ###
652 ### Link Quality
653 ###
654 updatelq();
655
656 ###
657 ### Mbmon Data
658 ###
659 updatembmondata();
660
661 ###
662 ### Network Graphs
663 ###
664 @ipacsum = `/usr/sbin/ipacsum --exact -s 5m 2>/dev/null`;
665 if (@ipacsum) {
666 updateifdata ("GREEN");
667 updateifdata ("RED");
668 if ($settings{'CONFIG_TYPE'} =~ /^(2|4)$/ ) {
669 updateifdata ("ORANGE");
670 }
671 if ($settings{'CONFIG_TYPE'} =~ /^(3|4)$/ ) {
672 updateifdata ("BLUE");
673 }
674 }