From eecaf145c3c2999865578684c930928a4a012b47 Mon Sep 17 00:00:00 2001 From: maniacikarus Date: Tue, 6 Nov 2007 18:10:24 +0000 Subject: [PATCH] changed temperature reading to smartctrl git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@1064 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- src/scripts/makegraphs | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/src/scripts/makegraphs b/src/scripts/makegraphs index c4bfe70f8b..9cce21a931 100644 --- a/src/scripts/makegraphs +++ b/src/scripts/makegraphs @@ -41,7 +41,7 @@ my %tr=(); system("chmod 777 /srv/web/ipfire/html/graphs"); # Force language back to English (ugly hack!) -# Modified to only force if we are unable to convert charset +# Modified to only force if we are unable to convert charset # from utf-8 if((${Lang::language} eq 'el') || (${Lang::language} eq 'fa') || @@ -80,7 +80,7 @@ my %mainsettings = (); open(MBMON_OUT, ">/var/log/mbmon-values"); open(FD, "/usr/bin/mbmon -rc1|" ) || die "ERROR: Cannot run mbmon\n" ; -while( $_ = ) +while( $_ = ) { next unless( /^([A-Za-z][^:\s]+)\s*:\s*([+\-]{0,1}[\d\.]+)/ ) ; $key = $1 ; @@ -344,9 +344,9 @@ sub updatelq { RRDs::update ("$rrdlog/lq.rrd", "N:$packetloss:$roundtrip"); $ERROR = RRDs::error; print "Error in RRD::update for line quality: $ERROR\n" if $ERROR; -} +} -sub updatehdddata +sub updatehdddata { my $disk = $_[0]; my $standby; @@ -389,27 +389,13 @@ sub updatehdddata my $hdd_output = ''; my $smart_output = ''; if ( -e "$path_smartctl" ){system("$path_smartctl -iHA -d ata /dev/$disk > /var/log/smartctl_out_hddtemp-$disk");} - if ( -e "$path_hddtemp" ){ - $hdd_output = `$path_hddtemp -qn /dev/$disk`; - # I know 4 response possible responses: - # - # /dev/harddisk: harddisk type: S.M.A.R.T. not available - # /dev/harddisk: harddisk type: no sensor - # /dev/harddisk: harddisk type: 37?C or ?F - # 37 - - if ( index($hdd_output, "S.M.A.R.T.") != -1 ){$temp = 0;} - elsif ( index($hdd_output, "no sensor") != -1 ){$temp = 1;} - elsif ( index($hdd_output, "$disk") != -1 ){my @temp = split(/:/,$hdd_output);$temp[2] =~ s/\D//gi;$temp = $temp[2];} - else{$hdd_output =~ /(\d+)\s/;$temp = $1;} - } - elsif ( -e "/var/log/smartctl_out_hddtemp-".$array[$#array] ){ - $hdd_output = `cat /var/log/smartctl_out_hddtemp-".$array[$#array]." | grep Temperature_`; + if ( -e "/var/log/smartctl_out_hddtemp-".$array[$#array] ){ + $hdd_output = `cat /var/log/smartctl_out_hddtemp-$array[$#array] | grep Temperature_`; my @t = split(/\s+/,$hdd_output); $temp = $t[9]; }else{$temp = 0;} - print "Temperature for ".$array[$#array]."->".$temp."<-\n"; + system("echo \"Temperature for $array[$#array] -> $temp <-\n\" >>/tmp/debug"); # Nur ins RDD wenn nicht 0 (sonst klappt die min Anzeige nicht) if ($temp){ RRDs::update ("$rrdlog/hddtemp-".$array[$#array].".rrd", "-t", "temperature", "N:$temp"); @@ -419,7 +405,7 @@ sub updatehdddata } } -sub updatembmondata +sub updatembmondata { if ( ! -e "$rrdlog/mbmon.rrd" ){ # database did not exist -> create -- 2.39.2