From: ms Date: Thu, 26 Apr 2007 08:12:20 +0000 (+0000) Subject: Ueberarbeitung der Status-Seiten. X-Git-Tag: v2.3-beta1~754 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;ds=inline;h=72fe12a934084f7127b252bdfa3ab6d24e0bf5cb;p=people%2Fpmueller%2Fipfire-2.x.git Ueberarbeitung der Status-Seiten. git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@503 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- diff --git a/config/menu/20-status.menu b/config/menu/20-status.menu index 19f1c925eb..37cd984af8 100644 --- a/config/menu/20-status.menu +++ b/config/menu/20-status.menu @@ -1,54 +1,66 @@ $substatus->{'10.systemstatus'} = { - 'caption' => $Lang::tr{'status'}, - 'uri' => '/cgi-bin/status.cgi', - 'title' => "$Lang::tr{'status'}", + 'caption' => $Lang::tr{'system'}, + 'uri' => '/cgi-bin/system.cgi', + 'title' => "$Lang::tr{'system'}", 'enabled' => 1, }; - $substatus->{'20.systemgraphs'} = { - 'caption' => $Lang::tr{'system graphs'}, - 'uri' => '/cgi-bin/graphs.cgi', - 'novars' => 1, - 'title' => "$Lang::tr{'system graphs'}", + $substatus->{'20.memory'} = { + 'caption' => $Lang::tr{'memory'}, + 'uri' => '/cgi-bin/memory.cgi', + 'title' => "$Lang::tr{'memory'}", 'enabled' => 1, }; - $substatus->{'30.trafficgraphs'} = { - 'caption' => $Lang::tr{'sstraffic graphs'}, - 'uri' => '/cgi-bin/graphs.cgi', - 'vars' => 'graph=network', - 'title' => "$Lang::tr{'sstraffic graphs'}", + $substatus->{'30.media'} = { + 'caption' => $Lang::tr{'media'}, + 'uri' => '/cgi-bin/media.cgi', + 'title' => "$Lang::tr{'media'}", 'enabled' => 1, }; - $substatus->{'40.proxygraphs'} = { + $substatus->{'40.networkred'} = { + 'caption' => "$Lang::tr{'network red'}", + 'uri' => '/cgi-bin/network.cgi', + 'vars' => 'network=red', + 'title' => "$Lang::tr{'network red'}", + 'enabled' => 1, + }; + $substatus->{'41.networkother'} = { + 'caption' => "$Lang::tr{'network other'}", + 'uri' => '/cgi-bin/network.cgi', + 'vars' => 'network=other', + 'title' => "$Lang::tr{'network other'}", + 'enabled' => 1, + }; + $substatus->{'50.proxygraphs'} = { 'caption' => $Lang::tr{'ssproxy graphs'}, 'uri' => '/cgi-bin/proxygraphs.cgi', 'title' => "$Lang::tr{'ssproxy graphs'}", 'enabled' => 1, }; - $substatus->{'50.fwhits'} = { - 'caption' => 'Firewall-Diagramme', - 'uri' => '/cgi-bin/fwhits.cgi', - 'title' => "Firewall-Diagramme", - 'enabled' => 1, - }; $substatus->{'60.hardwaregraphs'} = { 'caption' => "$Lang::tr{'hardware graphs'}", 'uri' => '/cgi-bin/hardwaregraphs.cgi', 'title' => "$Lang::tr{'hardware graphs'}", 'enabled' => 1, }; - $substatus->{'70.connections'} = { + $substatus->{'70.fwhits'} = { + 'caption' => "$Lang::tr{'firewall graphs'}", + 'uri' => '/cgi-bin/fwhits.cgi', + 'title' => "$Lang::tr{'firewall graphs'}", + 'enabled' => 1, + }; + $substatus->{'71.connections'} = { 'caption' => $Lang::tr{'connections'}, 'uri' => '/cgi-bin/connections.cgi', 'title' => "$Lang::tr{'connections'}", 'enabled' => 1, }; - $substatus->{'80.nettraf'} = { + $substatus->{'72.nettraf'} = { 'caption' => $Lang::tr{'sstraffic'}, 'uri' => '/cgi-bin/traffic.cgi', 'title' => "$Lang::tr{'sstraffic'}", 'enabled' => 1, }; - $substatus->{'90.iptable'} = { + $substatus->{'73.iptables'} = { 'caption' => $Lang::tr{'iptable rules'}, 'uri' => '/cgi-bin/iptables.cgi', 'title' => "$Lang::tr{'iptable rules'}", diff --git a/config/rootfiles/common/apache2 b/config/rootfiles/common/apache2 index de77998b0f..9ca53eb7ca 100644 --- a/config/rootfiles/common/apache2 +++ b/config/rootfiles/common/apache2 @@ -1297,9 +1297,11 @@ srv/web/ipfire/cgi-bin/logs.cgi #srv/web/ipfire/cgi-bin/logs.cgi/showrequestfromport.dat #srv/web/ipfire/cgi-bin/logs.cgi/summary.dat #srv/web/ipfire/cgi-bin/logs.cgi/urlfilter.dat +srv/web/ipfire/cgi-bin/media.cgi +srv/web/ipfire/cgi-bin/memory.cgi srv/web/ipfire/cgi-bin/modem.cgi srv/web/ipfire/cgi-bin/netconfig.cgi -srv/web/ipfire/cgi-bin/netstatus.cgi +srv/web/ipfire/cgi-bin/network.cgi srv/web/ipfire/cgi-bin/networks.cgi srv/web/ipfire/cgi-bin/optionsfw.cgi srv/web/ipfire/cgi-bin/outgoingfw.cgi @@ -1316,7 +1318,7 @@ srv/web/ipfire/cgi-bin/samba.cgi srv/web/ipfire/cgi-bin/services.cgi srv/web/ipfire/cgi-bin/shaping.cgi srv/web/ipfire/cgi-bin/shutdown.cgi -srv/web/ipfire/cgi-bin/status.cgi +srv/web/ipfire/cgi-bin/system.cgi srv/web/ipfire/cgi-bin/time.cgi srv/web/ipfire/cgi-bin/traffic.cgi srv/web/ipfire/cgi-bin/traffics.cgi diff --git a/html/cgi-bin/graphs.cgi b/html/cgi-bin/graphs.cgi index 708387cf77..82357e729e 100644 --- a/html/cgi-bin/graphs.cgi +++ b/html/cgi-bin/graphs.cgi @@ -6,7 +6,6 @@ # # (c) The SmoothWall Team # -# $Id: graphs.cgi,v 1.9.2.6 2005/02/22 22:21:55 gespinasse Exp $ # use strict; @@ -41,24 +40,6 @@ if ($cgigraphs[1] =~ /(network|GREEN|BLUE|ORANGE|RED|lq)/) { &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|load)/) { @@ -78,14 +59,6 @@ if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED|lq|cpu|memory|swap|disk|load)/) { print $Lang::tr{'no information available'}; } &Header::closebox(); - print "
"; - if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED|lq)/) { - print ""; - } else { - print ""; - } - print "$Lang::tr{'back'}
\n"; - ; } elsif ($cgigraphs[1] =~ /network/) { push (@graphs, ('GREEN')); if ($netsettings{'BLUE_DEV'}) { @@ -110,80 +83,6 @@ if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED|lq|cpu|memory|swap|disk|load)/) { print "
\n"; &Header::closebox(); } -} else { - &Header::openbox('100%', 'center', "CPU $Lang::tr{'graph'}"); - if (-e "$graphdir/cpu-day.png") { - my $ftime = localtime((stat("$graphdir/cpu-day.png"))[9]); - print "
$Lang::tr{'the statistics were last updated at'}: $ftime

\n"; - print ""; - print ""; - print ""; - } else { - print $Lang::tr{'no information available'}; - } - print "
\n"; - &Header::closebox(); - - &Header::openbox('100%', 'center', "Load $Lang::tr{'graph'}"); - if (-e "$graphdir/load-day.png") { - my $ftime = localtime((stat("$graphdir/load-day.png"))[9]); - print "
$Lang::tr{'the statistics were last updated at'}: $ftime

\n"; - print ""; - print ""; - print ""; - } else { - print $Lang::tr{'no information available'}; - } - print "
\n"; - &Header::closebox(); - - &Header::openbox('100%', 'center', "Memory $Lang::tr{'graph'}"); - if (-e "$graphdir/memory-day.png") { - my $ftime = localtime((stat("$graphdir/memory-day.png"))[9]); - print "
$Lang::tr{'the statistics were last updated at'}: $ftime

\n"; - print ""; - print ""; - print ""; - } else { - print $Lang::tr{'no information available'}; - } - print "
\n"; - &Header::closebox(); - - &Header::openbox('100%', 'center', "Swap $Lang::tr{'graph'}"); - if (-e "$graphdir/swap-day.png") { - my $ftime = localtime((stat("$graphdir/swap-day.png"))[9]); - print "
$Lang::tr{'the statistics were last updated at'}: $ftime

\n"; - print ""; - print ""; - print ""; - } else { - print $Lang::tr{'no information available'}; - } - print "
\n"; - &Header::closebox(); - - &Header::openbox('100%', 'center', "Disk $Lang::tr{'graph'}"); - if (-e "$graphdir/disk-day.png") { - my $ftime = localtime((stat("$graphdir/disk-day.png"))[9]); - print "
$Lang::tr{'the statistics were last updated at'}: $ftime

\n"; - print ""; - print ""; - print ""; - } else { - print $Lang::tr{'no information available'}; - } - 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/media.cgi b/html/cgi-bin/media.cgi new file mode 100644 index 0000000000..0070151816 --- /dev/null +++ b/html/cgi-bin/media.cgi @@ -0,0 +1,211 @@ +#!/usr/bin/perl +# +# SmoothWall CGIs +# +# This code is distributed under the terms of the GPL +# +# (c) The SmoothWall Team +# +# + +use strict; + +# enable only the following on debugging purpose +use warnings; +use CGI::Carp 'fatalsToBrowser'; + +require '/var/ipfire/general-functions.pl'; +require "${General::swroot}/lang.pl"; +require "${General::swroot}/header.pl"; + +#workaround to suppress a warning when a variable is used only once +my @dummy = ( ${Header::colourred} ); +undef (@dummy); + +my %cgiparams=(); + +&Header::showhttpheaders(); + +&Header::getcgihash(\%cgiparams); + +&Header::openpage($Lang::tr{'media information'}, 1, ''); + +&Header::openbigbox('100%', 'left'); + +&Header::openbox('100%', 'center', "Disk $Lang::tr{'graph'}"); +if (-e "$Header::graphdir/disk-day.png") { + my $ftime = localtime((stat("$Header::graphdir/disk-day.png"))[9]); + print "
$Lang::tr{'the statistics were last updated at'}: $ftime

\n"; + print ""; + print ""; + print ""; +} else { + print $Lang::tr{'no information available'}; +} +print "
\n"; +&Header::closebox(); + +my @devices = `kudzu -qps -c HD | grep device: | cut -d" " -f2 | sort | uniq`; + +foreach (@devices) { + my $device = $_; + chomp($device); + diskbox("$device"); +} + +&Header::openbox('100%', 'center', $Lang::tr{'disk usage'}); +print "\n"; +open(DF,'/bin/df -B M -x rootfs|'); +while() +{ + if ($_ =~ m/^Filesystem/ ) + { + print < + + + + + + + +END +; + } + else + { + my ($device,$size,$used,$free,$percent,$mount) = split; + print < + + + + + + + +END +; + } +} +close DF; +print " + + + + + + +END +; + } + else + { + my ($device,$size,$used,$free,$percent,$mount) = split; + print < + + + + + + + +END +; + } +} +close DF; +my @iostat1 = qx(/usr/bin/iostat -dm -p | grep -v "Linux" | awk '{print \$1}'); +my @iostat2 = qx(/usr/bin/iostat -dm -p | grep -v "Linux" | awk '{print \$5}'); +my @iostat3 = qx(/usr/bin/iostat -dm -p | grep -v "Linux" | awk '{print \$6}'); +print ""; +my $i=0; + +for(my $i = 1; $i <= $#iostat1; $i++) +{ +if ( $i eq '1' ){print "";} +else {print "";} +} +print "
$Lang::tr{'device'}$Lang::tr{'mounted on'}$Lang::tr{'size'}$Lang::tr{'used'}$Lang::tr{'free'}$Lang::tr{'percentage'}
$device$mount$size$used$free +END +; + &percentbar($percent); + print < +$percent
 \n

Inodes

\n"; + +open(DF,'/bin/df -i -x rootfs|'); +while() +{ + if ($_ =~ m/^Filesystem/ ) + { + print < +
$Lang::tr{'device'}$Lang::tr{'mounted on'}$Lang::tr{'size'}$Lang::tr{'used'}$Lang::tr{'free'}$Lang::tr{'percentage'}
$device$mount$size$used$free +END +; + &percentbar($percent); + print < +$percent
 \n

transfers

DeviceMB readMB writen
@iostat1[$i]@iostat2[$i]@iostat3[$i]
\n"; +&Header::closebox(); + +&Header::closebigbox(); + +&Header::closepage(); + +sub percentbar +{ + my $percent = $_[0]; + my $fg = '#a0a0a0'; + my $bg = '#e2e2e2'; + + if ($percent =~ m/^(\d+)%$/ ) + { + print < + +END +; + if ($percent eq "100%") { + print "" + } elsif ($percent eq "0%") { + print "" + } else { + print "" + } + print < +END +; + } +} + +sub diskbox { + my $disk = $_[0]; + 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]); + 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"); + } + my $smart = `smartctrl $disk`; + $smart = &Header::cleanhtml($smart); + print < + +END +; + &Header::closebox(); + } + + +} diff --git a/html/cgi-bin/memory.cgi b/html/cgi-bin/memory.cgi new file mode 100644 index 0000000000..07f7b43859 --- /dev/null +++ b/html/cgi-bin/memory.cgi @@ -0,0 +1,166 @@ +#!/usr/bin/perl +# +# SmoothWall CGIs +# +# This code is distributed under the terms of the GPL +# +# (c) The SmoothWall Team +# +# + +use strict; + +# enable only the following on debugging purpose +use warnings; +use CGI::Carp 'fatalsToBrowser'; + +require '/var/ipfire/general-functions.pl'; +require "${General::swroot}/lang.pl"; +require "${General::swroot}/header.pl"; + +my %cgiparams=(); + +&Header::showhttpheaders(); + +&Header::getcgihash(\%cgiparams); + +&Header::openpage($Lang::tr{'memory information'}, 1, ''); + +&Header::openbigbox('100%', 'left'); + +&Header::openbox('100%', 'center', "Memory $Lang::tr{'graph'}"); +if (-e "$Header::graphdir/memory-day.png") { + my $ftime = localtime((stat("$Header::graphdir/memory-day.png"))[9]); + print "
$Lang::tr{'the statistics were last updated at'}: $ftime

\n"; + print ""; + print ""; + print ""; +} else { + print $Lang::tr{'no information available'}; +} +print "
\n"; +&Header::closebox(); + +&Header::openbox('100%', 'center', "Swap $Lang::tr{'graph'}"); +if (-e "$Header::graphdir/swap-day.png") { + my $ftime = localtime((stat("$Header::graphdir/swap-day.png"))[9]); + print "
$Lang::tr{'the statistics were last updated at'}: $ftime

\n"; + print ""; + print ""; + print ""; +} else { + print $Lang::tr{'no information available'}; +} +print "
\n"; +&Header::closebox(); + +&Header::openbox('100%', 'center', $Lang::tr{'memory'}); +print ""; +my $ram=0; +my $size=0; +my $used=0; +my $free=0; +my $percent=0; +my $shared=0; +my $buffers=0; +my $cached=0; +open(FREE,'/usr/bin/free |'); +while() +{ + if ($_ =~ m/^\s+total\s+used\s+free\s+shared\s+buffers\s+cached$/ ) + { + print < + + + + + + +END +; + } else { + if ($_ =~ m/^Mem:\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)$/) { + ($ram,$size,$used,$free,$shared,$buffers,$cached) = ($1,$1,$2,$3,$4,$5,$6); + ($percent = ($used/$size)*100) =~ s/^(\d+)(\.\d+)?$/$1%/; + print < + + +END +; + } elsif ($_ =~ m/^Swap:\s+(\d+)\s+(\d+)\s+(\d+)$/) { + ($size,$used,$free) = ($1,$2,$3); + if ($size != 0) + { + ($percent = ($used/$size)*100) =~ s/^(\d+)(\.\d+)?$/$1%/; + } else { + ($percent = ''); + } + print < + + +END +; + } elsif ($ram and $_ =~ m/^-\/\+ buffers\/cache:\s+(\d+)\s+(\d+)$/ ) { + ($used,$free) = ($1,$2); + ($percent = ($used/$ram)*100) =~ s/^(\d+)(\.\d+)?$/$1%/; + print "" + } + print <$used + + + +END +; + } +} +close FREE; +print < + + + +
 $Lang::tr{'size'}$Lang::tr{'used'}$Lang::tr{'free'}$Lang::tr{'percentage'}
$Lang::tr{'ram'}$size$Lang::tr{'swap'}$size
$Lang::tr{'excluding buffers and cache'}$free +END +; + &percentbar($percent); + print < +$percent

$Lang::tr{'shared'}$shared
$Lang::tr{'buffers'}$buffers
$Lang::tr{'cached'}$cached
+END +; +&Header::closebox(); + +&Header::closebigbox(); + +&Header::closepage(); + +sub percentbar +{ + my $percent = $_[0]; + my $fg = '#a0a0a0'; + my $bg = '#e2e2e2'; + + if ($percent =~ m/^(\d+)%$/ ) + { + print < + +END +; + if ($percent eq "100%") { + print "" + } elsif ($percent eq "0%") { + print "" + } else { + print "" + } + print < +END +; + } +} diff --git a/html/cgi-bin/netstatus.cgi b/html/cgi-bin/netstatus.cgi deleted file mode 100644 index f5aba50510..0000000000 --- a/html/cgi-bin/netstatus.cgi +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/perl -# -# SmoothWall CGIs -# -# This code is distributed under the terms of the GPL -# -# (c) The SmoothWall Team -# - -use strict; - -# enable only the following on debugging purpose -#use warnings; -#use CGI::Carp 'fatalsToBrowser'; - -require '/var/ipfire/general-functions.pl'; -require "${General::swroot}/lang.pl"; -require "${General::swroot}/header.pl"; - -my %dhcpsettings=(); -my %netsettings=(); -my %dhcpinfo=(); -my %pppsettings=(); -my $output=''; - -&General::readhash("${General::swroot}/dhcp/settings", \%dhcpsettings); -&General::readhash("${General::swroot}/ethernet/settings", \%netsettings); -&General::readhash("${General::swroot}/ppp/settings", \%pppsettings); -&Header::showhttpheaders(); -&Header::openpage($Lang::tr{'network status information'}, 1, ''); - -&Header::openbigbox('100%', 'left'); - -&Header::openbox('100%', 'left', $Lang::tr{'interfaces'}); -$output = `/sbin/ip addr show`; -$output = &Header::cleanhtml($output,"y"); - -my @itfs = ('ORANGE','BLUE','GREEN'); -foreach my $itf (@itfs) { - my $ColorName=''; - my $lc_itf=lc($itf); - my $dev = $netsettings{"${itf}_DEV"}; - if ($dev){ - $ColorName = "${lc_itf}"; #dereference variable name... - $output =~ s/$dev/$dev<\/font><\/b>/ ; - } -} - -if (open(REDIFACE, "${General::swroot}/red/iface")) { - my $lc_itf='red'; - my $reddev = ; - close(REDIFACE); - chomp $reddev; - $output =~ s/$reddev/${reddev}<\/font><\/b>/; -} -print "
$output
\n"; -&Header::closebox(); - - -if ( $netsettings{'CONFIG_TYPE'} =~ /^(2|3|6|7)$/ && $netsettings{'RED_TYPE'} eq "DHCP") { - - print "\n"; - &Header::openbox('100%', 'left', "RED $Lang::tr{'dhcp configuration'}"); - if (-s "${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info") { - - &General::readhash("${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info", \%dhcpinfo); - - my $DNS1=`echo $dhcpinfo{'DNS'} | cut -f 1 -d ,`; - my $DNS2=`echo $dhcpinfo{'DNS'} | cut -f 2 -d ,`; - - my $lsetme=0; - my $leasetime=""; - if ($dhcpinfo{'LEASETIME'} ne "") { - $lsetme=$dhcpinfo{'LEASETIME'}; - $lsetme=($lsetme/60); - if ($lsetme > 59) { - $lsetme=($lsetme/60); $leasetime=$lsetme." Hour"; - } else { - $leasetime=$lsetme." Minute"; - } - if ($lsetme > 1) { - $leasetime=$leasetime."s"; - } - } - my $rentme=0; - my $rnwltime=""; - if ($dhcpinfo{'RENEWALTIME'} ne "") { - $rentme=$dhcpinfo{'RENEWALTIME'}; - $rentme=($rentme/60); - if ($rentme > 59){ - $rentme=($rentme/60); $rnwltime=$rentme." Hour"; - } else { - $rnwltime=$rentme." Minute"; - } - if ($rentme > 1){ - $rnwltime=$rnwltime."s"; - } - } - my $maxtme=0; - my $maxtime=""; - if ($dhcpinfo{'REBINDTIME'} ne "") { - $maxtme=$dhcpinfo{'REBINDTIME'}; - $maxtme=($maxtme/60); - if ($maxtme > 59){ - $maxtme=($maxtme/60); $maxtime=$maxtme." Hour"; - } else { - $maxtime=$maxtme." Minute"; - } - if ($maxtme > 1) { - $maxtime=$maxtime."s"; - } - } - - print ""; - if ($dhcpinfo{'HOSTNAME'}) { - print "\n"; - } else { - print "\n"; - } - print < - - - - - - -
$Lang::tr{'hostname'}$dhcpinfo{'HOSTNAME'}.$dhcpinfo{'DOMAIN'}
$Lang::tr{'domain'}$dhcpinfo{'DOMAIN'}
$Lang::tr{'gateway'}$dhcpinfo{'GATEWAY'}
$Lang::tr{'primary dns'}$DNS1
$Lang::tr{'secondary dns'}$DNS2
$Lang::tr{'dhcp server'}$dhcpinfo{'DHCPSIADDR'}
$Lang::tr{'def lease time'}$leasetime
$Lang::tr{'default renewal time'}$rnwltime
$Lang::tr{'max renewal time'}$maxtime
-END - ; - } - else - { - print "$Lang::tr{'no dhcp lease'}"; - } - &Header::closebox(); -} - -if ($dhcpsettings{'ENABLE_GREEN'} eq 'on' || $dhcpsettings{'ENABLE_BLUE'} eq 'on') { - - print "
"; - &Header::CheckSortOrder; - &Header::PrintActualLeases; -} - -&Header::openbox('100%', 'left', $Lang::tr{'routing table entries'}); -$output = `/sbin/ip show show`; -$output = &Header::cleanhtml($output,"y"); -print "
$output
\n"; -&Header::closebox(); - -&Header::openbox('100%', 'left', $Lang::tr{'arp table entries'}); -$output = `/sbin/ip neigh show`; -$output = &Header::cleanhtml($output,"y"); -print "
$output
\n"; -&Header::closebox(); - -&Header::closebigbox(); - -&Header::closepage(); diff --git a/html/cgi-bin/network.cgi b/html/cgi-bin/network.cgi new file mode 100644 index 0000000000..eee47c64a0 --- /dev/null +++ b/html/cgi-bin/network.cgi @@ -0,0 +1,172 @@ +#!/usr/bin/perl +# +# SmoothWall CGIs +# +# This code is distributed under the terms of the GPL +# +# (c) The SmoothWall Team +# +# + +use strict; + +# enable only the following on debugging purpose +use warnings; +use CGI::Carp 'fatalsToBrowser'; + +require '/var/ipfire/general-functions.pl'; +require "${General::swroot}/lang.pl"; +require "${General::swroot}/header.pl"; + +my %cgiparams=(); +my %pppsettings=(); +my %netsettings=(); +my @cgiparams=(); +my @graphs=(); +my $iface=''; +my %dhcpsettings=(); +my %dhcpinfo=(); +my $output=''; + +&Header::showhttpheaders(); + +&General::readhash("${General::swroot}/ethernet/settings", \%netsettings); + +$ENV{'QUERY_STRING'} =~ s/&//g; +@cgiparams = split(/network=/,$ENV{'QUERY_STRING'}); +$cgiparams[1] = '' unless defined $cgiparams[1]; + +if ($cgiparams[1] =~ /red/) { + &Header::openpage($Lang::tr{'network traffic graphs external'}, 1, ''); + push (@graphs, ("RED")); + push (@graphs, ('lq')); +} else { + &Header::openpage($Lang::tr{'network traffic graphs internal'}, 1, ''); + push (@graphs, ('GREEN')); + if ($netsettings{'BLUE_DEV'}) { + push (@graphs, ('BLUE')); } + if ($netsettings{'ORANGE_DEV'}) { + push (@graphs, ('ORANGE')); } +} + +&Header::openbigbox('100%', 'left'); + +foreach my $graphname (@graphs) { + + &Header::openbox('100%', 'center', "$graphname $Lang::tr{'graph'}"); + if (-e "$Header::graphdir/${graphname}-day.png") { + my $ftime = localtime((stat("$Header::graphdir/${graphname}-day.png"))[9]); + print "
$Lang::tr{'the statistics were last updated at'}: $ftime

\n"; + print "
"; + print ""; + print ""; + } else { + print $Lang::tr{'no information available'}; + } + print "
\n"; + &Header::closebox(); +} + +if ($cgiparams[1] =~ /red/) { + + if ( $netsettings{'CONFIG_TYPE'} =~ /^(2|3|6|7)$/ && $netsettings{'RED_TYPE'} eq "DHCP") { + + &Header::openbox('100%', 'left', "RED $Lang::tr{'dhcp configuration'}"); + if (-s "${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info") { + + &General::readhash("${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info", \%dhcpinfo); + + my $DNS1=`echo $dhcpinfo{'DNS'} | cut -f 1 -d ,`; + my $DNS2=`echo $dhcpinfo{'DNS'} | cut -f 2 -d ,`; + + my $lsetme=0; + my $leasetime=""; + if ($dhcpinfo{'LEASETIME'} ne "") { + $lsetme=$dhcpinfo{'LEASETIME'}; + $lsetme=($lsetme/60); + if ($lsetme > 59) { + $lsetme=($lsetme/60); $leasetime=$lsetme." Hour"; + } else { + $leasetime=$lsetme." Minute"; + } + if ($lsetme > 1) { + $leasetime=$leasetime."s"; + } + } + my $rentme=0; + my $rnwltime=""; + if ($dhcpinfo{'RENEWALTIME'} ne "") { + $rentme=$dhcpinfo{'RENEWALTIME'}; + $rentme=($rentme/60); + if ($rentme > 59){ + $rentme=($rentme/60); $rnwltime=$rentme." Hour"; + } else { + $rnwltime=$rentme." Minute"; + } + if ($rentme > 1){ + $rnwltime=$rnwltime."s"; + } + } + my $maxtme=0; + my $maxtime=""; + if ($dhcpinfo{'REBINDTIME'} ne "") { + $maxtme=$dhcpinfo{'REBINDTIME'}; + $maxtme=($maxtme/60); + if ($maxtme > 59){ + $maxtme=($maxtme/60); $maxtime=$maxtme." Hour"; + } else { + $maxtime=$maxtme." Minute"; + } + if ($maxtme > 1) { + $maxtime=$maxtime."s"; + } + } + + print ""; + if ($dhcpinfo{'HOSTNAME'}) { + print "\n"; + } else { + print "\n"; + } + print < + + + + + + +
$Lang::tr{'hostname'}$dhcpinfo{'HOSTNAME'}.$dhcpinfo{'DOMAIN'}
$Lang::tr{'domain'}$dhcpinfo{'DOMAIN'}
$Lang::tr{'gateway'}$dhcpinfo{'GATEWAY'}
$Lang::tr{'primary dns'}$DNS1
$Lang::tr{'secondary dns'}$DNS2
$Lang::tr{'dhcp server'}$dhcpinfo{'DHCPSIADDR'}
$Lang::tr{'def lease time'}$leasetime
$Lang::tr{'default renewal time'}$rnwltime
$Lang::tr{'max renewal time'}$maxtime
+END + ; + } + else + { + print "$Lang::tr{'no dhcp lease'}"; + } + &Header::closebox(); + } + + if ($dhcpsettings{'ENABLE_GREEN'} eq 'on' || $dhcpsettings{'ENABLE_BLUE'} eq 'on') { + &Header::CheckSortOrder; + &Header::PrintActualLeases; + } + +} else { + + &Header::openbox('100%', 'left', $Lang::tr{'routing table entries'}); + $output = `/sbin/ip route show`; + $output = &Header::cleanhtml($output,"y"); + print "
$output
\n"; + &Header::closebox(); + + &Header::openbox('100%', 'left', $Lang::tr{'arp table entries'}); + $output = `/sbin/ip neigh show`; + $output = &Header::cleanhtml($output,"y"); + print "
$output
\n"; + &Header::closebox(); + +} + +&Header::closebigbox(); +&Header::closepage(); diff --git a/html/cgi-bin/status.cgi b/html/cgi-bin/status.cgi deleted file mode 100644 index a61ccf8bae..0000000000 --- a/html/cgi-bin/status.cgi +++ /dev/null @@ -1,496 +0,0 @@ -#!/usr/bin/perl -# -# SmoothWall CGIs -# -# This code is distributed under the terms of the GPL -# -# (c) The SmoothWall Team -# -# - -use strict; - -# enable only the following on debugging purpose -use warnings; -use CGI::Carp 'fatalsToBrowser'; - -require '/var/ipfire/general-functions.pl'; -require "${General::swroot}/lang.pl"; -require "${General::swroot}/header.pl"; - -#workaround to suppress a warning when a variable is used only once -my @dummy = ( ${Header::colourred} ); -undef (@dummy); - -my %netsettings=(); -&General::readhash("${General::swroot}/ethernet/settings", \%netsettings); - -my %cgiparams=(); -# Maps a nice printable name to the changing part of the pid file, which -# is also the name of the program -my %servicenames = -( - $Lang::tr{'dhcp server'} => 'dhcpd', - $Lang::tr{'web server'} => 'httpd', - $Lang::tr{'cron server'} => 'fcron', - $Lang::tr{'dns proxy server'} => 'dnsmasq', - $Lang::tr{'logging server'} => 'syslogd', - $Lang::tr{'kernel logging server'} => 'klogd', - $Lang::tr{'ntp server'} => 'ntpd', - $Lang::tr{'secure shell server'} => 'sshd', - $Lang::tr{'vpn'} => 'pluto', - $Lang::tr{'web proxy'} => 'squid', - 'OpenVPN' => 'openvpn' -); - -my $iface = ''; -if (open(FILE, "${General::swroot}/red/iface")) -{ - $iface = ; - close FILE; - chomp $iface; -} -$servicenames{"$Lang::tr{'intrusion detection system'} (RED)"} = "snort_${iface}"; -$servicenames{"$Lang::tr{'intrusion detection system'} (GREEN)"} = "snort_$netsettings{'GREEN_DEV'}"; -if ($netsettings{'ORANGE_DEV'} ne '') { - $servicenames{"$Lang::tr{'intrusion detection system'} (ORANGE)"} = "snort_$netsettings{'ORANGE_DEV'}"; -} -if ($netsettings{'BLUE_DEV'} ne '') { - $servicenames{"$Lang::tr{'intrusion detection system'} (BLUE)"} = "snort_$netsettings{'BLUE_DEV'}"; -} - -my %dhcpsettings=(); -my %netsettings=(); -my %dhcpinfo=(); -my %pppsettings=(); -my $output=''; - -&General::readhash("${General::swroot}/dhcp/settings", \%dhcpsettings); -&General::readhash("${General::swroot}/ethernet/settings", \%netsettings); -&General::readhash("${General::swroot}/ppp/settings", \%pppsettings); - -&Header::showhttpheaders(); - -&Header::getcgihash(\%cgiparams); - -&Header::openpage($Lang::tr{'status information'}, 1, ''); - -&Header::openbigbox('100%', 'left'); - -&Header::openbox('100%', 'left', $Lang::tr{'services'}); - -print < - -END -; - -my $lines = 0; -my $key = ''; -foreach $key (sort keys %servicenames) -{ - if ($lines % 2) { - print "\n"; } - else { - print "\n"; } - print "\n"; - my $shortname = $servicenames{$key}; - my $status = &isrunning($shortname); - print "$status\n"; - print "\n"; - $lines++; -} - - -print "
$key
\n"; - -&Header::closebox(); - -&Header::openbox('100%', 'center', $Lang::tr{'memory'}); -print ""; -my $ram=0; -my $size=0; -my $used=0; -my $free=0; -my $percent=0; -my $shared=0; -my $buffers=0; -my $cached=0; -open(FREE,'/usr/bin/free |'); -while() -{ - if ($_ =~ m/^\s+total\s+used\s+free\s+shared\s+buffers\s+cached$/ ) - { - print < - - - - - - -END -; - } else { - if ($_ =~ m/^Mem:\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)$/) { - ($ram,$size,$used,$free,$shared,$buffers,$cached) = ($1,$1,$2,$3,$4,$5,$6); - ($percent = ($used/$size)*100) =~ s/^(\d+)(\.\d+)?$/$1%/; - print < - - -END -; - } elsif ($_ =~ m/^Swap:\s+(\d+)\s+(\d+)\s+(\d+)$/) { - ($size,$used,$free) = ($1,$2,$3); - if ($size != 0) - { - ($percent = ($used/$size)*100) =~ s/^(\d+)(\.\d+)?$/$1%/; - } else { - ($percent = ''); - } - print < - - -END -; - } elsif ($ram and $_ =~ m/^-\/\+ buffers\/cache:\s+(\d+)\s+(\d+)$/ ) { - ($used,$free) = ($1,$2); - ($percent = ($used/$ram)*100) =~ s/^(\d+)(\.\d+)?$/$1%/; - print "" - } - print <$used - - - -END -; - } -} -close FREE; -print < - - - -
 $Lang::tr{'size'}$Lang::tr{'used'}$Lang::tr{'free'}$Lang::tr{'percentage'}
$Lang::tr{'ram'}$size$Lang::tr{'swap'}$size
$Lang::tr{'excluding buffers and cache'}$free -END -; - &percentbar($percent); - print < -$percent

$Lang::tr{'shared'}$shared
$Lang::tr{'buffers'}$buffers
$Lang::tr{'cached'}$cached
-END -; -&Header::closebox(); - -&Header::openbox('100%', 'center', $Lang::tr{'disk usage'}); -print "\n"; -open(DF,'/bin/df -B M -x rootfs|'); -while() -{ - if ($_ =~ m/^Filesystem/ ) - { - print < - - - - - - - -END -; - } - else - { - my ($device,$size,$used,$free,$percent,$mount) = split; - print < - - - - - - - -END -; - } -} -close DF; -print " - - - - - - -END -; - } - else - { - my ($device,$size,$used,$free,$percent,$mount) = split; - print < - - - - - - - -END -; - } -} -close DF; -my $iostat = qx(/usr/bin/iostat -dm -p | grep -v "Linux"); -print "\n"; - -print "
$Lang::tr{'device'}$Lang::tr{'mounted on'}$Lang::tr{'size'}$Lang::tr{'used'}$Lang::tr{'free'}$Lang::tr{'percentage'}
$device$mount$size$used$free -END -; - &percentbar($percent); - print < -$percent
 \n

Inodes

\n"; - -open(DF,'/bin/df -i -x rootfs|'); -while() -{ - if ($_ =~ m/^Filesystem/ ) - { - print < -
$Lang::tr{'device'}$Lang::tr{'mounted on'}$Lang::tr{'size'}$Lang::tr{'used'}$Lang::tr{'free'}$Lang::tr{'percentage'}
$device$mount$size$used$free -END -; - &percentbar($percent); - print < -$percent
 \n

transfers

$iostat
\n"; -&Header::closebox(); - -&Header::openbox('100%', 'left', $Lang::tr{'interfaces'}); -$output = `/sbin/ip link show`; -$output = &Header::cleanhtml($output,"y"); - -my @itfs = ('ORANGE','BLUE','GREEN'); -foreach my $itf (@itfs) { - my $ColorName=''; - my $lc_itf=lc($itf); - my $dev = $netsettings{"${itf}_DEV"}; - if ($dev){ - $ColorName = "${lc_itf}"; #dereference variable name... - $output =~ s/$dev/$dev<\/font><\/b>/ ; - } -} - -if (open(REDIFACE, "${General::swroot}/red/iface")) { - my $lc_itf='red'; - my $reddev = ; - close(REDIFACE); - chomp $reddev; - $output =~ s/$reddev/${reddev}<\/font><\/b>/; -} -print "
$output
\n"; -&Header::closebox(); - - -if ( $netsettings{'CONFIG_TYPE'} =~ /^(2|3|6|7)$/ && $netsettings{'RED_TYPE'} eq "DHCP") { - - &Header::openbox('100%', 'left', "RED $Lang::tr{'dhcp configuration'}"); - if (-s "${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info") { - - &General::readhash("${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info", \%dhcpinfo); - - my $DNS1=`echo $dhcpinfo{'DNS'} | cut -f 1 -d ,`; - my $DNS2=`echo $dhcpinfo{'DNS'} | cut -f 2 -d ,`; - - my $lsetme=0; - my $leasetime=""; - if ($dhcpinfo{'LEASETIME'} ne "") { - $lsetme=$dhcpinfo{'LEASETIME'}; - $lsetme=($lsetme/60); - if ($lsetme > 59) { - $lsetme=($lsetme/60); $leasetime=$lsetme." Hour"; - } else { - $leasetime=$lsetme." Minute"; - } - if ($lsetme > 1) { - $leasetime=$leasetime."s"; - } - } - my $rentme=0; - my $rnwltime=""; - if ($dhcpinfo{'RENEWALTIME'} ne "") { - $rentme=$dhcpinfo{'RENEWALTIME'}; - $rentme=($rentme/60); - if ($rentme > 59){ - $rentme=($rentme/60); $rnwltime=$rentme." Hour"; - } else { - $rnwltime=$rentme." Minute"; - } - if ($rentme > 1){ - $rnwltime=$rnwltime."s"; - } - } - my $maxtme=0; - my $maxtime=""; - if ($dhcpinfo{'REBINDTIME'} ne "") { - $maxtme=$dhcpinfo{'REBINDTIME'}; - $maxtme=($maxtme/60); - if ($maxtme > 59){ - $maxtme=($maxtme/60); $maxtime=$maxtme." Hour"; - } else { - $maxtime=$maxtme." Minute"; - } - if ($maxtme > 1) { - $maxtime=$maxtime."s"; - } - } - - print ""; - if ($dhcpinfo{'HOSTNAME'}) { - print "\n"; - } else { - print "\n"; - } - print < - - - - - - -
$Lang::tr{'hostname'}$dhcpinfo{'HOSTNAME'}.$dhcpinfo{'DOMAIN'}
$Lang::tr{'domain'}$dhcpinfo{'DOMAIN'}
$Lang::tr{'gateway'}$dhcpinfo{'GATEWAY'}
$Lang::tr{'primary dns'}$DNS1
$Lang::tr{'secondary dns'}$DNS2
$Lang::tr{'dhcp server'}$dhcpinfo{'DHCPSIADDR'}
$Lang::tr{'def lease time'}$leasetime
$Lang::tr{'default renewal time'}$rnwltime
$Lang::tr{'max renewal time'}$maxtime
-END - ; - } - else - { - print "$Lang::tr{'no dhcp lease'}"; - } - &Header::closebox(); -} - -if ($dhcpsettings{'ENABLE_GREEN'} eq 'on' || $dhcpsettings{'ENABLE_BLUE'} eq 'on') { - &Header::CheckSortOrder; - &Header::PrintActualLeases; -} - -&Header::openbox('100%', 'left', $Lang::tr{'routing table entries'}); -$output = `/sbin/ip route show`; -$output = &Header::cleanhtml($output,"y"); -print "
$output
\n"; -&Header::closebox(); - -&Header::openbox('100%', 'left', $Lang::tr{'arp table entries'}); -$output = `/sbin/ip neigh show`; -$output = &Header::cleanhtml($output,"y"); -print "
$output
\n"; -&Header::closebox(); - -&Header::openbox('100%', 'left', $Lang::tr{'loaded modules'}); -my $module = qx(/bin/lsmod | awk -F" " '{print \$1}'); -my $size = qx(/bin/lsmod | awk -F" " '{print \$2}'); -my $used = qx(/bin/lsmod | awk -F" " '{print \$3}'); -my @usedby = qx(/bin/lsmod | awk -F" " '{print \$4}'); -my @usedbyf; -my $usedbyline; - -foreach $usedbyline(@usedby) -{ -my $laenge = length($usedbyline); - -if ( $laenge > 30) - { - my $usedbylinef=substr($usedbyline,0,30); - $usedbyline="$usedbylinef ...\n"; - push(@usedbyf,$usedbyline); - } -else - {push(@usedbyf,$usedbyline);} -} -print < -
$module
-
$size
-
$used
-
@usedbyf
- -END -; - -print ""; -&Header::closebox(); - -&Header::closebigbox(); - -&Header::closepage(); - -sub isrunning -{ - my $cmd = $_[0]; - my $status = "$Lang::tr{'stopped'}"; - my $pid = ''; - my $testcmd = ''; - my $exename; - - $cmd =~ /(^[a-z]+)/; - $exename = $1; - - if (open(FILE, "/var/run/${cmd}.pid")) - { - $pid = ; chomp $pid; - close FILE; - if (open(FILE, "/proc/${pid}/status")) - { - while () - { - if (/^Name:\W+(.*)/) { - $testcmd = $1; } - } - close FILE; - if ($testcmd =~ /$exename/) - { - $status = "$Lang::tr{'running'}"; - } - } - } - - return $status; -} - -sub percentbar -{ - my $percent = $_[0]; - my $fg = '#a0a0a0'; - my $bg = '#e2e2e2'; - - if ($percent =~ m/^(\d+)%$/ ) - { - print < - -END -; - if ($percent eq "100%") { - print "" - } elsif ($percent eq "0%") { - print "" - } else { - print "" - } - print < -END -; - } -} diff --git a/html/cgi-bin/system.cgi b/html/cgi-bin/system.cgi new file mode 100644 index 0000000000..d556abc084 --- /dev/null +++ b/html/cgi-bin/system.cgi @@ -0,0 +1,221 @@ +#!/usr/bin/perl +# +# SmoothWall CGIs +# +# This code is distributed under the terms of the GPL +# +# (c) The SmoothWall Team +# +# + +use strict; + +# enable only the following on debugging purpose +use warnings; +use CGI::Carp 'fatalsToBrowser'; + +require '/var/ipfire/general-functions.pl'; +require "${General::swroot}/lang.pl"; +require "${General::swroot}/header.pl"; + +#workaround to suppress a warning when a variable is used only once +my @dummy = ( ${Header::colourred} ); +undef (@dummy); + +my %netsettings=(); +&General::readhash("${General::swroot}/ethernet/settings", \%netsettings); + +my %cgiparams=(); +# Maps a nice printable name to the changing part of the pid file, which +# is also the name of the program +my %servicenames = +( + $Lang::tr{'dhcp server'} => 'dhcpd', + $Lang::tr{'web server'} => 'httpd', + $Lang::tr{'cron server'} => 'fcron', + $Lang::tr{'dns proxy server'} => 'dnsmasq', + $Lang::tr{'logging server'} => 'syslogd', + $Lang::tr{'kernel logging server'} => 'klogd', + $Lang::tr{'ntp server'} => 'ntpd', + $Lang::tr{'secure shell server'} => 'sshd', + $Lang::tr{'vpn'} => 'pluto', + $Lang::tr{'web proxy'} => 'squid', + 'OpenVPN' => 'openvpn' +); + +my $iface = ''; +if (open(FILE, "${General::swroot}/red/iface")) +{ + $iface = ; + close FILE; + chomp $iface; +} +$servicenames{"$Lang::tr{'intrusion detection system'} (RED)"} = "snort_${iface}"; +$servicenames{"$Lang::tr{'intrusion detection system'} (GREEN)"} = "snort_$netsettings{'GREEN_DEV'}"; +if ($netsettings{'ORANGE_DEV'} ne '') { + $servicenames{"$Lang::tr{'intrusion detection system'} (ORANGE)"} = "snort_$netsettings{'ORANGE_DEV'}"; +} +if ($netsettings{'BLUE_DEV'} ne '') { + $servicenames{"$Lang::tr{'intrusion detection system'} (BLUE)"} = "snort_$netsettings{'BLUE_DEV'}"; +} + +&Header::showhttpheaders(); + +&Header::getcgihash(\%cgiparams); + +&Header::openpage($Lang::tr{'status information'}, 1, ''); + +&Header::openbigbox('100%', 'left'); + +&Header::openbox('100%', 'center', "CPU $Lang::tr{'graph'}"); +if (-e "$Header::graphdir/cpu-day.png") { + my $ftime = localtime((stat("$Header::graphdir/cpu-day.png"))[9]); + print "
$Lang::tr{'the statistics were last updated at'}: $ftime

\n"; + print ""; + print ""; + print ""; +} else { + print $Lang::tr{'no information available'}; +} +print "
\n"; +&Header::closebox(); + +&Header::openbox('100%', 'center', "Load $Lang::tr{'graph'}"); +if (-e "$Header::graphdir/load-day.png") { + my $ftime = localtime((stat("$Header::graphdir/load-day.png"))[9]); + print "
$Lang::tr{'the statistics were last updated at'}: $ftime

\n"; + print ""; + print ""; + print ""; +} else { + print $Lang::tr{'no information available'}; +} +print "
\n"; +&Header::closebox(); + +&Header::openbox('100%', 'left', $Lang::tr{'services'}); + +print < + +END +; + +my $lines = 0; +my $key = ''; +foreach $key (sort keys %servicenames) +{ + if ($lines % 2) { + print "\n"; } + else { + print "\n"; } + print "\n"; + my $shortname = $servicenames{$key}; + my $status = &isrunning($shortname); + print "$status\n"; + print "\n"; + $lines++; +} + + +print "
$key
\n"; + +&Header::closebox(); + +&Header::openbox('100%', 'left', $Lang::tr{'loaded modules'}); +my $module = qx(/bin/lsmod | awk -F" " '{print \$1}'); +my $size = qx(/bin/lsmod | awk -F" " '{print \$2}'); +my $used = qx(/bin/lsmod | awk -F" " '{print \$3}'); +my @usedby = qx(/bin/lsmod | awk -F" " '{print \$4}'); +my @usedbyf; +my $usedbyline; + +foreach $usedbyline(@usedby) +{ +my $laenge = length($usedbyline); + +if ( $laenge > 30) + { + my $usedbylinef=substr($usedbyline,0,30); + $usedbyline="$usedbylinef ...\n"; + push(@usedbyf,$usedbyline); + } +else + {push(@usedbyf,$usedbyline);} +} +print < +
$module
+
$size
+
$used
+
@usedbyf
+ +END +; + +print ""; +&Header::closebox(); + +&Header::closebigbox(); + +&Header::closepage(); + +sub isrunning +{ + my $cmd = $_[0]; + my $status = "$Lang::tr{'stopped'}"; + my $pid = ''; + my $testcmd = ''; + my $exename; + + $cmd =~ /(^[a-z]+)/; + $exename = $1; + + if (open(FILE, "/var/run/${cmd}.pid")) + { + $pid = ; chomp $pid; + close FILE; + if (open(FILE, "/proc/${pid}/status")) + { + while () + { + if (/^Name:\W+(.*)/) { + $testcmd = $1; } + } + close FILE; + if ($testcmd =~ /$exename/) + { + $status = "$Lang::tr{'running'}"; + } + } + } + + return $status; +} + +sub percentbar +{ + my $percent = $_[0]; + my $fg = '#a0a0a0'; + my $bg = '#e2e2e2'; + + if ($percent =~ m/^(\d+)%$/ ) + { + print < + +END +; + if ($percent eq "100%") { + print "" + } elsif ($percent eq "0%") { + print "" + } else { + print "" + } + print < +END +; + } +} diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index 0eaf708c55..51c101d13a 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -950,8 +950,11 @@ 'mbmon value' => 'Wert', 'mbmon volt' => 'Voltage', 'meaning' => 'Bedeutung', +'media' => 'Laufwerke', +'media information' => 'Laufwerksinformationen', 'medium' => 'Mittel', -'memory' => 'Speicher:', +'memory' => 'Speicher', +'memory information' => 'Speicherinformationen', 'memory usage per' => 'Speichernutzung pro', 'method' => 'Methode:', 'min size' => 'Min. Objektgröße (kB):', @@ -993,11 +996,15 @@ 'network added' => 'Benutzerdefiniertes Netzwerk hinzugefügt', 'network configuration' => 'Netzwerk Konfiguration', 'network options' => 'Netzwerk Optionen', +'network other' => 'Netzwerk (intern)', +'network red' => 'Netzwerk (extern)', 'network removed' => 'Benutzerdefiniertes Netzwerk entfernt', 'network status information' => 'Netzwerk-Statusinformationen', 'network time' => 'Benutze NTP-Server:', 'network time from' => 'Uhrzeit von einem Netzwerk Zeitserver ermitteln', 'network traffic graphs' => 'Diagramme zur Netzwerkauslastung', +'network traffic graphs external' => 'Net-Traffic-Diagramme (extern)', +'network traffic graphs internal' => 'Net-Traffic-Diagramme (intern)', 'network updated' => 'Benutzerdefiniertes Netzwerk aktualisiert', 'networks settings' => 'Firewall - Netzwerkeinstellungen', 'new optionsfw later' => 'Ihre Modifikation(en) wird (werden) beim nächsten Neustart aktiv werden', @@ -1269,6 +1276,7 @@ 'sitekey' => 'Sitekey', 'sitekeyfile' => 'Sitekeyfile', 'size' => 'Größe', +'smart information' => 'SMART-Informationen', 'smbreload' => 'Samba Dienste durchstarten', 'smbstart' => 'Samba Dienste starten', 'smbstop' => 'Samba Dienste beenden', @@ -1340,6 +1348,7 @@ 'sunday' => 'Sonntag', 'swap' => 'Swap', 'swap usage per' => 'Nutzung von Auslagerungsspeicher (Swap) pro', +'system' => 'System', 'system cpu' => 'System CPU', 'system cpu usage' => 'System CPU Nutzung', 'system graphs' => 'System-Diagramme', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index 454ed75a01..b5ed74674b 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -965,8 +965,11 @@ 'mbmon value' => 'Value', 'mbmon volt' => 'Voltage', 'meaning' => 'meaning', +'media' => 'Media', +'media information' => 'media information', 'medium' => 'Medium', -'memory' => 'Memory:', +'memory' => 'Memory', +'memory information' => 'memory information', 'memory usage per' => 'Memory Usage per', 'method' => 'Method:', 'min size' => 'Min object size (KB):', @@ -1009,11 +1012,15 @@ 'network added' => 'Custom Network added', 'network configuration' => 'Network Configuration', 'network options' => 'Network Options', +'network other' => 'network (internal)', +'network red' => 'network (external)', 'network removed' => 'Custom Network removed', 'network status information' => 'Network Status Information', 'network time' => 'Use a Network Time Server:', 'network time from' => 'Obtain time from a Network Time Server', 'network traffic graphs' => 'Network traffic graphs', +'network traffic graphs external' => 'Net-Traffic graphs (external)', +'network traffic graphs internal' => 'Net-Traffic graphs (internal)', 'network updated' => 'Custom Network updated', 'networks settings' => 'Firewall - Network settings', 'new optionsfw later' => 'Your modification(s) will be active on next restart', @@ -1282,6 +1289,7 @@ 'sitekey' => 'Sitekey', 'sitekeyfile' => 'Sitekeyfile', 'size' => 'Size', +'smart information' => 'SMART information', 'smbreload' => 'Samba Dienste durchstarten', 'smbstart' => 'Samba Dienste starten', 'smbstop' => 'Samba Dienste beenden', @@ -1352,6 +1360,7 @@ 'sunday' => 'Sunday', 'swap' => 'Swap', 'swap usage per' => 'Swap Usage per', +'system' => 'System', 'system cpu' => 'System CPU', 'system cpu usage' => 'System CPU Usage', 'system graphs' => 'System Graphs',