$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'} = {
'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',
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'},
};
$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'},
};
+
my %subfirewallhash = ();
my $subfirewall = \%subfirewallhash;
$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'} = {
$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'} = {
'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;
};
$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'} = {
};
$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
};
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
* 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
} 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 "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
+ print "<a href='/cgi-bin/graphs.cgi?graph=disk-$disk'>";
+ print "<img src='/graphs/disk-$disk-day.png' border='0' />";
+ print "</a>";
+ print "<br />\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)/) {
}
print "<br />\n";
&Header::closebox();
+
+ diskbox("hda");
+ diskbox("hdb");
+ diskbox("hdc");
+ diskbox("hdd");
+ diskbox("hde");
+ diskbox("hdf");
+ diskbox("hdg");
+ diskbox("hdh");
}
&Header::closebigbox();
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)$/) {
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'};
}
$selected{'DTERATE'}{'57600'} = '';
$selected{'DTERATE'}{'115200'} = '';
$selected{'DTERATE'}{'230400'} = '';
+$selected{'DTERATE'}{'460800'} = '';
$selected{'DTERATE'}{$pppsettings{'DTERATE'}} = "selected='selected'";
$checked{'SPEAKER'}{'off'} = '';
<option value='57600' $selected{'DTERATE'}{'57600'}>57600</option>
<option value='115200' $selected{'DTERATE'}{'115200'}>115200</option>
<option value='230400' $selected{'DTERATE'}{'230400'}>230400</option>
+ <option value='460800' $selected{'DTERATE'}{'460800'}>460800</option>
</select></td>
</tr>
END
'advproxy update notification' => 'Update-Benachrichtigung!',
'advproxy update information' => 'Eine aktualisierte Version steht zum Download bereit. Besuchen Sie <a href="http://www.advproxy.net" target="_blank">http://www.advproxy.net</a> für weitere Informationen.',
'linkq' => 'Verbindungsqualität',
+'empty profile' => 'Unbenannt',
);
'advproxy update notification' => 'Update notification!',
'advproxy update information' => 'There is an updated version available for download. Visit <a href="http://www.advproxy.net" target="_blank">http://www.advproxy.net</a> for more information.',
'linkq' => 'Link Quality',
+'empty profile' => 'empty',
);
-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
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
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
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
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
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
--- /dev/null
+#!/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 = <STAT>;
+ 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 = <STAT>;
+ 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 = <STAT>;
+ 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
--- /dev/null
+#!/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 = <STAT>;
+ 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"<B>Disk $hdddev status:</B> unknown"
+
+ }
+
+ if ( -e "/tmp/hddshutdown-$hdd" ) {
+ open STAT,"/tmp/hddshutdown-$hdd";
+ my $lastsleepstate = <STAT>;
+ close (STAT);
+ my $ftime = localtime((stat("/tmp/hddshutdown-$hdd"))[9]);
+ if (! ($lastsleepstate==$readwritereq)) {
+ print"<B>Disk $hdddev status: <font color=#FF0000>active</font></B>";
+ }
+ if ( ($lastsleepstate==$readwritereq)) {
+ print"<B>Disk $hdddev status: <font color=#00FF00>standby</font></B> (since $ftime)";
+ }
+
+}
+
+
+
+# end
}
}
+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 = <STAT>;
+ 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 = <STAT>;
+ 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];
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
###