From: ms Date: Mon, 5 Jun 2006 17:35:00 +0000 (+0000) Subject: Hinzugefügt: X-Git-Tag: v2.3-beta1~1092 X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=commitdiff_plain;h=6c666a3b18d7be66ac62c3cfef389745a6eed0a4 Hinzugefügt: * HDDGraphs für mehrere Festplatten * Höhere Baudrate in pppsetup.cgi Geändert: * Sprachen auf DE und EN reduziert. git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@162 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- diff --git a/config/cfgroot/header.pl b/config/cfgroot/header.pl index 3d84c1cc28..d07a2133a4 100644 --- a/config/cfgroot/header.pl +++ b/config/cfgroot/header.pl @@ -159,13 +159,13 @@ sub genmenu { $substatus->{'01.systemstatus'} = { 'caption' => $tr{'sssystem status'}, 'uri' => '/cgi-bin/status.cgi', - 'title' => "$tr{'system status information'}", + 'title' => "$tr{'sssystem status'}", 'enabled' => 1, }; $substatus->{'02.networkstatus'} = { 'caption' => $tr{'ssnetwork status'}, 'uri' => '/cgi-bin/netstatus.cgi', - 'title' => "$tr{'network status information'}", + 'title' => "$tr{'ssnetwork status'}", 'enabled' => 1, }; $substatus->{'03.systemgraphs'} = { @@ -179,21 +179,33 @@ sub genmenu { 'caption' => $tr{'sstraffic graphs'}, 'uri' => '/cgi-bin/graphs.cgi', 'vars' => 'graph=network', - 'title' => "$tr{'network traffic graphs'}", + 'title' => "$tr{'sstraffic graphs'}", 'enabled' => 1, }; $substatus->{'05.proxygraphs'} = { 'caption' => $tr{'ssproxy graphs'}, 'uri' => '/cgi-bin/proxygraphs.cgi', - 'title' => "$tr{'proxy access graphs'}", + 'title' => "$tr{'ssproxy graphs'}", 'enabled' => 1, }; - $substatus->{'06.connections'} = { + $substatus->{'06.fwhits'} = { + 'caption' => 'Firewallhits', + 'uri' => '/cgi-bin/fwhits.cgi', + 'title' => "IPFire Firewallhits", + 'enabled' => 1, + }; + $substatus->{'07.connections'} = { 'caption' => $tr{'connections'}, 'uri' => '/cgi-bin/connections.cgi', 'title' => "$tr{'connections'}", 'enabled' => 1, }; + $substatus->{'08.nettraf'} = { + 'caption' => $tr{'sstraffic'}, + 'uri' => '/cgi-bin/traffic.cgi', + 'title' => "$tr{'sstraffic'}", + 'enabled' => 1, + }; $substatus->{'99.iptfilters'} = { 'caption' => $tr{'iptfilters iptable rules'}, 'uri' => '/cgi-bin/iptfilters.cgi', @@ -204,72 +216,65 @@ sub genmenu { my %subnetworkhash = (); my $subnetwork = \%subnetworkhash; - $subnetwork->{'01.dialup'} = { + $subnetwork->{'01.proxy'} = {'caption' => 'Webproxy', + 'uri' => '/cgi-bin/proxy.cgi', + 'title' => "Webproxy", + 'enabled' => 1, + }; + $subnetwork->{'02.urlfilter'} = {'caption' => 'URL-Filter', + 'uri' => '/cgi-bin/urlfilter.cgi', + 'title' => "URL-Filter", + 'enabled' => 1, + }; + $subnetwork->{'03.dhcp'} = {'caption' => $tr{'dhcp server'}, + 'uri' => '/cgi-bin/dhcp.cgi', + 'title' => "$tr{'dhcp server'}", + 'enabled' => 1, + }; + $subnetwork->{'04.dialup'} = { 'caption' => $tr{'alt dialup'}, 'uri' => '/cgi-bin/pppsetup.cgi', - 'title' => "$tr{'dialup settings'}", + 'title' => "$tr{'alt dialup'}", 'enabled' => 1, }; - $subnetwork->{'02.hosts'} = { + $subnetwork->{'05.hosts'} = { 'caption' => $tr{'edit hosts'}, 'uri' => '/cgi-bin/hosts.cgi', - 'title' => "$tr{'host configuration'}", + 'title' => "$tr{'edit hosts'}", 'enabled' => 1, }; - $subnetwork->{'03.upload'} = { + $subnetwork->{'06.upload'} = { 'caption' => $tr{'upload'}, 'uri' => '/cgi-bin/upload.cgi', - 'title' => "$tr{'firmware upload'}", + 'title' => "$tr{'upload'}", 'enabled' => 0, }; - $subnetwork->{'04.aliases'} = { + $subnetwork->{'07.aliases'} = { 'caption' => $tr{'aliases'}, 'uri' => '/cgi-bin/aliases.cgi', - 'title' => "$tr{'external aliases configuration'}", + 'title' => "$tr{'aliases'}", 'enabled' => 1, }; - $subnetwork->{'05.nettraf'} = { - 'caption' => $tr{'sstraffic'}, - 'uri' => '/cgi-bin/traffic.cgi', - 'title' => "$tr{'sstraffic'}", - 'enabled' => 1, - }; - $subnetwork->{'06.fwhits'} = { - 'caption' => 'Firewallhits', - 'uri' => '/cgi-bin/fwhits.cgi', - 'title' => "IPFire Firewallhits", - 'enabled' => 1, - }; - $subnetwork->{'07.openvpn'} = { - 'caption' => 'OpenVPN', - 'uri' => '/cgi-bin/ovpnmain.cgi', - 'title' => "$tr{'virtual private networking'}", - 'enabled' => 1, - }; - $subnetwork->{'08.ipsec'} = { - 'caption' => 'IPSec', - 'uri' => '/cgi-bin/vpnmain.cgi', - 'title' => "$tr{'virtual private networking'}", - 'enabled' => 1, - }; - my %subserviceshash = (); my $subservices = \%subserviceshash; - $subservices->{'01.proxy'} = {'caption' => $tr{'proxy'}, - 'uri' => '/cgi-bin/proxy.cgi', - 'title' => "HTTP: $tr{'web proxy configuration'}", - 'enabled' => 1, - }; - $subservices->{'02.dhcp'} = {'caption' => $tr{'dhcp server'}, - 'uri' => '/cgi-bin/dhcp.cgi', - 'title' => "$tr{'dhcp configuration'}", - 'enabled' => 1, - }; + + $subservices->{'01.openvpn'} = { + 'caption' => 'OpenVPN', + 'uri' => '/cgi-bin/ovpnmain.cgi', + 'title' => "$tr{'virtual private networking'}", + 'enabled' => 1, + }; + $subservices->{'02.ipsec'} = { + 'caption' => 'IPSec', + 'uri' => '/cgi-bin/vpnmain.cgi', + 'title' => "$tr{'virtual private networking'}", + 'enabled' => 1, + }; $subservices->{'03.dyndns'} = {'caption' => $tr{'dynamic dns'}, 'uri' => '/cgi-bin/ddns.cgi', - 'title' => "$tr{'dynamic dns client'}", + 'title' => "$tr{'dynamic dns'}", 'enabled' => 1, }; $subservices->{'04.time'} = {'caption' => $tr{'time server'}, @@ -279,7 +284,7 @@ sub genmenu { }; $subservices->{'05.qos'} = {'caption' => 'Quality of Service', 'uri' => '/cgi-bin/qos.cgi', - 'title' => "$tr{'traffic shaping settings'}", + 'title' => "Quality of Service", 'enabled' => 1, }; $subservices->{'06.ids'} = {'caption' => $tr{'intrusion detection'}, @@ -289,6 +294,7 @@ sub genmenu { }; + my %subfirewallhash = (); my $subfirewall = \%subfirewallhash; @@ -296,13 +302,13 @@ sub genmenu { $subfirewall->{'01.dnat'} = { 'caption' => $tr{'ssport forwarding'}, 'uri' => '/cgi-bin/portfw.cgi', - 'title' => "$tr{'port forwarding configuration'}", + 'title' => "$tr{'ssport forwarding'}", 'enabled' => 1, }; $subfirewall->{'02.xtaccess'} = { 'caption' => $tr{'external access'}, 'uri' => '/cgi-bin/xtaccess.cgi', - 'title' => "$tr{'external access configuration'}", + 'title' => "$tr{'external access'}", 'enabled' => 1, }; $subfirewall->{'03.wireless'} = { @@ -314,7 +320,7 @@ sub genmenu { $subfirewall->{'04.dmz'} = { 'caption' => $tr{'ssdmz pinholes'}, 'uri' => '/cgi-bin/dmzholes.cgi', - 'title' => "$tr{'dmz pinhole configuration'}", + 'title' => "$tr{'ssdmz pinhole'}", 'enabled' => 1, }; $subfirewall->{'05.outgoing'} = { @@ -323,6 +329,12 @@ sub genmenu { 'title' => "$tr{'outgoing firewall'}", 'enabled' => 1, }; + $subfirewall->{'06.fwopts'} = { + 'caption' => $tr{'options fw'}, + 'uri' => '/cgi-bin/optionsfw.cgi', + 'title' => "$tr{'options fw'}", + 'enabled' => 1, + }; my %sublogshash = (); my $sublogs = \%sublogshash; @@ -339,17 +351,17 @@ sub genmenu { }; $sublogs->{'03.proxy'} = {'caption' => $tr{'proxy logs'}, 'uri' => '/cgi-bin/logs.cgi/proxylog.dat', - 'title' => "$tr{'proxy log viewer'}", + 'title' => "$tr{'proxy log'}", 'enabled' => 1 }; $sublogs->{'04.firewall'} = {'caption' => $tr{'firewall logs'}, 'uri' => '/cgi-bin/logs.cgi/firewalllog.dat', - 'title' => "$tr{'firewall log viewer'}", + 'title' => "$tr{'firewall logs'}", 'enabled' => 1 }; $sublogs->{'05.ids'} = {'caption' => $tr{'ids logs'}, 'uri' => '/cgi-bin/logs.cgi/ids.dat', - 'title' => "$tr{'intrusion detection system log viewer'}", + 'title' => "$tr{'ids logs'}", 'enabled' => 1 }; $sublogs->{'07.urlfilter'} = { @@ -365,12 +377,12 @@ sub genmenu { }; $sublogs->{'09.system'} = {'caption' => $tr{'system logs'}, 'uri' => '/cgi-bin/logs.cgi/log.dat', - 'title' => "$tr{'system log viewer'}", + 'title' => "$tr{'system log'}", 'enabled' => 1 }; $sublogs->{'10.userlog'} = {'caption' => $tr{'user proxy logs'}, 'uri' => '/cgi-bin/logs.cgi/userlog.dat', - 'title' => "$tr{'user log viewer'}", + 'title' => "$tr{'user log'}", 'enabled' => 1 }; diff --git a/config/cron/crontab b/config/cron/crontab index f51a686a4d..9b08f06c40 100644 --- a/config/cron/crontab +++ b/config/cron/crontab @@ -31,3 +31,6 @@ HOME=/ 01 0 * * * /usr/local/bin/logwatch > /var/log/logwatch/`date -I -d yesterday`; \ LOGWATCH_KEEP=$(sed -ne 's/^LOGWATCH_KEEP=\([0-9]\+\)$/\1/p' /var/ipfire/logging/settings); \ find /var/log/logwatch/ -ctime +${LOGWATCH_KEEP=56} -exec rm -f '{}' ';' + +# hddshutdown +00 * * * * /usr/local/bin/hddshutdown >/dev/null \ No newline at end of file diff --git a/doc/packages-list.txt b/doc/packages-list.txt index 85e547b0d0..752c2e8000 100644 --- a/doc/packages-list.txt +++ b/doc/packages-list.txt @@ -197,7 +197,6 @@ * snort-2.3.3 * spandsp-0.0.2pre25 * speedtouch-1.2 - * squid-2.5.STABLE13_1st * squid-2.5.STABLE14 * squid-graph-3.1 * startscripts diff --git a/html/cgi-bin/graphs.cgi b/html/cgi-bin/graphs.cgi index f19e5a618e..8f590d35cb 100644 --- a/html/cgi-bin/graphs.cgi +++ b/html/cgi-bin/graphs.cgi @@ -40,6 +40,25 @@ if ($cgigraphs[1] =~ /(network|GREEN|BLUE|ORANGE|RED|lq)/) { } else { &Header::openpage($Lang::tr{'system graphs'}, 1, ''); } + +sub diskbox { + my $disk = $_[0]; + if (-e "$graphdir/disk-$disk-day.png") { + + &Header::openbox('100%', 'center', "Disk /dev/$disk $Lang::tr{'graph'}"); + my $ftime = localtime((stat("$graphdir/disk-$disk-day.png"))[9]); + print "
$Lang::tr{'the statistics were last updated at'}: $ftime

\n"; + print ""; + print ""; + print ""; + print "
\n"; + if (-e "/usr/local/bin/hddshutdown-state") { + system("/usr/local/bin/hddshutdown-state $disk"); + } + &Header::closebox(); + } +} + &Header::openbigbox('100%', 'left'); if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED|lq|cpu|memory|swap|disk)/) { @@ -143,6 +162,15 @@ if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED|lq|cpu|memory|swap|disk)/) { } print "
\n"; &Header::closebox(); + + diskbox("hda"); + diskbox("hdb"); + diskbox("hdc"); + diskbox("hdd"); + diskbox("hde"); + diskbox("hdf"); + diskbox("hdg"); + diskbox("hdh"); } &Header::closebigbox(); diff --git a/html/cgi-bin/pppsetup.cgi b/html/cgi-bin/pppsetup.cgi index 66f8c92141..aca632bdcb 100644 --- a/html/cgi-bin/pppsetup.cgi +++ b/html/cgi-bin/pppsetup.cgi @@ -64,7 +64,7 @@ elsif ($pppsettings{'ACTION'} eq $Lang::tr{'save'}) if ($pppsettings{'TYPE'} =~ /^(modem|serial|isdn)$/ && $pppsettings{'COMPORT'} !~ /^(ttyS0|ttyS1|ttyS2|ttyS3|ttyS4|usb\/ttyACM0|usb\/ttyACM1|usb\/ttyACM2|usb\/ttyACM3|isdn1|isdn2)$/) { $errormessage = $Lang::tr{'invalid input'}; goto ERROR; } - if ($pppsettings{'TYPE'} =~ /^(modem|serial)$/ && $pppsettings{'DTERATE'} !~ /^(9600|19200|38400|57600|115200|230400)$/) { + if ($pppsettings{'TYPE'} =~ /^(modem|serial)$/ && $pppsettings{'DTERATE'} !~ /^(9600|19200|38400|57600|115200|230400|460800)$/) { $errormessage = $Lang::tr{'invalid input'}; goto ERROR; } if ($pppsettings{'TYPE'} eq 'modem' && $pppsettings{'DIALMODE'} !~ /^(T|P)$/) { @@ -321,7 +321,7 @@ my $c=0; for ($c = 1; $c <= $maxprofiles; $c++) { %temppppsettings = (); - $temppppsettings{'PROFILENAME'} = $Lang::tr{'empty'}; + $temppppsettings{'PROFILENAME'} = $Lang::tr{'empty profile'}; &General::readhash("${General::swroot}/ppp/settings-$c", \%temppppsettings); $profilenames[$c] = $temppppsettings{'PROFILENAME'}; } @@ -381,6 +381,7 @@ $selected{'DTERATE'}{'38400'} = ''; $selected{'DTERATE'}{'57600'} = ''; $selected{'DTERATE'}{'115200'} = ''; $selected{'DTERATE'}{'230400'} = ''; +$selected{'DTERATE'}{'460800'} = ''; $selected{'DTERATE'}{$pppsettings{'DTERATE'}} = "selected='selected'"; $checked{'SPEAKER'}{'off'} = ''; @@ -594,6 +595,7 @@ END + END diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index c0738a7489..19712fb418 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -1266,6 +1266,7 @@ 'advproxy update notification' => 'Update-Benachrichtigung!', 'advproxy update information' => 'Eine aktualisierte Version steht zum Download bereit. Besuchen Sie http://www.advproxy.net für weitere Informationen.', 'linkq' => 'Verbindungsqualität', +'empty profile' => 'Unbenannt', ); diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index 14f654008a..7022f234b6 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -1299,5 +1299,6 @@ 'advproxy update notification' => 'Update notification!', 'advproxy update information' => 'There is an updated version available for download. Visit http://www.advproxy.net for more information.', 'linkq' => 'Link Quality', +'empty profile' => 'empty', ); diff --git a/langs/list b/langs/list index e1b7086782..ee223dd8b3 100644 --- a/langs/list +++ b/langs/list @@ -1,29 +1,2 @@ -bz:Brazilian Portuguese:Português-Brasil -zh:Chinese Simplified:中文-简 -zt:Chinese Traditional:中文-繁 -cs:Czech:Čeština -da:Danish:Dansk -nl:Dutch:Nederlands en:English:English -fi:Finnish:Suomi -fr:French:Français de:German:Deutsch -el:Greek:Ellinika -hu:Hungarian:Magyar -it:Italian:Italiano -lt:Lithuanian:Lietuvių -no:Norwegian:Norsk -fa:Persian:Farsi -pl:Polish:Polski -pt:Portuguese:Português -ro:Romanian:Română -ru:Russian:Russkij -sk:Slovak:Slovenčina -sl:Slovenian:Slovinsko -so:Somali:Soomali -es:Spanish:Español -la:Spanish Latino:Español latinoamericano -sv:Swedish:Svenska -th:Thai:ภาษาไทย -tr:Turkish:Türkçe -vi:Vietnamese:Tiếng Việt diff --git a/make.sh b/make.sh index cc7a80fa97..fe8fa3b038 100644 --- a/make.sh +++ b/make.sh @@ -694,9 +694,9 @@ buildipcop() { ipcopmake bridge-utils echo -ne "`date -u '+%b %e %T'`: Building ### Mailserver ### \n" | tee -a $LOGFILE ipcopmake postfix + ipcopmake procmail ipcopmake fetchmail ipcopmake cyrusimap - ipcopmake procmail ipcopmake mailx ipcopmake clamav ipcopmake razor diff --git a/src/ROOTFILES.i386 b/src/ROOTFILES.i386 index e064e7c3b1..41eec05552 100644 --- a/src/ROOTFILES.i386 +++ b/src/ROOTFILES.i386 @@ -1363,7 +1363,7 @@ usr/local/bin/settime usr/local/bin/timecheck usr/local/bin/timecheckctrl #usr/local/bin/tunerrd.pl -#usr/local/bin/updatelists.pl +usr/local/bin/logtailfwhits usr/local/bin/resetusb #usr/local/doc #usr/local/etc @@ -22522,6 +22522,7 @@ usr/local/bin/restartsnort usr/local/bin/restartsquid usr/local/bin/restartssh usr/local/bin/restartsyslogd +usr/local/bin/restartwireless usr/local/bin/setaliases usr/local/bin/setdate usr/local/bin/setdmzholes diff --git a/src/misc-progs/Makefile b/src/misc-progs/Makefile index 06c98eaf4b..ce04fb1599 100644 --- a/src/misc-progs/Makefile +++ b/src/misc-progs/Makefile @@ -9,8 +9,7 @@ SUID_PROGS = setdmzholes setportfw setfilters setxtaccess restartdhcp restartsno ipfirebkcfg ipfirerscfg installpackage installfcdsl ipsecctrl \ setaliases ipfirebackup restartntpd \ restartapplejuice setdate rebuildhosts \ - restartsyslogd logwatch openvpnctrl timecheckctrl - # restartwireless + restartsyslogd logwatch openvpnctrl timecheckctrl restartwireless install : all install -m 755 $(PROGS) /usr/local/bin diff --git a/src/rc.d/rc.sysinit b/src/rc.d/rc.sysinit index 544873b221..21e589a10c 100644 --- a/src/rc.d/rc.sysinit +++ b/src/rc.d/rc.sysinit @@ -236,6 +236,34 @@ if [ -e /var/log/rrd/disk.rrd ]; then echo "Adjusting graphs to compensate for boot" /usr/bin/perl -e 'use RRDs;RRDs::update("/var/log/rrd/disk.rrd","-t","readsect:writesect","N:U:U");' fi +if [ -e /var/log/rrd/disk-hda.rrd ]; then + /usr/bin/perl -e 'use RRDs;RRDs::update("/var/log/rrd/disk-hda.rrd","-t","readsect:writesect:sleeping","N:U:U:U");' +fi +if [ -e /var/log/rrd/disk-hdb.rrd ]; then + /usr/bin/perl -e 'use RRDs;RRDs::update("/var/log/rrd/disk-hdb.rrd","-t","readsect:writesect:sleeping","N:U:U:U");' +fi +if [ -e /var/log/rrd/disk-hdc.rrd ]; then + /usr/bin/perl -e 'use RRDs;RRDs::update("/var/log/rrd/disk-hdc.rrd","-t","readsect:writesect:sleeping","N:U:U:U");' +fi +if [ -e /var/log/rrd/disk-hdd.rrd ]; then + /usr/bin/perl -e 'use RRDs;RRDs::update("/var/log/rrd/disk-hdd.rrd","-t","readsect:writesect:sleeping","N:U:U:U");' +fi +if [ -e /var/log/rrd/disk-hde.rrd ]; then + /usr/bin/perl -e 'use RRDs;RRDs::update("/var/log/rrd/disk-hde.rrd","-t","readsect:writesect:sleeping","N:U:U:U");' +fi +if [ -e /var/log/rrd/disk-hdf.rrd ]; then + /usr/bin/perl -e 'use RRDs;RRDs::update("/var/log/rrd/disk-hdf.rrd","-t","readsect:writesect:sleeping","N:U:U:U");' +fi +if [ -e /var/log/rrd/disk-hdg.rrd ]; then + /usr/bin/perl -e 'use RRDs;RRDs::update("/var/log/rrd/disk-hdg.rrd","-t","readsect:writesect:sleeping","N:U:U:U");' +fi +if [ -e /var/log/rrd/disk-hdh.rrd ]; then + /usr/bin/perl -e 'use RRDs;RRDs::update("/var/log/rrd/disk-hdh.rrd","-t","readsect:writesect:sleeping","N:U:U:U");' +fi +if [ -e /tmp/hddshutdown-stat ] ; then + rm /tmp/hddshutdown-*" +fi +/usr/local/bin/hddshutdown echo "Starting crond" /usr/sbin/fcron diff --git a/src/scripts/hddshutdown b/src/scripts/hddshutdown new file mode 100644 index 0000000000..ebd5257107 --- /dev/null +++ b/src/scripts/hddshutdown @@ -0,0 +1,117 @@ +#!/usr/bin/perl +# +# IPFire HDD Shutdown +# +# This code is distributed under the terms of the GPL +# +# 13.05.2006 Arne Fitzenreiter +# + +# begin + +sub shutdown_hdd { + + my $hdd = $_[0]; + my $hdddev = "/dev/$_[0]"; + + my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, + $atime, $mtime, $ctime, $blksize, $blocks) = stat($hdddev); + + my $major = $rdev >> 8; + my $minor = ($rdev & 0xFF) >> 6; + + open STAT, "/tmp/hddshutdown-stat"; + my @diskstat = ; + close (STAT); + foreach my $line (@diskstat) + { + chomp ($line); + my @temp = split(/\:\ /,$line); + if ($temp[1]) { + my @devicestat = split(/\ /,$temp[1]); + foreach my $stats (@devicestat) + { + chomp ($stats); + my @fields = split(/\((\d+),(\d+)\):\((\d+),(\d+),(\d+),(\d+),(\d+)/,$stats); + if ($major eq $fields[1] and $minor eq $fields[2]) + { + $lastreadwritereq = $fields[3]; + } + } + } + } + + open STAT, "/proc/stat"; + my @diskstat = ; + close (STAT); + foreach my $line (@diskstat) + { + chomp ($line); + my @temp = split(/\:\ /,$line); + if ($temp[1]) { + my @devicestat = split(/\ /,$temp[1]); + foreach my $stats (@devicestat) + { + chomp ($stats); + my @fields = split(/\((\d+),(\d+)\):\((\d+),(\d+),(\d+),(\d+),(\d+)/,$stats); + if ($major eq $fields[1] and $minor eq $fields[2]) + { + $readwritereq = $fields[3]; + } + } + } + } + + if (! -e "/tmp/hddshutdown-$hdd" ) { system("echo 0 > /tmp/hddshutdown-$hdd"); } + + if ($readwritereq==$lastreadwritereq) { + open STAT,"/tmp/hddshutdown-$hdd"; + my $lastsleepstate = ; + close (STAT); + if (! ($lastsleepstate==$readwritereq)) { + system("hdparm -y $hdddev"); + system("logger -t ipcop Shuting down $hdddev !"); + system("echo $readwritereq > /tmp/hddshutdown-$hdd"); + } + } + +} + +if ( -e "/tmp/hddshutdown-stat" ) { + if (open STAT,"/dev/hda") { + close STAT; + shutdown_hdd("hda"); + } + if (open STAT,"/dev/hdb") { + close STAT; + shutdown_hdd("hdb"); + } + if (open STAT,"/dev/hdc") { + close STAT; + shutdown_hdd("hdc"); + } + if (open STAT,"/dev/hdd") { + close STAT; + shutdown_hdd("hdd"); + } + if (open STAT,"/dev/hde") { + close STAT; + shutdown_hdd("hde"); + } + if (open STAT,"/dev/hdf") { + close STAT; + shutdown_hdd("hdf"); + } + if (open STAT,"/dev/hdg") { + close STAT; + shutdown_hdd("hdg"); + } + if (open STAT,"/dev/hdh") { + close STAT; + shutdown_hdd("hdh"); + } + +} + +system("cp /proc/stat /tmp/hddshutdown-stat"); +# end diff --git a/src/scripts/hddshutdown-state b/src/scripts/hddshutdown-state new file mode 100644 index 0000000000..d5cf333039 --- /dev/null +++ b/src/scripts/hddshutdown-state @@ -0,0 +1,63 @@ +#!/usr/bin/perl +# +# IPFire HDD Shutdown state reader +# +# This code is distributed under the terms of the GPL +# +# 11.05.2006 Arne Fitzenreiter +# + +# begin + +my $hdd = @ARGV[0]; +my $hdddev = "/dev/$hdd"; + +my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, + $atime, $mtime, $ctime, $blksize, $blocks) = stat($hdddev); + +my $major = $rdev >> 8; +my $minor = ($rdev & 0xFF) >> 6; + + open STAT, "/proc/stat"; + my @diskstat = ; + close (STAT); + foreach my $line (@diskstat) + { + chomp ($line); + my @temp = split(/\:\ /,$line); + if ($temp[1]) { + my @devicestat = split(/\ /,$temp[1]); + foreach my $stats (@devicestat) + { + chomp ($stats); + my @fields = split(/\((\d+),(\d+)\):\((\d+),(\d+),(\d+),(\d+),(\d+)/,$stats); + if ($major eq $fields[1] and $minor eq $fields[2]) + { + $readwritereq = $fields[3]; + } + } + } + } + + if (! -e "/tmp/hddshutdown-$hdd" ) { + print"Disk $hdddev status: unknown" + + } + + if ( -e "/tmp/hddshutdown-$hdd" ) { + open STAT,"/tmp/hddshutdown-$hdd"; + my $lastsleepstate = ; + close (STAT); + my $ftime = localtime((stat("/tmp/hddshutdown-$hdd"))[9]); + if (! ($lastsleepstate==$readwritereq)) { + print"Disk $hdddev status: active"; + } + if ( ($lastsleepstate==$readwritereq)) { + print"Disk $hdddev status: standby (since $ftime)"; + } + +} + + + +# end diff --git a/src/scripts/makegraphs b/src/scripts/makegraphs index 1120fd8488..1ea6dc349f 100644 --- a/src/scripts/makegraphs +++ b/src/scripts/makegraphs @@ -341,6 +341,107 @@ sub updatediskdata { } } +sub updatediskgraphnew { + my $disk = $_[0]; + my $period = $_[1]; + + RRDs::graph ("$graphs/disk-$disk-$period.png", + "--start", "-1$period", "-aPNG", "-i", "-z", + "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-r", + "--color", "SHADEA#EAE9EE", + "--color", "SHADEB#EAE9EE", + "--color", "BACK#FFFFFF", + "-t $tr{'disk access per'} $tr{$period}", + "DEF:read=$rrdlog/disk-$disk.rrd:readsect:AVERAGE", + "DEF:write=$rrdlog/disk-$disk.rrd:writesect:AVERAGE", + "DEF:sleep=$rrdlog/disk-$disk.rrd:sleeping:AVERAGE", + "CDEF:sl_state=sleep,INF,*", + + "AREA:sl_state#a0a0a0:disk standby\\j", + "AREA:read#0000FF:$tr{'sectors read from disk per second'}\\j", + "STACK:write#00FF00:$tr{'sectors written to disk per second'}\\j", + + "GPRINT:read:MAX:$tr{'maximal'} $tr{'read sectors'}\\:%8.0lf", + "GPRINT:read:AVERAGE:$tr{'average'} $tr{'read sectors'}\\:%8.0lf", + "GPRINT:read:LAST:$tr{'current'} $tr{'read sectors'}\\:%8.0lf\\j", + "GPRINT:write:MAX:$tr{'maximal'} $tr{'written sectors'}\\:%8.0lf", + "GPRINT:write:AVERAGE:$tr{'average'} $tr{'written sectors'}\\:%8.0lf", + "GPRINT:write:LAST:$tr{'current'} $tr{'written sectors'}\\:%8.0lf\\j"); + $ERROR = RRDs::error; + print "Error in RRD::graph for disk-$disk: $ERROR\n" if $ERROR; +} + +sub updatediskdatanew { + my $disk = $_[0]; + + my ($readwritereq, $readreq, $readsect, $writereq, $writesect); + if ( ! -e "$rrdlog/disk-$disk.rrd") { + RRDs::create ("$rrdlog/disk-$disk.rrd", "--step=300", + "DS:readsect:COUNTER:600:0:5000000000", + "DS:writesect:COUNTER:600:0:5000000000", + "DS:sleeping:GAUGE:600:0:1", + "RRA:AVERAGE:0.5:1:576", + "RRA:AVERAGE:0.5:6:672", + "RRA:AVERAGE:0.5:24:732", + "RRA:AVERAGE:0.5:144:1460"); + $ERROR = RRDs::error; + print "Error in RRD::create for disk-$disk: $ERROR\n" if $ERROR; + } + + my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, + $atime, $mtime, $ctime, $blksize, $blocks) = stat("/dev/$disk"); + + my $major = $rdev >> 8; + my $minor = ($rdev & 0xFF) >>6; + + open STAT, "/proc/stat"; + my @diskstat = ; + close (STAT); + foreach my $line (@diskstat) + { + chomp ($line); + my @temp = split(/\:\ /,$line); + if ($temp[1]) { + my @devicestat = split(/\ /,$temp[1]); + foreach my $stats (@devicestat) + { + chomp ($stats); + my @fields = split(/\((\d+),(\d+)\):\((\d+),(\d+),(\d+),(\d+),(\d+)/,$stats); + if ($major eq $fields[1] and $minor eq $fields[2]) + { + $readwritereq = $fields[3]; + $readreq = $fields[4]; + $readsect = $fields[5]; + $writereq = $fields[6]; + $writesect = $fields[7]; + } + } + } + } + + my $sleeping=0; + my $lastsleepstate=0; + + if ( -e "/tmp/hddshutdown-$disk" ) { + open STAT,"/tmp/hddshutdown-$disk"; + $lastsleepstate = ; + close (STAT); + if ($lastsleepstate==$readwritereq) { + $sleeping=1; + } + } + + if ($readsect && $writesect) { + RRDs::update ("$rrdlog/disk-$disk.rrd", + "-t", "readsect:writesect:sleeping", + "N:$readsect:$writesect:$sleeping"); + $ERROR = RRDs::error; + print "Error in RRD::update for disk-$disk: $ERROR\n" if $ERROR; + } else { + print "Error in RRD::update for disk-$disk: no data available\n"; + } +} + sub updateifgraph { my $interface = $_[0]; my $period = $_[1]; @@ -627,6 +728,110 @@ updatediskgraph ("week"); updatediskgraph ("month"); updatediskgraph ("year"); +if (open STAT,"/dev/hda") { + close STAT; + updatediskdatanew ("hda"); + updatediskgraphnew ("hda","day"); + updatediskgraphnew ("hda","week"); + updatediskgraphnew ("hda","month"); + updatediskgraphnew ("hda","year"); +} else { + if (-e "$graphs/disk-hda-day.png") { + system("rm $graphs/disk-hda-day.png"); + } +} + +if (open STAT,"/dev/hdb") { + close STAT; + updatediskdatanew ("hdb"); + updatediskgraphnew ("hdb","day"); + updatediskgraphnew ("hdb","week"); + updatediskgraphnew ("hdb","month"); + updatediskgraphnew ("hdb","year"); +} else { + if (-e "$graphs/disk-hdb-day.png") { + system("rm $graphs/disk-hdb-day.png"); + } +} + +if (open STAT,"/dev/hdc") { + close STAT; + updatediskdatanew ("hdc"); + updatediskgraphnew ("hdc","day"); + updatediskgraphnew ("hdc","week"); + updatediskgraphnew ("hdc","month"); + updatediskgraphnew ("hdc","year"); +} else { + if (-e "$graphs/disk-hdc-day.png") { + system("rm $graphs/disk-hdc-day.png"); + } +} + +if (open STAT,"/dev/hdd") { + close STAT; + updatediskdatanew ("hdd"); + updatediskgraphnew ("hdd","day"); + updatediskgraphnew ("hdd","week"); + updatediskgraphnew ("hdd","month"); + updatediskgraphnew ("hdd","year"); +} else { + if (-e "$graphs/disk-hdd-day.png") { + system("rm $graphs/disk-hdd-day.png"); + } +} + +if (open STAT,"/dev/hde") { + close STAT; + updatediskdatanew ("hde"); + updatediskgraphnew ("hde","day"); + updatediskgraphnew ("hde","week"); + updatediskgraphnew ("hde","month"); + updatediskgraphnew ("hde","year"); +} else { + if (-e "$graphs/disk-hde-day.png") { + system("rm $graphs/disk-hde-day.png"); + } +} + +if (open STAT,"/dev/hdf") { + close STAT; + updatediskdatanew ("hdf"); + updatediskgraphnew ("hdf","day"); + updatediskgraphnew ("hdf","week"); + updatediskgraphnew ("hdf","month"); + updatediskgraphnew ("hdf","year"); +} else { + if (-e "$graphs/disk-hdf-day.png") { + system("rm $graphs/disk-hdf-day.png"); + } +} + +if (open STAT,"/dev/hdg") { + close STAT; + updatediskdatanew ("hdg"); + updatediskgraphnew ("hdg","day"); + updatediskgraphnew ("hdg","week"); + updatediskgraphnew ("hdg","month"); + updatediskgraphnew ("hdg","year"); +} else { + if (-e "$graphs/disk-hdg-day.png") { + system("rm $graphs/disk-hdg-day.png"); + } +} + +if (open STAT,"/dev/hdh") { + close STAT; + updatediskdatanew ("hdh"); + updatediskgraphnew ("hdh","day"); + updatediskgraphnew ("hdh","week"); + updatediskgraphnew ("hdh","month"); + updatediskgraphnew ("hdh","year"); +} else { + if (-e "$graphs/disk-hdh-day.png") { + system("rm $graphs/disk-hdh-day.png"); + } +} + ### ### Firewallhits ###