mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-10 11:05:54 +02:00
Merge branch 'master' of git://git.ipfire.org/ipfire-2.x
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -8,4 +8,6 @@ DEVICE4 /var FSTYPE defaults 1 1
|
||||
proc /proc proc defaults 0 0
|
||||
sysfs /sys sysfs defaults 0 0
|
||||
devpts /dev/pts devpts gid=4,mode=620 0 0
|
||||
shm /dev/shm tmpfs defaults 0 0
|
||||
shm /dev/shm tmpfs defaults,size=25% 0 0
|
||||
none /tmp tmpfs defaults,size=128M 0 0
|
||||
none /var/log/rrd tmps defaults,size=64M 0 0
|
||||
|
||||
@@ -24,22 +24,19 @@
|
||||
};
|
||||
$substatus->{'50.networkred'} = {
|
||||
'caption' => "$Lang::tr{'network red'}",
|
||||
'uri' => '/cgi-bin/network.cgi',
|
||||
'vars' => 'network=red',
|
||||
'uri' => '/cgi-bin/netexternal.cgi',
|
||||
'title' => "$Lang::tr{'network red'}",
|
||||
'enabled' => 1,
|
||||
};
|
||||
$substatus->{'51.networkinternal'} = {
|
||||
'caption' => "$Lang::tr{'network internal'}",
|
||||
'uri' => '/cgi-bin/network.cgi',
|
||||
'vars' => 'network=internal',
|
||||
'uri' => '/cgi-bin/netinternal.cgi',
|
||||
'title' => "$Lang::tr{'network internal'}",
|
||||
'enabled' => 1,
|
||||
};
|
||||
$substatus->{'52.networkother'} = {
|
||||
'caption' => "$Lang::tr{'network other'}",
|
||||
'uri' => '/cgi-bin/network.cgi',
|
||||
'vars' => 'network=other',
|
||||
'uri' => '/cgi-bin/netother.cgi',
|
||||
'title' => "$Lang::tr{'network other'}",
|
||||
'enabled' => 1,
|
||||
};
|
||||
|
||||
@@ -1268,7 +1268,6 @@ srv/web/ipfire/cgi-bin/dhcp.cgi
|
||||
#srv/web/ipfire/cgi-bin/dial/index.cgi
|
||||
srv/web/ipfire/cgi-bin/dmzholes.cgi
|
||||
srv/web/ipfire/cgi-bin/extrahd.cgi
|
||||
srv/web/ipfire/cgi-bin/fwhits.cgi
|
||||
srv/web/ipfire/cgi-bin/graphs.cgi
|
||||
srv/web/ipfire/cgi-bin/gui.cgi
|
||||
srv/web/ipfire/cgi-bin/hardwaregraphs.cgi
|
||||
@@ -1293,7 +1292,9 @@ srv/web/ipfire/cgi-bin/logs.cgi
|
||||
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/network.cgi
|
||||
srv/web/ipfire/cgi-bin/netexternal.cgi
|
||||
srv/web/ipfire/cgi-bin/netinternal.cgi
|
||||
srv/web/ipfire/cgi-bin/netother.cgi
|
||||
srv/web/ipfire/cgi-bin/networks.cgi
|
||||
srv/web/ipfire/cgi-bin/outgoingfw.cgi
|
||||
srv/web/ipfire/cgi-bin/ovpnmain.cgi
|
||||
@@ -1301,7 +1302,6 @@ srv/web/ipfire/cgi-bin/pakfire.cgi
|
||||
srv/web/ipfire/cgi-bin/portfw.cgi
|
||||
srv/web/ipfire/cgi-bin/pppsetup.cgi
|
||||
srv/web/ipfire/cgi-bin/proxy.cgi
|
||||
srv/web/ipfire/cgi-bin/proxygraphs.cgi
|
||||
srv/web/ipfire/cgi-bin/qos.cgi
|
||||
srv/web/ipfire/cgi-bin/qosgraph.cgi
|
||||
srv/web/ipfire/cgi-bin/remote.cgi
|
||||
@@ -1310,7 +1310,6 @@ srv/web/ipfire/cgi-bin/speed.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
|
||||
srv/web/ipfire/cgi-bin/updatexlrator.cgi
|
||||
srv/web/ipfire/cgi-bin/upnp.cgi
|
||||
srv/web/ipfire/cgi-bin/urlfilter.cgi
|
||||
|
||||
@@ -3,6 +3,7 @@ etc/init.d/mISDN
|
||||
etc/modprobe.d/blacklist
|
||||
usr/bin/bc
|
||||
usr/bin/dc
|
||||
etc/fstab
|
||||
etc/ppp/dialer
|
||||
etc/rc.d/init.d/checkfstab
|
||||
etc/rc.d/rcsysinit.d/S19checkfstab
|
||||
@@ -26,7 +27,10 @@ srv/web/ipfire/cgi-bin/hardwaregraphs.cgi
|
||||
srv/web/ipfire/cgi-bin/connections.cgi
|
||||
srv/web/ipfire/cgi-bin/graphs.cgi
|
||||
srv/web/ipfire/cgi-bin/pppsetup.cgi
|
||||
srv/web/ipfire/cgi-bin/network.cgi
|
||||
srv/web/ipfire/cgi-bin/netexternal.cgi
|
||||
srv/web/ipfire/cgi-bin/netinernal.cgi
|
||||
srv/web/ipfire/cgi-bin/netother.cgi
|
||||
|
||||
srv/web/ipfire/cgi-bin/system.cgi
|
||||
srv/web/ipfire/cgi-bin/ids.cgi
|
||||
var/ipfire/sensors/
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
###############################################################################
|
||||
# #
|
||||
# IPFire.org - A linux based firewall #
|
||||
# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
# the Free Software Foundation, either version 3 of the License, or #
|
||||
# (at your option) any later version. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, #
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
# GNU General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License #
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
###############################################################################
|
||||
|
||||
|
||||
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";
|
||||
require "${General::swroot}/graphs.pl";
|
||||
|
||||
my %cgiparams=();
|
||||
my @cgigraphs=();
|
||||
my @graphs=();
|
||||
|
||||
&Graphs::updatefwhitsgraph ("day");
|
||||
&Graphs::updatefwhitsgraph ("week");
|
||||
&Graphs::updatefwhitsgraph ("month");
|
||||
&Graphs::updatefwhitsgraph ("year");
|
||||
|
||||
$ENV{'QUERY_STRING'} =~ s/&//g;
|
||||
@cgigraphs = split(/graph=/,$ENV{'QUERY_STRING'});
|
||||
$cgigraphs[1] = '' unless defined $cgigraphs[1];
|
||||
|
||||
&Header::showhttpheaders();
|
||||
|
||||
my $graphdir = "/home/httpd/html/graphs";
|
||||
my @LOCALCHECK=();
|
||||
my $errormessage="";
|
||||
|
||||
&Header::openpage($Lang::tr{'firewall graphs'}, 1, '');
|
||||
&Header::openbigbox('100%', 'left', '', $errormessage);
|
||||
|
||||
&Header::openbox('100%', 'center', $Lang::tr{"daily firewallhits"});
|
||||
if (-e "$Header::graphdir/firewallhits-day-area.png") {
|
||||
my $ftime = localtime((stat("$Header::graphdir/firewallhits-day-area.png"))[9]);
|
||||
print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
|
||||
print "<img alt='' src='/graphs/firewallhits-day-area.png' border='0' />";
|
||||
print "<br />\n";
|
||||
} else {
|
||||
print $Lang::tr{'no information available'};
|
||||
}
|
||||
print "<br />\n";
|
||||
&Header::closebox();
|
||||
|
||||
&Header::openbox('100%', 'center', $Lang::tr{"weekly firewallhits"});
|
||||
if (-e "$Header::graphdir/firewallhits-week-area.png") {
|
||||
my $ftime = localtime((stat("$Header::graphdir/firewallhits-week-area.png"))[9]);
|
||||
print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
|
||||
print "<img alt='' src='/graphs/firewallhits-week-area.png' border='0' />";
|
||||
print "<br />\n";
|
||||
} else {
|
||||
print $Lang::tr{'no information available'};
|
||||
}
|
||||
print "<br />\n";
|
||||
&Header::closebox();
|
||||
|
||||
&Header::openbox('100%', 'center', $Lang::tr{"monthly firewallhits"});
|
||||
if (-e "$Header::graphdir/firewallhits-month-area.png") {
|
||||
my $ftime = localtime((stat("$Header::graphdir/firewallhits-month-area.png"))[9]);
|
||||
print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
|
||||
print "<img alt='' src='/graphs/firewallhits-month-area.png' border='0' />";
|
||||
print "<br />\n";
|
||||
} else {
|
||||
print $Lang::tr{'no information available'};
|
||||
}
|
||||
print "<br />\n";
|
||||
&Header::closebox();
|
||||
|
||||
&Header::openbox('100%', 'center', $Lang::tr{"yearly firewallhits"});
|
||||
if (-e "$Header::graphdir/firewallhits-year-area.png") {
|
||||
my $ftime = localtime((stat("$Header::graphdir/firewallhits-year-area.png"))[9]);
|
||||
print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
|
||||
print "<img alt='' src='/graphs/firewallhits-year-area.png' border='0' />";
|
||||
print "<br />\n";
|
||||
} else {
|
||||
print $Lang::tr{'no information available'};
|
||||
}
|
||||
print "<br />\n";
|
||||
&Header::closebox();
|
||||
|
||||
&Header::closebigbox();
|
||||
&Header::closepage();
|
||||
@@ -2,7 +2,7 @@
|
||||
###############################################################################
|
||||
# #
|
||||
# IPFire.org - A linux based firewall #
|
||||
# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
|
||||
# Copyright (C) 2008 Michael Tremer & Christian Schmidt #
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
@@ -30,38 +30,50 @@ require "${General::swroot}/lang.pl";
|
||||
require "${General::swroot}/header.pl";
|
||||
require "${General::swroot}/graphs.pl";
|
||||
|
||||
my %color = ();
|
||||
my %mainsettings = ();
|
||||
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
|
||||
&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
|
||||
|
||||
#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');
|
||||
my @querry = split(/\?/,$ENV{'QUERY_STRING'});
|
||||
$querry[0] = '' unless defined $querry[0];
|
||||
$querry[1] = 'hour' unless defined $querry[1];
|
||||
|
||||
my @devices = `kudzu -qps -c HD | grep device: | cut -d" " -f2 | sort | uniq`;
|
||||
|
||||
foreach (@devices) {
|
||||
my $device = $_;
|
||||
chomp($device);
|
||||
my @array = split(/\//,$device);
|
||||
&Graphs::updatediskgraph ("day",$array[$#array]);
|
||||
diskbox($array[$#array]);
|
||||
}
|
||||
if ( $querry[0] =~ "sd?" || $querry[0] =~ "hd?" ){
|
||||
print "Content-type: image/png\n\n";
|
||||
binmode(STDOUT);
|
||||
|
||||
&Graphs::updatediskgraph($querry[0],$querry[1]);
|
||||
}else{
|
||||
&Header::showhttpheaders();
|
||||
&Header::openpage($Lang::tr{'media information'}, 1, '');
|
||||
&Header::openbigbox('100%', 'left');
|
||||
|
||||
&Header::openbox('100%', 'center', $Lang::tr{'disk usage'});
|
||||
print "<table width='95%' cellspacing='5'>\n";
|
||||
open(DF,'/bin/df -B M -x rootfs|');
|
||||
while(<DF>)
|
||||
{
|
||||
if ($_ =~ m/^Filesystem/ )
|
||||
{
|
||||
print <<END
|
||||
foreach (@devices) {
|
||||
my $device = $_;
|
||||
chomp($device);
|
||||
my @array = split(/\//,$device);
|
||||
&Header::openbox('100%', 'center', "$array[$#array] $Lang::tr{'graph'}");
|
||||
diskbox($array[$#array]);
|
||||
&Graphs::makegraphbox("media.cgi",$array[$#array],"day");
|
||||
&Header::closebox();
|
||||
}
|
||||
|
||||
|
||||
&Header::openbox('100%', 'center', $Lang::tr{'disk usage'});
|
||||
print "<table width='95%' cellspacing='5'>\n";
|
||||
open(DF,'/bin/df -B M -x rootfs|');
|
||||
while(<DF>){
|
||||
if ($_ =~ m/^Filesystem/ ){
|
||||
print <<END
|
||||
<tr>
|
||||
<td align='center' class='boldbase'><b>$Lang::tr{'device'}</b></td>
|
||||
<td align='center' class='boldbase'><b>$Lang::tr{'mounted on'}</b></td>
|
||||
@@ -72,11 +84,9 @@ while(<DF>)
|
||||
</tr>
|
||||
END
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
my ($device,$size,$used,$free,$percent,$mount) = split;
|
||||
print <<END
|
||||
}else{
|
||||
my ($device,$size,$used,$free,$percent,$mount) = split;
|
||||
print <<END
|
||||
<tr>
|
||||
<td align='center'>$device</td>
|
||||
<td align='center'>$mount</td>
|
||||
@@ -86,24 +96,22 @@ END
|
||||
<td align='left'>
|
||||
END
|
||||
;
|
||||
&percentbar($percent);
|
||||
print <<END
|
||||
&percentbar($percent);
|
||||
print <<END
|
||||
</td>
|
||||
<td align='left'>$percent</td>
|
||||
</tr>
|
||||
END
|
||||
;
|
||||
}
|
||||
}
|
||||
close DF;
|
||||
print "<tr><td colspan='7'> \n<tr><td colspan='7'><h3>Inodes</h3>\n";
|
||||
}
|
||||
}
|
||||
close DF;
|
||||
print "<tr><td colspan='7'> \n<tr><td colspan='7'><h3>Inodes</h3>\n";
|
||||
|
||||
open(DF,'/bin/df -i -x rootfs|');
|
||||
while(<DF>)
|
||||
{
|
||||
if ($_ =~ m/^Filesystem/ )
|
||||
{
|
||||
print <<END
|
||||
open(DF,'/bin/df -i -x rootfs|');
|
||||
while(<DF>){
|
||||
if ($_ =~ m/^Filesystem/ ){
|
||||
print <<END
|
||||
<tr>
|
||||
<td align='center' class='boldbase'><b>$Lang::tr{'device'}</b></td>
|
||||
<td align='center' class='boldbase'><b>$Lang::tr{'mounted on'}</b></td>
|
||||
@@ -114,11 +122,9 @@ while(<DF>)
|
||||
</tr>
|
||||
END
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
my ($device,$size,$used,$free,$percent,$mount) = split;
|
||||
print <<END
|
||||
}else{
|
||||
my ($device,$size,$used,$free,$percent,$mount) = split;
|
||||
print <<END
|
||||
<tr>
|
||||
<td align='center'>$device</td>
|
||||
<td align='center'>$mount</td>
|
||||
@@ -128,33 +134,35 @@ END
|
||||
<td>
|
||||
END
|
||||
;
|
||||
&percentbar($percent);
|
||||
print <<END
|
||||
&percentbar($percent);
|
||||
print <<END
|
||||
</td>
|
||||
<td align='left'>$percent</td>
|
||||
</tr>
|
||||
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 "<tr><td colspan='3'> \n<tr><td colspan='3'><h3>transfers</h3></td></tr>";
|
||||
my $i=0;
|
||||
|
||||
for(my $i = 1; $i <= $#iostat1; $i++){
|
||||
if ( $i eq '1' ){
|
||||
print "<tr><td align='center' class='boldbase'><b>Device</b></td><td align='center' class='boldbase'><b>MB read</b></td><td align='center' class='boldbase'><b>MB writen</b></td></tr>";
|
||||
}else{
|
||||
print "<tr><td align='center'>$iostat1[$i]</td><td align='center'>$iostat2[$i]</td><td align='center'>$iostat3[$i]</td></tr>";
|
||||
}
|
||||
}
|
||||
print "</table>\n";
|
||||
&Header::closebox();
|
||||
|
||||
&Header::closebigbox();
|
||||
&Header::closepage();
|
||||
}
|
||||
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 "<tr><td colspan='3'> \n<tr><td colspan='3'><h3>transfers</h3></td></tr>";
|
||||
my $i=0;
|
||||
|
||||
for(my $i = 1; $i <= $#iostat1; $i++)
|
||||
{
|
||||
if ( $i eq '1' ){print "<tr><td align='center' class='boldbase'><b>Device</b></td><td align='center' class='boldbase'><b>MB read</b></td><td align='center' class='boldbase'><b>MB writen</b></td></tr>";}
|
||||
else {print "<tr><td align='center'>$iostat1[$i]</td><td align='center'>$iostat2[$i]</td><td align='center'>$iostat3[$i]</td></tr>";}
|
||||
}
|
||||
print "</table>\n";
|
||||
&Header::closebox();
|
||||
|
||||
&Header::closebigbox();
|
||||
|
||||
&Header::closepage();
|
||||
|
||||
sub percentbar
|
||||
{
|
||||
@@ -184,44 +192,33 @@ END
|
||||
}
|
||||
|
||||
sub diskbox {
|
||||
my $disk = $_[0];
|
||||
chomp $disk;
|
||||
my @status;
|
||||
if (-e "$Header::graphdir/disk-$disk-day.png") {
|
||||
&Header::openbox('100%', 'center', "Disk $disk $Lang::tr{'graph'}");
|
||||
my $ftime = localtime((stat("$Header::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 alt='' src='/graphs/disk-$disk-day.png' border='0' />";
|
||||
print "</a>";
|
||||
print "<br />\n";
|
||||
my $disk = $_[0];
|
||||
chomp $disk;
|
||||
my @status;
|
||||
if (-e "/tmp/hddstatus"){
|
||||
open(DATEI, "</tmp/hddstatus") || die "Datei nicht gefunden";
|
||||
my @diskstate = <DATEI>;
|
||||
close(DATEI);
|
||||
|
||||
if (-e "/tmp/hddstatus") {
|
||||
open(DATEI, "</tmp/hddstatus") || die "Datei nicht gefunden";
|
||||
my @diskstate = <DATEI>;
|
||||
close(DATEI);
|
||||
foreach (@diskstate){
|
||||
if ( $_ =~/$disk/ ){@status = split(/-/,$_);}
|
||||
}
|
||||
|
||||
foreach (@diskstate){
|
||||
if ( $_ =~/$disk/ ){@status = split(/-/,$_);}
|
||||
}
|
||||
if ( $status[1]=~/standby/){
|
||||
my $ftime = localtime((stat("/tmp/hddshutdown-$disk"))[9]);
|
||||
print"<B>Disk $disk status:<font color=#FF0000>".$status[1]."</font></B> (since $ftime)";
|
||||
}else{
|
||||
print"<B>Disk $disk status:<font color=#00FF00>".$status[1]."</font></B>";
|
||||
}
|
||||
}
|
||||
|
||||
if ( $status[1]=~/standby/){
|
||||
my $ftime = localtime((stat("/tmp/hddshutdown-$disk"))[9]);
|
||||
print"<B>Disk $disk status:<font color=#FF0000>".$status[1]."</font></B> (since $ftime)";
|
||||
}
|
||||
else{
|
||||
print"<B>Disk $disk status:<font color=#00FF00>".$status[1]."</font></B>";
|
||||
}
|
||||
}
|
||||
my $smart = `/usr/local/bin/smartctrl $disk`;
|
||||
$smart = &Header::cleanhtml($smart);
|
||||
print <<END
|
||||
<br /><input type="button" onClick="swapVisibility('smart_$disk')" value="$Lang::tr{'smart information'}" />
|
||||
<div id='smart_$disk' style='display: none'>
|
||||
<hr /><table border=0><tr><td align=left><pre>$smart</pre></table>
|
||||
</div>
|
||||
my $smart = `/usr/local/bin/smartctrl $disk`;
|
||||
$smart = &Header::cleanhtml($smart);
|
||||
print <<END
|
||||
<br /><input type="button" onClick="swapVisibility('smart_$disk')" value="$Lang::tr{'smart information'}" />
|
||||
<div id='smart_$disk' style='display: none'>
|
||||
<hr /><table border=0><tr><td align=left><pre>$smart</pre></table>
|
||||
</div>
|
||||
END
|
||||
;
|
||||
&Header::closebox();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
###############################################################################
|
||||
# #
|
||||
# IPFire.org - A linux based firewall #
|
||||
# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
|
||||
# Copyright (C) 2008 Michael Tremer & Christian Schmidt #
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
@@ -30,57 +30,51 @@ require "${General::swroot}/lang.pl";
|
||||
require "${General::swroot}/header.pl";
|
||||
require "${General::swroot}/graphs.pl";
|
||||
|
||||
my %cgiparams=();
|
||||
my %color = ();
|
||||
my %mainsettings = ();
|
||||
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
|
||||
&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
|
||||
|
||||
&Graphs::updatememgraph ("day");
|
||||
my @querry = split(/\?/,$ENV{'QUERY_STRING'});
|
||||
$querry[0] = '' unless defined $querry[0];
|
||||
$querry[1] = 'hour' unless defined $querry[1];
|
||||
|
||||
&Header::showhttpheaders();
|
||||
&Header::getcgihash(\%cgiparams);
|
||||
&Header::openpage($Lang::tr{'memory information'}, 1, '');
|
||||
&Header::openbigbox('100%', 'left');
|
||||
if ( $querry[0] =~ "memory"){
|
||||
print "Content-type: image/png\n\n";
|
||||
binmode(STDOUT);
|
||||
&Graphs::updatememorygraph($querry[1]);
|
||||
}elsif ( $querry[0] =~ "swap"){
|
||||
print "Content-type: image/png\n\n";
|
||||
binmode(STDOUT);
|
||||
&Graphs::updateswapgraph($querry[1]);
|
||||
}else{
|
||||
&Header::showhttpheaders();
|
||||
&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 "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
|
||||
print "<a href='/cgi-bin/graphs.cgi?graph=memory'>";
|
||||
print "<img alt='' src='/graphs/memory-day.png' border='0' />";
|
||||
print "</a>";
|
||||
} else {
|
||||
print $Lang::tr{'no information available'};
|
||||
}
|
||||
print "<br />\n";
|
||||
&Header::closebox();
|
||||
&Header::openbox('100%', 'center', "Memory $Lang::tr{'graph'}");
|
||||
&Graphs::makegraphbox("memory.cgi","memory","day");
|
||||
&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 "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
|
||||
print "<a href='/cgi-bin/graphs.cgi?graph=swap'>";
|
||||
print "<img alt='' src='/graphs/swap-day.png' border='0' />";
|
||||
print "</a>";
|
||||
} else {
|
||||
print $Lang::tr{'no information available'};
|
||||
}
|
||||
print "<br />\n";
|
||||
&Header::closebox();
|
||||
&Header::openbox('100%', 'center', "Swap $Lang::tr{'graph'}");
|
||||
&Graphs::makegraphbox("memory.cgi","swap","day");
|
||||
&Header::closebox();
|
||||
|
||||
&Header::openbox('100%', 'center', $Lang::tr{'memory'});
|
||||
print "<table width='95%' cellspacing='5'>";
|
||||
my $ram=0;
|
||||
my $size=0;
|
||||
my $used=0;
|
||||
my $free=0;
|
||||
my $percent=0;
|
||||
my $shared=0;
|
||||
my $buffers=0;
|
||||
my $cached=0;
|
||||
|
||||
&Header::openbox('100%', 'center', $Lang::tr{'memory'});
|
||||
print "<table width='95%' cellspacing='5'>";
|
||||
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(<FREE>)
|
||||
{
|
||||
if ($_ =~ m/^\s+total\s+used\s+free\s+shared\s+buffers\s+cached$/ )
|
||||
{
|
||||
print <<END
|
||||
open(FREE,'/usr/bin/free |');
|
||||
while(<FREE>){
|
||||
if ($_ =~ m/^\s+total\s+used\s+free\s+shared\s+buffers\s+cached$/ ){
|
||||
print <<END
|
||||
<tr>
|
||||
<td align='center'> </td>
|
||||
<td align='center' class='boldbase'><b>$Lang::tr{'size'}</b></td>
|
||||
@@ -90,52 +84,51 @@ while(<FREE>)
|
||||
</tr>
|
||||
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
|
||||
}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
|
||||
<tr>
|
||||
<td class='boldbase'><b>$Lang::tr{'ram'}</b></td>
|
||||
<td align='center'>$size KB</td>
|
||||
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($_ =~ 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
|
||||
<tr>
|
||||
<td class='boldbase'><b>$Lang::tr{'swap'}</b></td>
|
||||
<td align='center'>$size KB</td>
|
||||
END
|
||||
;
|
||||
} elsif ($ram and $_ =~ m/^-\/\+ buffers\/cache:\s+(\d+)\s+(\d+)$/ ) {
|
||||
($used,$free) = ($1,$2);
|
||||
($percent = ($used/$ram)*100) =~ s/^(\d+)(\.\d+)?$/$1%/;
|
||||
print "<tr><td colspan='2' class='boldbase'><b>$Lang::tr{'excluding buffers and cache'}</b></td>"
|
||||
}
|
||||
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 "<tr><td colspan='2' class='boldbase'><b>$Lang::tr{'excluding buffers and cache'}</b></td>";
|
||||
}
|
||||
print <<END
|
||||
<td align='center'>$used KB</td>
|
||||
<td align='center'>$free KB</td>
|
||||
<td>
|
||||
END
|
||||
;
|
||||
&percentbar($percent);
|
||||
print <<END
|
||||
&percentbar($percent);
|
||||
print <<END
|
||||
</td>
|
||||
<td align='left'>$percent</td>
|
||||
</tr>
|
||||
END
|
||||
;
|
||||
}
|
||||
}
|
||||
close FREE;
|
||||
print <<END
|
||||
}
|
||||
}
|
||||
close FREE;
|
||||
print <<END
|
||||
<tr><td class='boldbase' colspan='2'><br /></td></tr>
|
||||
<tr><td class='boldbase'><b>$Lang::tr{'shared'}</b></td><td align='center'>$shared KB</td></tr>
|
||||
<tr><td class='boldbase'><b>$Lang::tr{'buffers'}</b></td><td align='center'>$buffers KB</td></tr>
|
||||
@@ -143,35 +136,33 @@ print <<END
|
||||
</table>
|
||||
END
|
||||
;
|
||||
&Header::closebox();
|
||||
&Header::closebox();
|
||||
|
||||
&Header::closebigbox();
|
||||
&Header::closebigbox();
|
||||
&Header::closepage();
|
||||
}
|
||||
|
||||
&Header::closepage();
|
||||
sub percentbar{
|
||||
my $percent = $_[0];
|
||||
my $fg = '#a0a0a0';
|
||||
my $bg = '#e2e2e2';
|
||||
|
||||
sub percentbar
|
||||
{
|
||||
my $percent = $_[0];
|
||||
my $fg = '#a0a0a0';
|
||||
my $bg = '#e2e2e2';
|
||||
|
||||
if ($percent =~ m/^(\d+)%$/ )
|
||||
{
|
||||
print <<END
|
||||
if ($percent =~ m/^(\d+)%$/ ){
|
||||
print <<END
|
||||
<table width='100' border='1' cellspacing='0' cellpadding='0' style='border-width:1px;border-style:solid;border-color:$fg;width:100px;height:10px;'>
|
||||
<tr>
|
||||
END
|
||||
;
|
||||
if ($percent eq "100%") {
|
||||
print "<td width='100%' bgcolor='$fg' style='background-color:$fg;border-style:solid;border-width:1px;border-color:$bg'>"
|
||||
} elsif ($percent eq "0%") {
|
||||
print "<td width='100%' bgcolor='$bg' style='background-color:$bg;border-style:solid;border-width:1px;border-color:$bg'>"
|
||||
} else {
|
||||
print "<td width='$percent' bgcolor='$fg' style='background-color:$fg;border-style:solid;border-width:1px;border-color:$bg'></td><td width='" . (100-$1) . "%' bgcolor='$bg' style='background-color:$bg;border-style:solid;border-width:1px;border-color:$bg'>"
|
||||
}
|
||||
print <<END
|
||||
if ($percent eq "100%"){
|
||||
print "<td width='100%' bgcolor='$fg' style='background-color:$fg;border-style:solid;border-width:1px;border-color:$bg'>";
|
||||
}elsif($percent eq "0%"){
|
||||
print "<td width='100%' bgcolor='$bg' style='background-color:$bg;border-style:solid;border-width:1px;border-color:$bg'>";
|
||||
}else{
|
||||
print "<td width='$percent' bgcolor='$fg' style='background-color:$fg;border-style:solid;border-width:1px;border-color:$bg'></td><td width='" . (100-$1) . "%' bgcolor='$bg' style='background-color:$bg;border-style:solid;border-width:1px;border-color:$bg'>";
|
||||
}
|
||||
print <<END
|
||||
<img src='/images/null.gif' width='1' height='1' alt='' /></td></tr></table>
|
||||
END
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
169
html/cgi-bin/netexternal.cgi
Executable file
169
html/cgi-bin/netexternal.cgi
Executable file
@@ -0,0 +1,169 @@
|
||||
#!/usr/bin/perl
|
||||
###############################################################################
|
||||
# #
|
||||
# IPFire.org - A linux based firewall #
|
||||
# Copyright (C) 2008 Michael Tremer & Christian Schmidt #
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
# the Free Software Foundation, either version 3 of the License, or #
|
||||
# (at your option) any later version. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, #
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
# GNU General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License #
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
###############################################################################
|
||||
|
||||
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";
|
||||
require "${General::swroot}/graphs.pl";
|
||||
|
||||
my %color = ();
|
||||
my %mainsettings = ();
|
||||
my %netsettings=();
|
||||
&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
|
||||
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
|
||||
&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
|
||||
|
||||
my @graphs=();
|
||||
my %dhcpinfo=();
|
||||
|
||||
my @querry = split(/\?/,$ENV{'QUERY_STRING'});
|
||||
$querry[0] = '' unless defined $querry[0];
|
||||
$querry[1] = 'hour' unless defined $querry[1];
|
||||
|
||||
if ( $querry[0] ne~ ""){
|
||||
print "Content-type: image/png\n\n";
|
||||
binmode(STDOUT);
|
||||
&Graphs::updateifgraph($querry[0],$querry[1]);
|
||||
}else{
|
||||
|
||||
&Header::showhttpheaders();
|
||||
&Header::openpage($Lang::tr{'network traffic graphs external'}, 1, '');
|
||||
&Header::openbigbox('100%', 'left');
|
||||
|
||||
if ($netsettings{'RED_TYPE'} ne 'PPPOE'){
|
||||
if ($netsettings{'RED_DEV'} ne $netsettings{'GREEN_DEV'}){
|
||||
push (@graphs, ($netsettings{'RED_DEV'}));
|
||||
}
|
||||
}else{
|
||||
push (@graphs, "ppp0");
|
||||
}
|
||||
|
||||
if (-e "/var/log/rrd/collectd/localhost/interface/if_octets-ipsec0.rrd"){
|
||||
push (@graphs, ("ipsec0"));
|
||||
}
|
||||
|
||||
if (-e "/var/log/rrd/collectd/localhost/interface/if_octets-tun0.rrd"){
|
||||
push (@graphs, ("tun0"));
|
||||
}
|
||||
|
||||
foreach (@graphs) {
|
||||
&Header::openbox('100%', 'center', "$_ $Lang::tr{'graph'}");
|
||||
&Graphs::makegraphbox("netexternal.cgi",$_,"day");
|
||||
&Header::closebox();
|
||||
}
|
||||
|
||||
if ( $netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ && $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 "<table width='100%'>";
|
||||
|
||||
if ($dhcpinfo{'HOSTNAME'}) {
|
||||
print "<tr><td width='30%'>$Lang::tr{'hostname'}</td><td>$dhcpinfo{'HOSTNAME'}.$dhcpinfo{'DOMAIN'}</td></tr>\n";
|
||||
} else {
|
||||
print "<tr><td width='30%'>$Lang::tr{'domain'}</td><td>$dhcpinfo{'DOMAIN'}</td></tr>\n";
|
||||
}
|
||||
|
||||
print <<END
|
||||
<tr><td>$Lang::tr{'gateway'}</td><td>$dhcpinfo{'GATEWAY'}</td></tr>
|
||||
<tr><td>$Lang::tr{'primary dns'}</td><td>$DNS1</td></tr>
|
||||
<tr><td>$Lang::tr{'secondary dns'}</td><td>$DNS2</td></tr>
|
||||
<tr><td>$Lang::tr{'dhcp server'}</td><td>$dhcpinfo{'DHCPSIADDR'}</td></tr>
|
||||
<tr><td>$Lang::tr{'def lease time'}</td><td>$leasetime</td></tr>
|
||||
<tr><td>$Lang::tr{'default renewal time'}</td><td>$rnwltime</td></tr>
|
||||
<tr><td>$Lang::tr{'max renewal time'}</td><td>$maxtime</td></tr>
|
||||
</table>
|
||||
END
|
||||
;
|
||||
}else{
|
||||
print "$Lang::tr{'no dhcp lease'}";
|
||||
}
|
||||
&Header::closebox();
|
||||
}
|
||||
|
||||
&Header::closebigbox();
|
||||
&Header::closepage();
|
||||
}
|
||||
87
html/cgi-bin/netinternal.cgi
Executable file
87
html/cgi-bin/netinternal.cgi
Executable file
@@ -0,0 +1,87 @@
|
||||
#!/usr/bin/perl
|
||||
###############################################################################
|
||||
# #
|
||||
# IPFire.org - A linux based firewall #
|
||||
# Copyright (C) 2008 Michael Tremer & Christian Schmidt #
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
# the Free Software Foundation, either version 3 of the License, or #
|
||||
# (at your option) any later version. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, #
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
# GNU General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License #
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
###############################################################################
|
||||
|
||||
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";
|
||||
require "${General::swroot}/graphs.pl";
|
||||
|
||||
my %color = ();
|
||||
my %mainsettings = ();
|
||||
my %netsettings=();
|
||||
&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
|
||||
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
|
||||
&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
|
||||
|
||||
my @graphs=();
|
||||
my @wireless=();
|
||||
|
||||
my @querry = split(/\?/,$ENV{'QUERY_STRING'});
|
||||
$querry[0] = '' unless defined $querry[0];
|
||||
$querry[1] = 'hour' unless defined $querry[1];
|
||||
$querry[2] = '' unless defined $querry[2];
|
||||
|
||||
if ( $querry[0] =~ /wireless/ ){
|
||||
print "Content-type: image/png\n\n";
|
||||
binmode(STDOUT);
|
||||
$querry[0] =~ s/wireless//g;
|
||||
&Graphs::updatewirelessgraph($querry[0],$querry[1]);
|
||||
}elsif ( $querry[0] ne "" ){
|
||||
print "Content-type: image/png\n\n";
|
||||
binmode(STDOUT);
|
||||
&Graphs::updateifgraph($querry[0],$querry[1]);
|
||||
}else{
|
||||
|
||||
&Header::showhttpheaders();
|
||||
&Header::openpage($Lang::tr{'network traffic graphs internal'}, 1, '');
|
||||
&Header::openbigbox('100%', 'left');
|
||||
|
||||
push (@graphs, ($netsettings{'GREEN_DEV'}));
|
||||
if ($netsettings{'BLUE_DEV'}) {push (@graphs, ($netsettings{'BLUE_DEV'})); }
|
||||
if ($netsettings{'ORANGE_DEV'}) {push (@graphs, ($netsettings{'ORANGE_DEV'})); }
|
||||
|
||||
my @wirelessgraphs = `ls -dA /var/log/rrd/collectd/localhost/wireless*`;
|
||||
foreach (@wirelessgraphs){
|
||||
$_ =~ /(.*)\/wireless-(.*)/;
|
||||
push(@wireless,$2);
|
||||
}
|
||||
|
||||
foreach (@graphs) {
|
||||
&Header::openbox('100%', 'center', "$_ $Lang::tr{'graph'}");
|
||||
&Graphs::makegraphbox("netinternal.cgi",$_,"day");
|
||||
&Header::closebox();
|
||||
}
|
||||
|
||||
foreach (@wireless) {
|
||||
&Header::openbox('100%', 'center', "Wireless $_ $Lang::tr{'graph'}");
|
||||
&Graphs::makegraphbox("netinternal.cgi","wireless".$_,"day");
|
||||
&Header::closebox();
|
||||
}
|
||||
|
||||
&Header::closebigbox();
|
||||
&Header::closepage();
|
||||
}
|
||||
77
html/cgi-bin/proxygraphs.cgi → html/cgi-bin/netother.cgi
Normal file → Executable file
77
html/cgi-bin/proxygraphs.cgi → html/cgi-bin/netother.cgi
Normal file → Executable file
@@ -2,7 +2,7 @@
|
||||
###############################################################################
|
||||
# #
|
||||
# IPFire.org - A linux based firewall #
|
||||
# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
|
||||
# Copyright (C) 2008 Michael Tremer & Christian Schmidt #
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
@@ -28,50 +28,49 @@ use strict;
|
||||
require '/var/ipfire/general-functions.pl';
|
||||
require "${General::swroot}/lang.pl";
|
||||
require "${General::swroot}/header.pl";
|
||||
require "${General::swroot}/graphs.pl";
|
||||
|
||||
my %cgiparams=();
|
||||
my %pppsettings=();
|
||||
my %netsettings=();
|
||||
my @graphs=();
|
||||
my %color = ();
|
||||
my %mainsettings = ();
|
||||
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
|
||||
&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
|
||||
|
||||
&Header::showhttpheaders();
|
||||
my @pings=();
|
||||
|
||||
my $dir = "/srv/web/ipfire/html/sgraph";
|
||||
$cgiparams{'ACTION'} = '';
|
||||
&Header::getcgihash(\%cgiparams);
|
||||
my $sgraphdir = "/srv/web/ipfire/html/sgraph";
|
||||
my @querry = split(/\?/,$ENV{'QUERY_STRING'});
|
||||
$querry[0] = '' unless defined $querry[0];
|
||||
$querry[1] = 'hour' unless defined $querry[1];
|
||||
|
||||
&Header::openpage($Lang::tr{'proxy access graphs'}, 1, '');
|
||||
if ( $querry[0] =~ "fwhits"){
|
||||
print "Content-type: image/png\n\n";
|
||||
binmode(STDOUT);
|
||||
&Graphs::updatefwhitsgraph($querry[0],$querry[1]);
|
||||
}elsif ( $querry[0] ne ""){
|
||||
print "Content-type: image/png\n\n";
|
||||
binmode(STDOUT);
|
||||
&Graphs::updatepinggraph($querry[0],$querry[1]);
|
||||
}else{
|
||||
|
||||
&Header::openbigbox('100%', 'left');
|
||||
|
||||
&Header::openbox('100%', 'left', $Lang::tr{'proxy access graphs'} . ":" );
|
||||
|
||||
if (open(IPACHTML, "$sgraphdir/index.html"))
|
||||
{
|
||||
my $skip = 1;
|
||||
while (<IPACHTML>)
|
||||
{
|
||||
$skip = 1 if /^<HR>$/;
|
||||
if ($skip)
|
||||
{
|
||||
$skip = 0 if /<H1>/;
|
||||
next;
|
||||
}
|
||||
s/<IMG SRC=([^"'>]+)>/<img src='\/sgraph\/$1' alt='Graph' \/>/;
|
||||
s/<HR>/<hr \/>/g;
|
||||
s/<BR>/<br \/>/g;
|
||||
s/<([^>]*)>/\L<$1>\E/g;
|
||||
s/(size|align|border|color)=([^'"> ]+)/$1='$2'/g;
|
||||
print;
|
||||
&Header::showhttpheaders();
|
||||
&Header::openpage($Lang::tr{'network traffic graphs others'}, 1, '');
|
||||
&Header::openbigbox('100%', 'left');
|
||||
|
||||
my @pinggraphs = `ls -dA /var/log/rrd/collectd/localhost/ping/*`;
|
||||
foreach (@pinggraphs){
|
||||
$_ =~ /(.*)\/ping\/ping-(.*)\.rrd/;
|
||||
push(@pings,$2);
|
||||
}
|
||||
close(IPACHTML);
|
||||
}
|
||||
else {
|
||||
print $Lang::tr{'no information available'}; }
|
||||
|
||||
&Header::closebox();
|
||||
foreach (@pings) {
|
||||
&Header::openbox('100%', 'center', "$_ $Lang::tr{'graph'}");
|
||||
&Graphs::makegraphbox("netother.cgi",$_,"day");
|
||||
&Header::closebox();
|
||||
}
|
||||
|
||||
&Header::closebigbox();
|
||||
&Header::openbox('100%', 'center', "Firewall Hits $Lang::tr{'graph'}");
|
||||
&Graphs::makegraphbox("netother.cgi","fwhits","day");
|
||||
&Header::closebox();
|
||||
|
||||
&Header::closepage();
|
||||
&Header::closebigbox();
|
||||
&Header::closepage();
|
||||
}
|
||||
@@ -1,251 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
###############################################################################
|
||||
# #
|
||||
# IPFire.org - A linux based firewall #
|
||||
# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
# the Free Software Foundation, either version 3 of the License, or #
|
||||
# (at your option) any later version. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, #
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
# GNU General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License #
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
###############################################################################
|
||||
|
||||
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";
|
||||
require "${General::swroot}/graphs.pl";
|
||||
|
||||
my %cgiparams=();
|
||||
my %pppsettings=();
|
||||
my %netsettings=();
|
||||
my @cgiparams=();
|
||||
my @graphs=();
|
||||
my @pings=();
|
||||
my @wireless=();
|
||||
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, '');
|
||||
if ($netsettings{'RED_TYPE'} ne 'PPPOE') {
|
||||
if ($netsettings{'RED_DEV'} ne $netsettings{'GREEN_DEV'}) {
|
||||
push (@graphs, ($netsettings{'RED_DEV'}));
|
||||
}
|
||||
} else {
|
||||
push (@graphs, "ppp0");
|
||||
}
|
||||
if (-e "/var/log/rrd/collectd/localhost/interface/if_octets-ipsec0.rrd") {push (@graphs, ("ipsec0"));}
|
||||
if (-e "/var/log/rrd/collectd/localhost/interface/if_octets-tun0.rrd") {push (@graphs, ("tun0"));}
|
||||
}elsif ($cgiparams[1] =~ /other/) {
|
||||
&Header::openpage($Lang::tr{'network traffic graphs others'}, 1, '');
|
||||
my @pinggraphs = `ls -dA /var/log/rrd/collectd/localhost/ping/*`;
|
||||
foreach (@pinggraphs){
|
||||
$_ =~ /(.*)\/ping\/ping-(.*)\.rrd/;
|
||||
push(@pings,$2);
|
||||
}
|
||||
push (@graphs, ("fwhits"));
|
||||
|
||||
}else {
|
||||
&Header::openpage($Lang::tr{'network traffic graphs internal'}, 1, '');
|
||||
push (@graphs, ($netsettings{'GREEN_DEV'}));
|
||||
if ($netsettings{'BLUE_DEV'}) {
|
||||
push (@graphs, ($netsettings{'BLUE_DEV'})); }
|
||||
if ($netsettings{'ORANGE_DEV'}) {
|
||||
push (@graphs, ($netsettings{'ORANGE_DEV'})); }
|
||||
my @wirelessgraphs = `ls -dA /var/log/rrd/collectd/localhost/wireless*`;
|
||||
foreach (@wirelessgraphs){
|
||||
$_ =~ /(.*)\/wireless-(.*)/;
|
||||
push(@wireless,$2);
|
||||
}
|
||||
}
|
||||
|
||||
&Header::openbigbox('100%', 'left');
|
||||
|
||||
foreach my $graphname (@pings) {
|
||||
|
||||
if ($graphname eq "gateway" )
|
||||
{ &Graphs::updatepinggraph("day","gateway"); }
|
||||
else
|
||||
{ &Graphs::updatepinggraph("day","$graphname"); }
|
||||
|
||||
&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 "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
|
||||
print "<a href='/cgi-bin/graphs.cgi?graph=$graphname&graph=ping'>";
|
||||
print "<img alt='' src='/graphs/${graphname}-day.png' border='0' />";
|
||||
print "</a>";
|
||||
} else {
|
||||
print $Lang::tr{'no information available'};
|
||||
}
|
||||
print "<br />\n";
|
||||
&Header::closebox();
|
||||
}
|
||||
|
||||
foreach my $graphname (@graphs) {
|
||||
|
||||
if ($graphname eq "fwhits" )
|
||||
{ &Graphs::updatefwhitsgraph("day"); }
|
||||
else
|
||||
{ &Graphs::updateifgraph($graphname, "day"); }
|
||||
|
||||
&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 "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
|
||||
print "<a href='/cgi-bin/graphs.cgi?graph=$graphname'>";
|
||||
print "<img alt='' src='/graphs/${graphname}-day.png' border='0' />";
|
||||
print "</a>";
|
||||
} else {
|
||||
print $Lang::tr{'no information available'};
|
||||
}
|
||||
print "<br />\n";
|
||||
&Header::closebox();
|
||||
}
|
||||
|
||||
foreach my $graphname (@wireless) {
|
||||
|
||||
&Graphs::wireless("day",$graphname);
|
||||
|
||||
&Header::openbox('100%', 'center', "wireless $graphname $Lang::tr{'graph'}");
|
||||
if (-e "$Header::graphdir/wireless-${graphname}-day.png") {
|
||||
my $ftime = localtime((stat("$Header::graphdir/wireless-${graphname}-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=wireless&graph=$graphname'>";
|
||||
print "<img alt='' src='/graphs/wireless-${graphname}-day.png' border='0' />";
|
||||
print "</a>";
|
||||
} else {
|
||||
print $Lang::tr{'no information available'};
|
||||
}
|
||||
print "<br />\n";
|
||||
&Header::closebox();
|
||||
}
|
||||
|
||||
if ($cgiparams[1] =~ /red/) {
|
||||
|
||||
if ( $netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ && $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 "<table width='100%'>";
|
||||
if ($dhcpinfo{'HOSTNAME'}) {
|
||||
print "<tr><td width='30%'>$Lang::tr{'hostname'}</td><td>$dhcpinfo{'HOSTNAME'}.$dhcpinfo{'DOMAIN'}</td></tr>\n";
|
||||
} else {
|
||||
print "<tr><td width='30%'>$Lang::tr{'domain'}</td><td>$dhcpinfo{'DOMAIN'}</td></tr>\n";
|
||||
}
|
||||
print <<END
|
||||
<tr><td>$Lang::tr{'gateway'}</td><td>$dhcpinfo{'GATEWAY'}</td></tr>
|
||||
<tr><td>$Lang::tr{'primary dns'}</td><td>$DNS1</td></tr>
|
||||
<tr><td>$Lang::tr{'secondary dns'}</td><td>$DNS2</td></tr>
|
||||
<tr><td>$Lang::tr{'dhcp server'}</td><td>$dhcpinfo{'DHCPSIADDR'}</td></tr>
|
||||
<tr><td>$Lang::tr{'def lease time'}</td><td>$leasetime</td></tr>
|
||||
<tr><td>$Lang::tr{'default renewal time'}</td><td>$rnwltime</td></tr>
|
||||
<tr><td>$Lang::tr{'max renewal time'}</td><td>$maxtime</td></tr>
|
||||
</table>
|
||||
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 "<pre>$output</pre>\n";
|
||||
&Header::closebox();
|
||||
|
||||
&Header::openbox('100%', 'left', $Lang::tr{'arp table entries'});
|
||||
$output = `/sbin/ip neigh show`;
|
||||
$output = &Header::cleanhtml($output,"y");
|
||||
print "<pre>$output</pre>\n";
|
||||
&Header::closebox();
|
||||
|
||||
}
|
||||
|
||||
&Header::closebigbox();
|
||||
&Header::closepage();
|
||||
@@ -2,7 +2,7 @@
|
||||
###############################################################################
|
||||
# #
|
||||
# IPFire.org - A linux based firewall #
|
||||
# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
|
||||
# Copyright (C) 2008 Michael Tremer & Christian Schmidt #
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
@@ -22,33 +22,30 @@
|
||||
use strict;
|
||||
|
||||
# enable only the following on debugging purpose
|
||||
#use warnings;
|
||||
#use CGI::Carp 'fatalsToBrowser';
|
||||
use warnings;
|
||||
use CGI::Carp 'fatalsToBrowser';
|
||||
|
||||
require '/var/ipfire/general-functions.pl';
|
||||
require "${General::swroot}/lang.pl";
|
||||
require "${General::swroot}/header.pl";
|
||||
require "${General::swroot}/graphs.pl";
|
||||
|
||||
my %color = ();
|
||||
my %mainsettings = ();
|
||||
my %netsettings=();
|
||||
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
|
||||
&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
|
||||
&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
|
||||
|
||||
#workaround to suppress a warning when a variable is used only once
|
||||
my @dummy = ( ${Header::colourred} );
|
||||
undef (@dummy);
|
||||
|
||||
my %color = ();
|
||||
my %mainsettings = ();
|
||||
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
|
||||
&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
|
||||
|
||||
my %netsettings=();
|
||||
&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
|
||||
|
||||
&Graphs::updateprocessesgraph ("day");
|
||||
|
||||
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 =
|
||||
(
|
||||
my %servicenames =(
|
||||
$Lang::tr{'dhcp server'} => 'dhcpd',
|
||||
$Lang::tr{'web server'} => 'httpd',
|
||||
$Lang::tr{'cron server'} => 'fcron',
|
||||
@@ -65,65 +62,73 @@ my %servicenames =
|
||||
my $lines=0; # Used to count the outputlines to make different bgcolor
|
||||
|
||||
my $iface = '';
|
||||
if (open(FILE, "${General::swroot}/red/iface"))
|
||||
{
|
||||
if (open(FILE, "${General::swroot}/red/iface")){
|
||||
$iface = <FILE>;
|
||||
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 '') {
|
||||
|
||||
if ($netsettings{'ORANGE_DEV'} ne ''){
|
||||
$servicenames{"$Lang::tr{'intrusion detection system'} (ORANGE)"} = "snort_$netsettings{'ORANGE_DEV'}";
|
||||
}
|
||||
if ($netsettings{'BLUE_DEV'} ne '') {
|
||||
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');
|
||||
my @querry = split(/\?/,$ENV{'QUERY_STRING'});
|
||||
$querry[0] = '' unless defined $querry[0];
|
||||
$querry[1] = 'hour' unless defined $querry[1];
|
||||
|
||||
&Header::openbox('100%', 'left', $Lang::tr{'services'});
|
||||
if ( $querry[0] =~ "processescpu"){
|
||||
print "Content-type: image/png\n\n";
|
||||
binmode(STDOUT);
|
||||
&Graphs::updateprocessescpugraph($querry[1]);
|
||||
}elsif ( $querry[0] =~ "processesmemory"){
|
||||
print "Content-type: image/png\n\n";
|
||||
binmode(STDOUT);
|
||||
&Graphs::updateprocessesmemorygraph($querry[1]);
|
||||
}else{
|
||||
&Header::showhttpheaders();
|
||||
&Header::openpage($Lang::tr{'status information'}, 1, '');
|
||||
&Header::openbigbox('100%', 'left');
|
||||
|
||||
print <<END
|
||||
&Header::openbox('100%', 'left', $Lang::tr{'services'});
|
||||
print <<END
|
||||
<div align='center'>
|
||||
<table width='80%' cellspacing='1' border='0'>
|
||||
<tr bgcolor='$color{'color20'}'><td align='left'><b>$Lang::tr{'services'}</b></td><td align='center' ><b>$Lang::tr{'status'}</b></td><td align='center'><b>PID</b></td><td align='center'><b>$Lang::tr{'memory'}</b></td></tr>
|
||||
END
|
||||
;
|
||||
my $key = '';
|
||||
foreach $key (sort keys %servicenames){
|
||||
$lines++;
|
||||
if ($lines % 2){
|
||||
print "<tr bgcolor='$color{'color22'}'>\n<td align='left'>$key</td>\n";
|
||||
}else{
|
||||
print "<tr bgcolor='$color{'color20'}'>\n<td align='left'>$key</td>\n";
|
||||
}
|
||||
|
||||
my $key = '';
|
||||
foreach $key (sort keys %servicenames)
|
||||
{
|
||||
$lines++;
|
||||
if ($lines % 2)
|
||||
{ print "<tr bgcolor='$color{'color22'}'>\n<td align='left'>$key</td>\n";}
|
||||
else
|
||||
{ print "<tr bgcolor='$color{'color20'}'>\n<td align='left'>$key</td>\n";}
|
||||
my $shortname = $servicenames{$key};
|
||||
my $status = &isrunning($shortname);
|
||||
|
||||
my $shortname = $servicenames{$key};
|
||||
my $status = &isrunning($shortname);
|
||||
print "$status\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print "$status\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
print "</table></div>\n";
|
||||
&Header::closebox();
|
||||
|
||||
&Header::openbox('100%', 'left', "Addon - $Lang::tr{services}");
|
||||
my $paramstr=$ENV{QUERY_STRING};
|
||||
my @param=split(/!/, $paramstr);
|
||||
if ($param[1] ne ''){
|
||||
system("/usr/local/bin/addonctrl @param[0] @param[1] > /dev/null 2>&1");
|
||||
}
|
||||
|
||||
print "</table></div>\n";
|
||||
|
||||
&Header::closebox();
|
||||
|
||||
&Header::openbox('100%', 'left', "Addon - $Lang::tr{services}");
|
||||
|
||||
my $paramstr=$ENV{QUERY_STRING};
|
||||
my @param=split(/!/, $paramstr);
|
||||
if ($param[1] ne '') {
|
||||
system("/usr/local/bin/addonctrl @param[0] @param[1] > /dev/null 2>&1");
|
||||
}
|
||||
|
||||
print <<END
|
||||
print <<END
|
||||
<div align='center'>
|
||||
<table width='80%' cellspacing='1' border='0'>
|
||||
<tr bgcolor='$color{'color20'}'>
|
||||
@@ -137,101 +142,76 @@ print <<END
|
||||
END
|
||||
;
|
||||
|
||||
my $lines=0; # Used to count the outputlines to make different bgcolor
|
||||
my $lines=0; # Used to count the outputlines to make different bgcolor
|
||||
|
||||
# Generate list of installed addon pak's
|
||||
my @pak = `find /opt/pakfire/db/installed/meta-* 2>/dev/null | cut -d"-" -f2`;
|
||||
foreach (@pak)
|
||||
{
|
||||
chomp($_);
|
||||
# Generate list of installed addon pak's
|
||||
my @pak = `find /opt/pakfire/db/installed/meta-* 2>/dev/null | cut -d"-" -f2`;
|
||||
foreach (@pak){
|
||||
chomp($_);
|
||||
|
||||
# Check which of the paks are services
|
||||
my @svc = `find /etc/init.d/$_ 2>/dev/null | cut -d"/" -f4`;
|
||||
foreach (@svc)
|
||||
{
|
||||
# blacklist some packages
|
||||
#
|
||||
# alsa has trouble with the volume saving and was not really stopped
|
||||
#
|
||||
chomp($_);
|
||||
if ($_ ne "alsa")
|
||||
{
|
||||
$lines++;
|
||||
if ($lines % 2)
|
||||
{
|
||||
print "<tr bgcolor='$color{'color22'}'>";
|
||||
# Check which of the paks are services
|
||||
my @svc = `find /etc/init.d/$_ 2>/dev/null | cut -d"/" -f4`;
|
||||
foreach (@svc){
|
||||
# blacklist some packages
|
||||
#
|
||||
# alsa has trouble with the volume saving and was not really stopped
|
||||
#
|
||||
chomp($_);
|
||||
if ($_ ne "alsa"){
|
||||
$lines++;
|
||||
if ($lines % 2){
|
||||
print "<tr bgcolor='$color{'color22'}'>";
|
||||
}else{
|
||||
print "<tr bgcolor='$color{'color20'}'>";
|
||||
}
|
||||
print "<td align='left'>$_</td> ";
|
||||
my $status = isautorun($_);
|
||||
print "$status ";
|
||||
print "<td align='center'><A HREF=services.cgi?$_!start><img alt='$Lang::tr{'start'}' title='$Lang::tr{'start'}' src='/images/go-up.png' border='0' /></A></td>";
|
||||
print "<td align='center'><A HREF=services.cgi?$_!stop><img alt='$Lang::tr{'stop'}' title='$Lang::tr{'stop'}' src='/images/go-down.png' border='0' /></A></td> ";
|
||||
my $status = &isrunningaddon($_);
|
||||
$status =~ s/\\[[0-1]\;[0-9]+m//g;
|
||||
|
||||
chomp($status);
|
||||
print "$status";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<tr bgcolor='$color{'color20'}'>";
|
||||
}
|
||||
print "<td align='left'>$_</td> ";
|
||||
my $status = isautorun($_);
|
||||
print "$status ";
|
||||
print "<td align='center'><A HREF=services.cgi?$_!start><img alt='$Lang::tr{'start'}' title='$Lang::tr{'start'}' src='/images/go-up.png' border='0' /></A></td>";
|
||||
print "<td align='center'><A HREF=services.cgi?$_!stop><img alt='$Lang::tr{'stop'}' title='$Lang::tr{'stop'}' src='/images/go-down.png' border='0' /></A></td> ";
|
||||
my $status = &isrunningaddon($_);
|
||||
$status =~ s/\\[[0-1]\;[0-9]+m//g;
|
||||
|
||||
chomp($status);
|
||||
print "$status";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
|
||||
print "</table></div>\n";
|
||||
&Header::closebox();
|
||||
|
||||
&Header::openbox('100%', 'center', "$Lang::tr{'processes'} $Lang::tr{'graph'}");
|
||||
&Graphs::makegraphbox("services.cgi","processescpu","day");
|
||||
&Header::closebox();
|
||||
|
||||
&Header::openbox('100%', 'center', "$Lang::tr{'processes'} $Lang::tr{'memory'} $Lang::tr{'graph'}");
|
||||
&Graphs::makegraphbox("services.cgi","processesmemory","day");
|
||||
&Header::closebox();
|
||||
|
||||
&Header::closebigbox();
|
||||
&Header::closepage();
|
||||
}
|
||||
|
||||
print "</table></div>\n";
|
||||
|
||||
&Header::closebox();
|
||||
|
||||
&Header::openbox('100%', 'center', "$Lang::tr{'processes'} $Lang::tr{'graph'}");
|
||||
if (-e "$Header::graphdir/processes-day.png") {
|
||||
my $ftime = localtime((stat("$Header::graphdir/processes-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=processes'>";
|
||||
print "<img alt='' src='/graphs/processes-day.png' border='0' />";
|
||||
print "</a>";
|
||||
} else {
|
||||
print $Lang::tr{'no information available'};
|
||||
}
|
||||
print "<br />\n";
|
||||
&Header::closebox();
|
||||
|
||||
&Header::openbox('100%', 'center', "$Lang::tr{'processes'} $Lang::tr{'memory'} $Lang::tr{'graph'}");
|
||||
if (-e "$Header::graphdir/processesmem-day.png") {
|
||||
my $ftime = localtime((stat("$Header::graphdir/processesmem-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=processesmem'>";
|
||||
print "<img alt='' src='/graphs/processesmem-day.png' border='0' />";
|
||||
print "</a>";
|
||||
} else {
|
||||
print $Lang::tr{'no information available'};
|
||||
}
|
||||
print "<br />\n";
|
||||
&Header::closebox();
|
||||
&Header::closebigbox();
|
||||
&Header::closepage();
|
||||
|
||||
sub isautorun
|
||||
{
|
||||
sub isautorun{
|
||||
my $cmd = $_[0];
|
||||
my $status = "<td align='center'></td>";
|
||||
my $init = `find /etc/rc.d/rc3.d/S??${cmd} 2>/dev/null`;
|
||||
chomp ($init);
|
||||
if ($init ne '') {
|
||||
$status = "<td align='center'><A HREF=services.cgi?$_!disable><img alt='$Lang::tr{'deactivate'}' title='$Lang::tr{'deactivate'}' src='/images/on.gif' border='0' width='16' height='16' /></A></td>";
|
||||
if ($init ne ''){
|
||||
$status = "<td align='center'><A HREF=services.cgi?$_!disable><img alt='$Lang::tr{'deactivate'}' title='$Lang::tr{'deactivate'}' src='/images/on.gif' border='0' width='16' height='16' /></A></td>";
|
||||
}
|
||||
$init = `find /etc/rc.d/rc3.d/off/S??${cmd} 2>/dev/null`;
|
||||
chomp ($init);
|
||||
if ($init ne '') {
|
||||
$status = "<td align='center'><A HREF=services.cgi?$_!enable><img alt='$Lang::tr{'activate'}' title='$Lang::tr{'activate'}' src='/images/off.gif' border='0' width='16' height='16' /></A></td>";
|
||||
if ($init ne ''){
|
||||
$status = "<td align='center'><A HREF=services.cgi?$_!enable><img alt='$Lang::tr{'activate'}' title='$Lang::tr{'activate'}' src='/images/off.gif' border='0' width='16' height='16' /></A></td>";
|
||||
}
|
||||
|
||||
return $status;
|
||||
return $status;
|
||||
}
|
||||
|
||||
sub isrunning
|
||||
{
|
||||
sub isrunning{
|
||||
my $cmd = $_[0];
|
||||
my $status = "<td align='center' bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td><td colspan='2'></td>";
|
||||
my $pid = '';
|
||||
@@ -247,7 +227,9 @@ sub isrunning
|
||||
close FILE;
|
||||
if (open(FILE, "/proc/${pid}/status")){
|
||||
while (<FILE>){
|
||||
if (/^Name:\W+(.*)/) {$testcmd = $1; }
|
||||
if (/^Name:\W+(.*)/) {
|
||||
$testcmd = $1;
|
||||
}
|
||||
}
|
||||
close FILE;
|
||||
}
|
||||
@@ -256,13 +238,14 @@ sub isrunning
|
||||
@memory = split(/ /,$temp);
|
||||
}
|
||||
close FILE;
|
||||
if ($testcmd =~ /$exename/){$status = "<td align='center' bgcolor='${Header::colourgreen}'><font color='white'><b>$Lang::tr{'running'}</b></font></td><td align='center'>$pid</td><td align='center'>$memory[0] KB</td>";}
|
||||
if ($testcmd =~ /$exename/){
|
||||
$status = "<td align='center' bgcolor='${Header::colourgreen}'><font color='white'><b>$Lang::tr{'running'}</b></font></td><td align='center'>$pid</td><td align='center'>$memory[0] KB</td>";
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
|
||||
sub isrunningaddon
|
||||
{
|
||||
sub isrunningaddon{
|
||||
my $cmd = $_[0];
|
||||
my $status = "<td align='center' bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td><td colspan='2'></td>";
|
||||
my $pid = '';
|
||||
@@ -273,24 +256,29 @@ sub isrunningaddon
|
||||
my $testcmd = `/usr/local/bin/addonctrl $_ status`;
|
||||
|
||||
if ( $testcmd =~ /is\ running/ && $testcmd !~ /is\ not\ running/){
|
||||
$status = "<td align='center' bgcolor='${Header::colourgreen}'><font color='white'><b>$Lang::tr{'running'}</b></font></td>";
|
||||
$testcmd =~ s/[a-z_]//gi; $testcmd =~ s/\[[0-1]\;[0-9]+//gi; $testcmd =~ s/[\(\)\.]//gi; $testcmd =~ s/ //gi; $testcmd =~ s///gi;
|
||||
$status = "<td align='center' bgcolor='${Header::colourgreen}'><font color='white'><b>$Lang::tr{'running'}</b></font></td>";
|
||||
$testcmd =~ s/[a-z_]//gi;
|
||||
$testcmd =~ s/\[[0-1]\;[0-9]+//gi;
|
||||
$testcmd =~ s/[\(\)\.]//gi;
|
||||
$testcmd =~ s/ //gi;
|
||||
$testcmd =~ s///gi;
|
||||
|
||||
my @pid = split(/\s/,$testcmd);
|
||||
$status .="<td align='center'>$pid[0]</td>";
|
||||
my @pid = split(/\s/,$testcmd);
|
||||
$status .="<td align='center'>$pid[0]</td>";
|
||||
|
||||
my $memory = 0;
|
||||
my $memory = 0;
|
||||
|
||||
foreach (@pid){
|
||||
chomp($_);
|
||||
if (open(FILE, "/proc/$_/statm")){
|
||||
foreach (@pid){
|
||||
chomp($_);
|
||||
if (open(FILE, "/proc/$_/statm")){
|
||||
my $temp = <FILE>;
|
||||
@memory = split(/ /,$temp);
|
||||
@memory = split(/ /,$temp);
|
||||
}
|
||||
$memory+=$memory[0];
|
||||
}
|
||||
$memory+=$memory[0];
|
||||
$status .="<td align='center'>$memory KB</td>";
|
||||
}else{
|
||||
$status = "<td align='center' bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td><td colspan='2'></td>";
|
||||
}
|
||||
$status .="<td align='center'>$memory KB</td>";
|
||||
}
|
||||
else {$status = "<td align='center' bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td><td colspan='2'></td>";}
|
||||
return $status;
|
||||
return $status;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
###############################################################################
|
||||
# #
|
||||
# IPFire.org - A linux based firewall #
|
||||
# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
|
||||
# Copyright (C) 2008 Michael Tremer & Christian Schmidt #
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
@@ -35,53 +35,31 @@ my %mainsettings = ();
|
||||
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
|
||||
&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
|
||||
|
||||
my %cgiparams=();
|
||||
my @querry = split(/\?/,$ENV{'QUERY_STRING'});
|
||||
$querry[0] = '' unless defined $querry[0];
|
||||
$querry[1] = 'hour' unless defined $querry[1];
|
||||
|
||||
# Generate Graphs from rrd Data
|
||||
&Graphs::updatecpugraph ("day");
|
||||
&Graphs::updatecpufreqgraph ("day");
|
||||
&Graphs::updateloadgraph ("day");
|
||||
if ( $querry[0] =~ "cpu"){
|
||||
print "Content-type: image/png\n\n";
|
||||
binmode(STDOUT);
|
||||
&Graphs::updatecpugraph($querry[1]);
|
||||
}elsif ( $querry[0] =~ "load"){
|
||||
print "Content-type: image/png\n\n";
|
||||
binmode(STDOUT);
|
||||
&Graphs::updateloadgraph($querry[1]);
|
||||
}else{
|
||||
&Header::showhttpheaders();
|
||||
&Header::openpage($Lang::tr{'status information'}, 1, '');
|
||||
&Header::openbigbox('100%', 'left');
|
||||
|
||||
&Header::showhttpheaders();
|
||||
&Header::getcgihash(\%cgiparams);
|
||||
&Header::openpage($Lang::tr{'status information'}, 1, '');
|
||||
&Header::openbigbox('100%', 'left');
|
||||
&Header::openbox('100%', 'center', "CPU $Lang::tr{'graph'}");
|
||||
&Graphs::makegraphbox("system.cgi","cpu","day","315");
|
||||
&Header::closebox();
|
||||
|
||||
&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 "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
|
||||
print "<a href='/cgi-bin/graphs.cgi?graph=cpu'>";
|
||||
print "<img alt='' src='/graphs/cpu-day.png' border='0' />";
|
||||
print "</a>";
|
||||
} else {
|
||||
print $Lang::tr{'no information available'};
|
||||
&Header::openbox('100%', 'center', "Load $Lang::tr{'graph'}");
|
||||
&Graphs::makegraphbox("system.cgi","load","day");
|
||||
&Header::closebox();
|
||||
|
||||
&Header::closebigbox();
|
||||
&Header::closepage();
|
||||
}
|
||||
print "<br />\n";
|
||||
&Header::closebox();
|
||||
|
||||
if (-e "$Header::graphdir/cpufreq-day.png") {
|
||||
&Header::openbox('100%', 'center', "CPU Frequency $Lang::tr{'graph'}");
|
||||
my $ftime = localtime((stat("$Header::graphdir/cpufreq-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=cpufreq'>";
|
||||
print "<img alt='' src='/graphs/cpufreq-day.png' border='0' />";
|
||||
print "</a>";
|
||||
print "<br />\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 "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
|
||||
print "<a href='/cgi-bin/graphs.cgi?graph=load'>";
|
||||
print "<img alt='' src='/graphs/load-day.png' border='0' />";
|
||||
print "</a>";
|
||||
} else {
|
||||
print $Lang::tr{'no information available'};
|
||||
}
|
||||
print "<br />\n";
|
||||
&Header::closebox();
|
||||
&Header::closebigbox();
|
||||
&Header::closepage();
|
||||
|
||||
@@ -1,373 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
###############################################################################
|
||||
# #
|
||||
# IPFire.org - A linux based firewall #
|
||||
# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
# the Free Software Foundation, either version 3 of the License, or #
|
||||
# (at your option) any later version. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, #
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
# GNU General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License #
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
###############################################################################
|
||||
|
||||
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";
|
||||
require "${General::swroot}/net-traffic/net-traffic-admin.pl";
|
||||
require "${General::swroot}/net-traffic/net-traffic-lib.pl";
|
||||
|
||||
my %color = ();
|
||||
my %mainsettings = ();
|
||||
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
|
||||
&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
|
||||
|
||||
my %cgiparams;
|
||||
my %netsettings;
|
||||
|
||||
&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
|
||||
|
||||
my @days = ( 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 );
|
||||
|
||||
my @now = localtime(time);
|
||||
|
||||
$now[5] = $now[5]+1900;
|
||||
|
||||
$cgiparams{'STARTDAY'} = 10;
|
||||
$cgiparams{'STOPDAY'} = 11;
|
||||
$cgiparams{'STARTYEAR'} = $now[5];
|
||||
$cgiparams{'STOPYEAR'} = $now[5];
|
||||
|
||||
if($NETTRAFF::settings{'MONTHLY_VOLUME_ON'} eq 'on')
|
||||
{
|
||||
$cgiparams{'STARTDAY'} = $NETTRAFF::settings{'STARTDAY'};
|
||||
$cgiparams{'STOPDAY'} = $NETTRAFF::settings{'STARTDAY'};
|
||||
}
|
||||
|
||||
# this periode started last month
|
||||
if ($now[3] < $cgiparams{'STARTDAY'}) {
|
||||
$cgiparams{'STARTMONTH'} = $now[4]-1;
|
||||
$cgiparams{'STOPMONTH'} = $now[4];
|
||||
# when current month is january we start in last year december
|
||||
if ($cgiparams{'STOPMONTH'} == 0) {
|
||||
$cgiparams{'STARTYEAR'} = $now[5]-1;
|
||||
$cgiparams{'STARTMONTH'} = 11;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$cgiparams{'STARTMONTH'} = $now[4];
|
||||
$cgiparams{'STOPMONTH'} = $now[4]+1;
|
||||
# when we are in december, this periode ends next year january
|
||||
if ($cgiparams{'STARTMONTH'} == 11) {
|
||||
$cgiparams{'STOPYEAR'} = $now[5]+1;
|
||||
$cgiparams{'STOPMONTH'} = 0;
|
||||
}
|
||||
}
|
||||
|
||||
&Header::getcgihash(\%cgiparams);
|
||||
&Header::showhttpheaders();
|
||||
&Header::openpage($Lang::tr{'sstraffic'}, 1, '');
|
||||
&Header::openbigbox('100%', 'left');
|
||||
&Header::openbox('100%', 'left', "");
|
||||
|
||||
print <<END;
|
||||
<table width='100%' align='center'>
|
||||
<tr>
|
||||
<td width='90%' class='base' align='center'>
|
||||
<form method='post' action='/cgi-bin/traffics.cgi'>
|
||||
$Lang::tr{'trafficfrom'}
|
||||
<select name='STARTDAY'>
|
||||
END
|
||||
|
||||
foreach my $day (@days)
|
||||
{
|
||||
print "\t<option ";
|
||||
if ($day == $cgiparams{'STARTDAY'}) {
|
||||
print 'selected=\'selected\' '; }
|
||||
print "value='$day'>$day</option>\n";
|
||||
}
|
||||
print <<END;
|
||||
</select>
|
||||
<select name='STARTMONTH'>
|
||||
END
|
||||
|
||||
foreach my $month (@NETTRAFF::months)
|
||||
{
|
||||
print "\t<option ";
|
||||
if ($month == $cgiparams{'STARTMONTH'}) {
|
||||
print 'selected=\'selected\' '; }
|
||||
print "value='$month'>$NETTRAFF::longmonths[$month]</option>\n";
|
||||
}
|
||||
|
||||
print <<END;
|
||||
</select>
|
||||
<select name='STARTYEAR'>
|
||||
END
|
||||
|
||||
foreach my $year (@NETTRAFF::years) {
|
||||
print "\t<option ";
|
||||
if ($year == $cgiparams{'STARTYEAR'}) {
|
||||
print 'selected=\'selected\' '; }
|
||||
print "value='$year'>$year</option>\n";
|
||||
}
|
||||
|
||||
print <<END;
|
||||
</select>
|
||||
$Lang::tr{'trafficto'}
|
||||
<select name='STOPDAY'>
|
||||
END
|
||||
|
||||
foreach my $day (@days)
|
||||
{
|
||||
print "\t<option ";
|
||||
if ($day == $cgiparams{'STOPDAY'})
|
||||
{
|
||||
print 'selected=\'selected\' '; }
|
||||
print "value='$day'>$day</option>\n";
|
||||
}
|
||||
|
||||
print <<END;
|
||||
</select>
|
||||
<select name='STOPMONTH'>
|
||||
END
|
||||
|
||||
foreach my $month (@NETTRAFF::months)
|
||||
{
|
||||
print "\t<option ";
|
||||
if ($month == $cgiparams{'STOPMONTH'}) {
|
||||
print 'selected=\'selected\' '; }
|
||||
print "value='$month'>$NETTRAFF::longmonths[$month]</option>\n";
|
||||
}
|
||||
|
||||
print <<END;
|
||||
</select>
|
||||
<select name='STOPYEAR'>
|
||||
END
|
||||
|
||||
foreach my $year (@NETTRAFF::years) {
|
||||
print "\t<option ";
|
||||
if ($year == $cgiparams{'STOPYEAR'}) {
|
||||
print 'selected=\'selected\' '; }
|
||||
print "value='$year'>$year</option>\n";
|
||||
}
|
||||
|
||||
|
||||
print <<END;
|
||||
</select>
|
||||
<input type='submit' name='ACTION' value='$Lang::tr{'update'}' />
|
||||
</form>
|
||||
</td>
|
||||
<td width='5%' align='center'>
|
||||
<form method='post' action='/cgi-bin/traffic.cgi'>
|
||||
<input type='submit' name='ACTION' value=' > ' />
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
END
|
||||
|
||||
&Header::closebox();
|
||||
|
||||
&Header::openbox('100%', 'left', "$Lang::tr{'traffics'}");
|
||||
|
||||
my $dateWidth = '20%';
|
||||
my $netWidth = '34%';
|
||||
my $inOutWidth = '17%';
|
||||
|
||||
# 4 networks
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(4)$/) {
|
||||
$dateWidth = '12%';
|
||||
$netWidth = '22%';
|
||||
$inOutWidth = '11%';
|
||||
}
|
||||
# 3 networks
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(2|3)$/) {
|
||||
$dateWidth = '16%';
|
||||
$netWidth = '28%';
|
||||
$inOutWidth = '14%';
|
||||
}
|
||||
|
||||
print <<END;
|
||||
<table width='100%'>
|
||||
<tr>
|
||||
<td width='$dateWidth' align='center' class='boldbase'></td>
|
||||
<td width='$netWidth' align='center' class='boldbase' ><b>$Lang::tr{'trafficgreen'}</b></td>
|
||||
END
|
||||
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(3|4)$/) {
|
||||
print "<td width='$netWidth' align='center' class='boldbase' ><b>$Lang::tr{'trafficblue'}</b></td>";
|
||||
}
|
||||
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(2|4)$/) {
|
||||
print "<td width='$netWidth' align='center' class='boldbase' ><b>$Lang::tr{'trafficorange'}</b></td>";
|
||||
}
|
||||
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/)
|
||||
{
|
||||
print "<td width='$netWidth' align='center' class='boldbase'><b>$Lang::tr{'trafficred'}</b></td>";
|
||||
}
|
||||
print <<END;
|
||||
</tr>
|
||||
</table>
|
||||
<table width='100%'>
|
||||
<tr>
|
||||
<td width='$dateWidth' align='center' class='boldbase'><b>$Lang::tr{'trafficdate'}</b></td>
|
||||
<td width='$inOutWidth' align='center' class='boldbase'><font color='$Header::colourgreen'><b>$Lang::tr{'trafficin'}</b></font></td>
|
||||
<td width='$inOutWidth' align='center' class='boldbase'><font color='$Header::colourgreen'><b>$Lang::tr{'trafficout'}</b></font></td>
|
||||
END
|
||||
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(3|4)$/)
|
||||
{
|
||||
print "<td width='$inOutWidth' align='center' class='boldbase'><font color='${Header::colourblue}'><b>$Lang::tr{'trafficin'}</b></font></td>";
|
||||
print "<td width='$inOutWidth' align='center' class='boldbase'><font color='${Header::colourblue}'><b>$Lang::tr{'trafficout'}</b></font></td>";
|
||||
}
|
||||
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(2|4)$/)
|
||||
{
|
||||
print "<td width='$inOutWidth' align='center' class='boldbase'><font color='$Header::colourorange'><b>$Lang::tr{'trafficin'}</b></font></td>";
|
||||
print "<td width='$inOutWidth' align='center' class='boldbase'><font color='$Header::colourorange'><b>$Lang::tr{'trafficout'}</b></font></td>";
|
||||
}
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/)
|
||||
{
|
||||
print "<td width='$inOutWidth' align='center' class='boldbase'><font color='$Header::colourred'><b>$Lang::tr{'trafficin'}</b></font></td>";
|
||||
print "<td width='$inOutWidth' align='center' class='boldbase'><font color='$Header::colourred'><b>$Lang::tr{'trafficout'}</b></font></td>";
|
||||
}
|
||||
print "</tr>";
|
||||
|
||||
my $total_blue_in=0;
|
||||
my $total_blue_out=0;
|
||||
my $total_green_in=0;
|
||||
my $total_green_out=0;
|
||||
my $total_orange_in=0;
|
||||
my $total_orange_out=0;
|
||||
my $total_red_in=0;
|
||||
my $total_red_out=0;
|
||||
my $lines=0;
|
||||
|
||||
|
||||
my $startyear = $cgiparams{'STARTYEAR'};
|
||||
my $stopyear = $cgiparams{'STOPYEAR'};
|
||||
|
||||
my $startMonth = $cgiparams{'STARTMONTH'}+1;
|
||||
$startMonth = $startMonth < 10 ? $startMonth = "0".$startMonth : $startMonth;
|
||||
|
||||
my $endMonth = $cgiparams{'STOPMONTH'}+1;
|
||||
$endMonth = $endMonth < 10 ? $endMonth = "0".$endMonth : $endMonth;
|
||||
|
||||
my $startDay = $cgiparams{'STARTDAY'};
|
||||
$startDay = $startDay < 10 ? $startDay = "0".$startDay : $startDay;
|
||||
|
||||
my $endDay = $cgiparams{'STOPDAY'}+1;
|
||||
$endDay = $endDay < 10 ? $endDay = "0".$endDay : $endDay;
|
||||
|
||||
my $displayMode = "daily_multi";
|
||||
my $start = $startyear.$startMonth.$startDay;
|
||||
my $end = $stopyear.$endMonth.$endDay;
|
||||
|
||||
my %allDaysBytes = ();
|
||||
my @allDays = &Traffic::calcTraffic(\%allDaysBytes,$start,$end, $displayMode);
|
||||
|
||||
|
||||
foreach (@allDays) {
|
||||
$total_green_in += $allDaysBytes{$_}{${Traffic::green_in}};
|
||||
$total_green_out += $allDaysBytes{$_}{${Traffic::green_out}};
|
||||
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(3|4)$/)
|
||||
{
|
||||
$total_blue_in += $allDaysBytes{$_}{${Traffic::blue_in}};
|
||||
$total_blue_out += $allDaysBytes{$_}{${Traffic::blue_out}};
|
||||
}
|
||||
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(2|4)$/)
|
||||
{
|
||||
$total_orange_in += $allDaysBytes{$_}{${Traffic::orange_in}};
|
||||
$total_orange_out += $allDaysBytes{$_}{${Traffic::orange_out}};
|
||||
}
|
||||
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/)
|
||||
{
|
||||
$total_red_in += $allDaysBytes{$_}{${Traffic::red_in}};
|
||||
$total_red_out += $allDaysBytes{$_}{${Traffic::red_out}};
|
||||
}
|
||||
|
||||
if ($lines % 2) {
|
||||
print "<tr bgcolor='$color{'color20'}'>"; }
|
||||
else {
|
||||
print "<tr bgcolor='$color{'color22'}'>"; }
|
||||
|
||||
printf "<td align='center' nowrap='nowrap'>%s</td>\n", $allDaysBytes{$_}{'Day'};
|
||||
printf "<td align='center' nowrap='nowrap'>%.3f</td>\n", ($allDaysBytes{$_}{${Traffic::green_in}}/1048576);
|
||||
printf "<td align='center' nowrap='nowrap'>%.3f</td>\n", ($allDaysBytes{$_}{${Traffic::green_out}}/1048576);
|
||||
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(3|4)$/)
|
||||
{
|
||||
printf "<td align='center' nowrap='nowrap'>%.3f</td>\n", ($allDaysBytes{$_}{${Traffic::blue_in}}/1048576);
|
||||
printf "<td align='center' nowrap='nowrap'>%.3f</td>\n", ($allDaysBytes{$_}{${Traffic::blue_out}}/1048576);
|
||||
}
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(2|4)$/)
|
||||
{
|
||||
printf "<td align='center' nowrap='nowrap'>%.3f</td>\n", ($allDaysBytes{$_}{${Traffic::orange_in}}/1048576);
|
||||
printf "<td align='center' nowrap='nowrap'>%.3f</td>\n", ($allDaysBytes{$_}{${Traffic::orange_out}}/1048576);
|
||||
}
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/)
|
||||
{
|
||||
printf "<td align='center' nowrap='nowrap'>%.3f</td>\n", ($allDaysBytes{$_}{${Traffic::red_in}}/1048576);
|
||||
printf "<td align='center' nowrap='nowrap'>%.3f</td></tr>\n", ($allDaysBytes{$_}{${Traffic::red_out}}/1048576);
|
||||
}
|
||||
$lines++;
|
||||
}
|
||||
|
||||
$total_green_in=sprintf("%.2f", ($total_green_in/1048576));
|
||||
$total_green_out=sprintf("%.2f", ($total_green_out/1048576));
|
||||
$total_blue_in=sprintf("%.2f", ($total_blue_in/1048576));
|
||||
$total_blue_out=sprintf("%.2f", ($total_blue_out/1048576));
|
||||
$total_orange_in=sprintf("%.2f", ($total_orange_in/1048576));
|
||||
$total_orange_out=sprintf("%.2f", ($total_orange_out/1048576));
|
||||
$total_red_in=sprintf("%.2f", ($total_red_in/1048576));
|
||||
$total_red_out=sprintf("%.2f", ($total_red_out/1048576));
|
||||
|
||||
if ($lines % 2) {print "<tr bgcolor='$color{'color20'}'>"; }
|
||||
else {print "<tr bgcolor='$color{'color22'}'>"; }
|
||||
|
||||
print <<END;
|
||||
<td align='center' class='boldbase' height='20' nowrap='nowrap'><b>$Lang::tr{'trafficsum'}</b></td>
|
||||
<td align='center' class='boldbase' nowrap='nowrap'><b>$total_green_in MB</b></td>
|
||||
<td align='center' class='boldbase' nowrap='nowrap'><b>$total_green_out MB</b></td>
|
||||
END
|
||||
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(3|4)$/)
|
||||
{
|
||||
print "<td align='center' class='boldbase' nowrap='nowrap'><b>$total_blue_in MB</b></td>";
|
||||
print "<td align='center' class='boldbase' nowrap='nowrap'><b>$total_blue_out MB</b></td>";
|
||||
}
|
||||
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(2|4)$/)
|
||||
{
|
||||
print "<td align='center' class='boldbase' nowrap='nowrap'><b>$total_orange_in MB</b></td>";
|
||||
print "<td align='center' class='boldbase' nowrap='nowrap'><b>$total_orange_out MB</b></td>";
|
||||
}
|
||||
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/)
|
||||
{
|
||||
print "<td align='center' class='boldbase' nowrap='nowrap'><b>$total_red_in MB</b></td>";
|
||||
print "<td align='center' class='boldbase' nowrap='nowrap'><b>$total_red_out MB</b></td>";
|
||||
}
|
||||
print "</tr></table>";
|
||||
|
||||
&Header::closebox();
|
||||
&Header::closebigbox();
|
||||
&Header::closepage();
|
||||
Reference in New Issue
Block a user