3 step in tuning 2.3

This commit is contained in:
Maniacikarus
2008-09-28 11:10:30 +02:00
parent 74e82b68e8
commit bcad0fd0d2
11 changed files with 254 additions and 488 deletions

View File

@@ -1,149 +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 @cgigraphs=();
my @graphs=();
my $iface='';
&Header::showhttpheaders();
my $graphdir = "/srv/web/ipfire/html/graphs";
&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
$ENV{'QUERY_STRING'} =~ s/&//g;
@cgigraphs = split(/graph=/,$ENV{'QUERY_STRING'});
$cgigraphs[1] = '' unless defined $cgigraphs[1];
$cgigraphs[2] = '' unless defined $cgigraphs[2];
if ($cgigraphs[1] =~ /(load)/) {&Graphs::updateloadgraph ("hour");&Graphs::updateloadgraph ("week");&Graphs::updateloadgraph ("month");&Graphs::updateloadgraph ("year");}
elsif ($cgigraphs[1] =~ /(cpufreq)/) {&Graphs::updatecpufreqgraph ("hour");&Graphs::updatecpufreqgraph ("week");&Graphs::updatecpufreqgraph ("month");&Graphs::updatecpufreqgraph ("year");}
elsif ($cgigraphs[1] =~ /(cpu)/) {&Graphs::updatecpugraph ("hour");&Graphs::updatecpugraph ("week");&Graphs::updatecpugraph ("month");&Graphs::updatecpugraph ("year");}
elsif ($cgigraphs[1] =~ /(processes)/) {&Graphs::updateprocessesgraph ("hour");&Graphs::updateprocessesgraph ("week");&Graphs::updateprocessesgraph ("month");&Graphs::updateprocessesgraph ("year");}
elsif ($cgigraphs[1] =~ /(memory|swap)/) {&Graphs::updatememgraph ("hour");&Graphs::updatememgraph ("week");&Graphs::updatememgraph ("month");&Graphs::updatememgraph ("year");}
elsif ($cgigraphs[1] =~ /wireless/){ &Graphs::wireless("hour",$cgigraphs[2]); &Graphs::wireless("week",$cgigraphs[2]); &Graphs::wireless("month",$cgigraphs[2]); &Graphs::wireless("year",$cgigraphs[2]); }
elsif ($cgigraphs[1] =~ /disk/){
my @devices = `kudzu -qps -c HD | grep device: | cut -d" " -f2 | sort | uniq`;
foreach (@devices) {
my $device = $_;
chomp($device);
&Graphs::updatediskgraph ("hour",$device);
&Graphs::updatediskgraph ("week",$device);
&Graphs::updatediskgraph ("month",$device);
&Graphs::updatediskgraph ("year",$device);}}
elsif ($cgigraphs[2] ne "" ) {&Graphs::updatepinggraph("hour",$cgigraphs[1]);&Graphs::updatepinggraph("week",$cgigraphs[1]);&Graphs::updatepinggraph("month",$cgigraphs[1]);&Graphs::updatepinggraph("year",$cgigraphs[1]);}
elsif ($cgigraphs[1] =~ /fwhits/) {&Graphs::updatefwhitsgraph("hour");&Graphs::updatefwhitsgraph("week");&Graphs::updatefwhitsgraph("month");&Graphs::updatefwhitsgraph("year");}
elsif ($cgigraphs[1] =~ /green/ || $cgigraphs[1] =~ /blue/ || $cgigraphs[1] =~ /ipsec/ || $cgigraphs[1] =~ /tun/ || $cgigraphs[1] =~ /orange/ || $cgigraphs[1] =~ /ppp/ || $cgigraphs[1] =~ /red/ ) {&Graphs::updateifgraph($cgigraphs[1], "hour");&Graphs::updateifgraph($cgigraphs[1], "week");&Graphs::updateifgraph($cgigraphs[1], "month");&Graphs::updateifgraph($cgigraphs[1], "year");}
if ($cgigraphs[1] =~ /(network|green|blue|orange|red|ppp|ipsec|tun)/ || $cgigraphs[2] ne "") {
&Header::openpage($Lang::tr{'network traffic graphs'}, 1, '');
} else {
&Header::openpage($Lang::tr{'system graphs'}, 1, '');
}
&Header::openbigbox('100%', 'left');
if ($cgigraphs[1] =~ /wireless/){
my $graphname = $cgigraphs[2];
&Header::openbox('100%', 'center', "wireless $graphname $Lang::tr{'graph'}");
if (-e "$graphdir/wireless-${graphname}-day.png") {
my $ftime = localtime((stat("$graphdir/wireless-${graphname}-day.png"))[9]);
print "<center>";
print "<b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br /><hr />\n";
print "<img alt='' src='/graphs/wireless-${graphname}-hour.png' border='0' /><hr />";
print "<img alt='' src='/graphs/wireless-${graphname}-day.png' border='0' /><hr />";
print "<img alt='' src='/graphs/wireless-${graphname}-week.png' border='0' /><hr />";
print "<img alt='' src='/graphs/wireless-${graphname}-month.png' border='0' /><hr />";
print "<img alt='' src='/graphs/wireless-${graphname}-year.png' border='0' />";
} else {
print $Lang::tr{'no information available'};
}
&Header::closebox();
}
elsif ($cgigraphs[1] =~ /(green|blue|orange|red|ppp|ipsec|tun|cpu|memory|swap|disk|load|fwhits|processes)/ || $cgigraphs[2] ne "") {
my $graph = $cgigraphs[1];
my $graphname = ucfirst(lc($cgigraphs[1]));
&Header::openbox('100%', 'center', "$graphname $Lang::tr{'graph'}");
if (-e "$graphdir/${graph}-day.png") {
my $ftime = localtime((stat("$graphdir/${graph}-day.png"))[9]);
print "<center>";
print "<b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br /><hr />\n";
print "<img alt='' src='/graphs/${graph}-hour.png' border='0' /><hr />";
print "<img alt='' src='/graphs/${graph}-day.png' border='0' /><hr />";
print "<img alt='' src='/graphs/${graph}-week.png' border='0' /><hr />";
print "<img alt='' src='/graphs/${graph}-month.png' border='0' /><hr />";
print "<img alt='' src='/graphs/${graph}-year.png' border='0' />";
} else {
print $Lang::tr{'no information available'};
}
&Header::closebox();
} elsif ($cgigraphs[1] =~ /network/) {
push (@graphs, ('GREEN'));
if ($netsettings{'BLUE_DEV'}) {
push (@graphs, ('BLUE')); }
if ($netsettings{'ORANGE_DEV'}) {
push (@graphs, ('ORANGE')); }
push (@graphs, ("RED"));
push (@graphs, ('gateway'));
foreach my $graphname (@graphs) {
&Header::openbox('100%', 'center', "$graphname $Lang::tr{'graph'}");
if (-e "$graphdir/${graphname}-day.png") {
my $ftime = localtime((stat("$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();
}
}
print "<div align='center'><table width='80%'><tr><td align='center'>";
if ( $cgigraphs[1] eq "cpu" || $cgigraphs[1] eq "cpufreq" || $cgigraphs[1] eq "load" ) { print "<a href='/cgi-bin/system.cgi'>"; }
elsif ( $cgigraphs[1] eq "memory" || $cgigraphs[1] eq "swap" ) { print "<a href='/cgi-bin/memory.cgi'>"; }
elsif ( $cgigraphs[1] eq "processes" ) { print "<a href='/cgi-bin/services.cgi'>"; }
elsif ( $cgigraphs[1] =~ /disk/ ) { print "<a href='/cgi-bin/media.cgi'>"; }
elsif ( $cgigraphs[1] =~ /red/ || $cgigraphs[1] =~ /ppp/ || $cgigraphs[1] =~ /ipsec/ || $cgigraphs[1] =~ /tun/) { print "<a href='/cgi-bin/network.cgi?network=red'>"; }
elsif ( $cgigraphs[1] =~ /green/ || $cgigraphs[1] =~ /blue/ || $cgigraphs[1] =~ /orange/ || $cgigraphs[1] =~ /wireless/ ) { print "<a href='/cgi-bin/network.cgi?network=internal'>"; }
elsif ( $cgigraphs[1] eq "fwhits" || $cgigraphs[2] ne "" ) { print "<a href='/cgi-bin/network.cgi?network=other'>"; }
print "$Lang::tr{'back'}</a></td></tr></table></div>\n";
&Header::closebigbox();
&Header::closepage();

View File

@@ -22,8 +22,8 @@
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";
@@ -36,10 +36,9 @@ my %mainsettings = ();
&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
my %sensorsettings = ();
my $rrdlog = "/var/log/rrd";
my @sensorsgraphs = ();
my @sensorsdir = `ls -dA $rrdlog/collectd/localhost/sensors-*/`;
my @sensorsdir = `ls -dA $mainsettings{'RRDLOG'}/collectd/localhost/sensors-*/`;
foreach (@sensorsdir){
chomp($_);chop($_);
foreach (`ls $_/*`){

View File

@@ -64,8 +64,6 @@ my $portfile = "/var/ipfire/qos/portconfig";
my $tosfile = "/var/ipfire/qos/tosconfig";
&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
&Header::showhttpheaders();
$qossettings{'ENABLED'} = 'off';
$qossettings{'EDIT'} = 'no';
$qossettings{'OUT_SPD'} = '';
@@ -120,8 +118,19 @@ my %mainsettings = ();
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
&Header::openpage('QoS', 1, '');
&Header::openbigbox('100%', 'left', '', $errormessage);
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::updateqosgraph($querry[0],$querry[1]);
}else{
&Header::showhttpheaders();
&Header::openpage('QoS', 1, '');
&Header::openbigbox('100%', 'left', '', $errormessage);
############################################################################################################################
############################################################################################################################
@@ -759,28 +768,12 @@ if ( ($qossettings{'DEFCLASS_INC'} eq '') || ($qossettings{'DEFCLASS_OUT'} eq ''
exit
}
&Header::openbox('100%', 'center', $Lang::tr{'info'});
&Graphs::overviewgraph("3240",$qossettings{'RED_DEV'});
&Graphs::overviewgraph("3240",$qossettings{'IMQ_DEV'});
print <<END
<table>
<tr><td colspan='9' align='center' valign='middle'><img alt="" src='/images/addblue.gif' />&nbsp;$Lang::tr{'add subclass'} | <img alt="" src='/images/addgreen.gif' />&nbsp;$Lang::tr{'Add Rule'} | <img alt="" src='/images/edit.gif' />&nbsp;$Lang::tr{'edit'} | <img alt="" src='/images/delete.gif' />&nbsp;$Lang::tr{'delete'} &nbsp;
<tr><td colspan='9' align='right' valign='middle'><b>$Lang::tr{'TOS Bits'}:</b>&nbsp;&nbsp;<b>0</b> - $Lang::tr{'disabled'} | <b>8</b> - $Lang::tr{'min delay'} | <b>4</b> - $Lang::tr{'max throughput'} | <b>2</b> - $Lang::tr{'max reliability'} | <b>1</b> - $Lang::tr{'min costs'} &nbsp;
END
;
if (( -e "/srv/web/ipfire/html/graphs/qos-graph-$qossettings{'RED_DEV'}-3240.png") && ( -e "/srv/web/ipfire/html/graphs/qos-graph-$qossettings{'IMQ_DEV'}-3240.png")) {
print <<END
<tr><td colspan='9' align='center'><a href='/cgi-bin/qosgraph.cgi?graph=$qossettings{'RED_DEV'}'><img alt="" src="/graphs/qos-graph-$qossettings{'RED_DEV'}-3240.png" border='0' /></a></td></tr>
<tr><td colspan='9' align='center'><a href='/cgi-bin/qosgraph.cgi?graph=$qossettings{'IMQ_DEV'}'><img alt="" src="/graphs/qos-graph-$qossettings{'IMQ_DEV'}-3240.png" border='0' /></a></td></tr>
END
;}
else
{
print "\t</table><br />".$Lang::tr{'no information available'};
}
print "\t</table>";
&Header::closebox();
&Header::openbox('100%', 'center', "$qossettings{'RED_DEV'} $Lang::tr{'graph'}");
&Graphs::makegraphbox("qos.cgi",$qossettings{'RED_DEV'},"hour","325");
&Header::closebox();
&Header::openbox('100%', 'center', "$qossettings{'IMQ_DEV'} $Lang::tr{'graph'}");
&Graphs::makegraphbox("qos.cgi",$qossettings{'IMQ_DEV'},"hour","325");
&Header::closebox();
&showclasses($qossettings{'RED_DEV'});
&showclasses($qossettings{'IMQ_DEV'});
@@ -788,6 +781,8 @@ print "\t</table>";
&Header::closebigbox();
&Header::closepage();
}
############################################################################################################################
############################################################################################################################

View File

@@ -1,91 +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 @cgigraph=();
my $errormessage = "";
&Header::showhttpheaders();
$ENV{'QUERY_STRING'} =~ s/&//g;
@cgigraph = split(/graph=/,$ENV{'QUERY_STRING'});
$cgigraph[1] = '' unless defined $cgigraph[1];
&Graphs::overviewgraph("day",$cgigraph[1]);
&Graphs::overviewgraph("week",$cgigraph[1]);
&Graphs::overviewgraph("month",$cgigraph[1]);
&Graphs::overviewgraph("year",$cgigraph[1]);
&Header::openpage('QoS', 1, '');
&Header::openbigbox('100%', 'left', '', $errormessage);
&Header::openbox('100%', 'left', $cgigraph[1]);
if (-e "/srv/web/ipfire/html/graphs/qos-graph-$cgigraph[1]-day.png") {
my $ftime = localtime((stat("/srv/web/ipfire/html/graphs/qos-graph-$cgigraph[1]-day.png"))[9]);
print "<center>";
print "<b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
print "<img alt='' src='/graphs/qos-graph-$cgigraph[1]-day.png' border='0' /><hr />";
} else {
print $Lang::tr{'no information available'};
}
if (-e "/srv/web/ipfire/html/graphs/qos-graph-$cgigraph[1]-week.png") {
my $ftime = localtime((stat("/srv/web/ipfire/html/graphs/qos-graph-$cgigraph[1]-week.png"))[9]);
print "<center>";
print "<b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
print "<img alt='' src='/graphs/qos-graph-$cgigraph[1]-week.png' border='0' /><hr />";
} else {
print $Lang::tr{'no information available'};
}
if (-e "/srv/web/ipfire/html/graphs/qos-graph-$cgigraph[1]-month.png") {
my $ftime = localtime((stat("/srv/web/ipfire/html/graphs/qos-graph-$cgigraph[1]-month.png.png"))[9]);
print "<center>";
print "<b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
print "<img alt='' src='/graphs/qos-graph-$cgigraph[1]-month.png' border='0' /><hr />";
} else {
print $Lang::tr{'no information available'};
}
if (-e "/srv/web/ipfire/html/graphs/qos-graph-$cgigraph[1]-year.png") {
my $ftime = localtime((stat("/srv/web/ipfire/html/graphs/qos-graph-$cgigraph[1]-year.png"))[9]);
print "<center>";
print "<b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
print "<img alt='' src='/graphs/qos-graph-$cgigraph[1]-year.png' border='0' /><hr />";
} else {
print $Lang::tr{'no information available'};
}
print"<div align='center'><br/><a href='/cgi-bin/qos.cgi'>$Lang::tr{'back'}</a></div>";
&Header::closebox();
&Header::closebigbox();
&Header::closepage();

View File

@@ -43,6 +43,10 @@ if ( $querry[0] =~ "cpu"){
print "Content-type: image/png\n\n";
binmode(STDOUT);
&Graphs::updatecpugraph($querry[1]);
}elsif ( $querry[0] =~ "cpufreq"){
print "Content-type: image/png\n\n";
binmode(STDOUT);
&Graphs::updatecpufreqgraph($querry[1]);
}elsif ( $querry[0] =~ "load"){
print "Content-type: image/png\n\n";
binmode(STDOUT);
@@ -52,6 +56,12 @@ if ( $querry[0] =~ "cpu"){
&Header::openpage($Lang::tr{'status information'}, 1, '');
&Header::openbigbox('100%', 'left');
if ( -e "$mainsettings{'RRDLOG'}/collectd/localhost/cpufreq/cpufreq-0.rrd"){
&Header::openbox('100%', 'center', "CPU $Lang::tr{'graph'}");
&Graphs::makegraphbox("system.cgi","cpu","day","325");
&Header::closebox();
}
&Header::openbox('100%', 'center', "CPU $Lang::tr{'graph'}");
&Graphs::makegraphbox("system.cgi","cpu","day","325");
&Header::closebox();