From: maniacikarus Date: Tue, 21 Aug 2007 17:11:33 +0000 (+0000) Subject: Hddstatus auf der Media CGI nochmal ueberarbeitet X-Git-Tag: v2.3-beta1~464 X-Git-Url: http://git.ipfire.org/?p=ipfire-2.x.git;a=commitdiff_plain;h=3bc32eab4aa3e87c370c28b08682e3ec55b1dee6 Hddstatus auf der Media CGI nochmal ueberarbeitet git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@796 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- diff --git a/html/cgi-bin/media.cgi b/html/cgi-bin/media.cgi index 2cb1d4a377..19a3410759 100644 --- a/html/cgi-bin/media.cgi +++ b/html/cgi-bin/media.cgi @@ -173,6 +173,8 @@ END sub diskbox { my $disk = $_[0]; + chomp $disk; + my @status; if (-e "$Header::graphdir/disk-$disk-day.png") { &Header::openbox('100%', 'center', "Disk /dev/$disk $Lang::tr{'graph'}"); my $ftime = localtime((stat("$Header::graphdir/disk-$disk-day.png"))[9]); @@ -181,9 +183,24 @@ sub diskbox { print ""; print ""; print "
\n"; - if (-e "/usr/local/bin/hddshutdown") { - system("/usr/local/bin/hddshutdown state $disk"); - } + + if (-e "/tmp/hddstatus") { + open(DATEI, "; + close(DATEI); + + foreach (@diskstate){ + if ( $_ =~/$disk/ ){@status = split(/-/,$_);} + } + + if ( $status[1]=~/standby/){ + my $ftime = localtime((stat("/tmp/hddshutdown-$disk"))[9]); + print"Disk /dev/$disk status:".$status[1]." (since $ftime)"; + } + else{ + print"Disk /dev/$disk status:".$status[1].""; + } + } my $smart = `/usr/local/bin/smartctrl $disk`; $smart = &Header::cleanhtml($smart); print <Disk $hdd status: standby (since $ftime)"; - } -else{ - print"Disk $hdd status: active"; - } -exit; -} - if ($debug){print "### Reading Diskstats ###\n";} foreach (@proc){ @@ -54,4 +41,5 @@ $status = `hdparm -C /dev/$_ | tail -1 | cut -d: -f2`; if ( -e "/tmp/hddshutdown-$_" ) { system("unlink /tmp/hddshutdown-$_"); } } } + # end diff --git a/src/scripts/makegraphs b/src/scripts/makegraphs index 4e22159457..f98e377584 100644 --- a/src/scripts/makegraphs +++ b/src/scripts/makegraphs @@ -415,7 +415,6 @@ sub updatehdddata $ERROR = RRDs::error; print "Error in RRD::create for hdd-$disk: $ERROR\n" if $ERROR; } - $temp = 0; my $hdd_output = ''; my $smart_output = ''; @@ -564,14 +563,22 @@ updatememdata(); ### HDD graphs ### + my @disks = `kudzu -qps -c HD | grep device: | cut -d" " -f2 | sort | uniq`; +system("unlink /tmp/hddstatus && touch /tmp/hddstatus"); print "\nFound following amount of disks:".@disks."\n"; foreach (@disks){ my $disk = $_; chomp $disk; print "Working on disk ".$disk.".\n"; + updatediskdata($disk); updatehdddata($disk); + +my $status = `hdparm -C /dev/$disk | tail -1 | cut -d: -f2`; +open(DATEI, ">>/tmp/hddstatus") || die "Datei nicht gefunden"; +print DATEI $disk."-".$status; +close(DATEI); } ###