mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
Graphen Hintergrundfarbe bei Standarttheme auf weiss gesetzt
Config Types in der Nettraffic angepasst Erstellung der Week Month und Year Graphen nur noch bei Request git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@573 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
@@ -11,12 +11,13 @@
|
||||
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 %cgiparams=();
|
||||
my %pppsettings=();
|
||||
@@ -34,6 +35,24 @@ $ENV{'QUERY_STRING'} =~ s/&//g;
|
||||
@cgigraphs = split(/graph=/,$ENV{'QUERY_STRING'});
|
||||
$cgigraphs[1] = '' unless defined $cgigraphs[1];
|
||||
|
||||
if ($cgigraphs[1] =~ /(load)/) {&Graphs::updateloadgraph ("week");&Graphs::updateloadgraph ("month");&Graphs::updateloadgraph ("year");}
|
||||
if ($cgigraphs[1] =~ /(cpu)/) {&Graphs::updatecpugraph ("week");&Graphs::updatecpugraph ("month");&Graphs::updatecpugraph ("year");}
|
||||
if ($cgigraphs[1] =~ /(memory|swap)/) {&Graphs::updatememgraph ("week");&Graphs::updatememgraph ("month");&Graphs::updatememgraph ("year");}
|
||||
if ($cgigraphs[1] =~ /disk/){
|
||||
my @devices = `kudzu -qps -c HD | grep device: | cut -d" " -f2 | sort | uniq`;
|
||||
|
||||
foreach (@devices) {
|
||||
my $device = $_;
|
||||
chomp($device);
|
||||
&Graphs::updatediskgraph ("week",$device);
|
||||
&Graphs::updatediskgraph ("month",$device);
|
||||
&Graphs::updatediskgraph ("year",$device);}}
|
||||
if ($cgigraphs[1] =~ /lq/) {&Graphs::updatelqgraph("week");&Graphs::updatelqgraph("month");&Graphs::updatelqgraph("year");}
|
||||
if ($cgigraphs[1] =~ /RED/) {&Graphs::updateifgraph("RED", "week");&Graphs::updateifgraph("RED", "month");&Graphs::updateifgraph("RED", "year");}
|
||||
if ($cgigraphs[1] =~ /GREEN/) {&Graphs::updateifgraph("GREEN", "week");&Graphs::updateifgraph("GREEN", "month");&Graphs::updateifgraph("GREEN", "year");}
|
||||
if ($cgigraphs[1] =~ /BLUE/) {&Graphs::updateifgraph("BLUE", "week");&Graphs::updateifgraph("BLUE", "month");&Graphs::updateifgraph("BLUE", "year");}
|
||||
if ($cgigraphs[1] =~ /ORANGE/) {&Graphs::updateifgraph("ORANGE", "week");&Graphs::updateifgraph("ORANGE", "month");&Graphs::updateifgraph("ORANGE", "year");}
|
||||
|
||||
if ($cgigraphs[1] =~ /(network|GREEN|BLUE|ORANGE|RED|lq)/) {
|
||||
&Header::openpage($Lang::tr{'network traffic graphs'}, 1, '');
|
||||
} else {
|
||||
|
||||
@@ -30,23 +30,11 @@ foreach (@disks){
|
||||
my $disk = $_;
|
||||
chomp $disk;
|
||||
&Graphs::updatehddgraph ($disk,"day");
|
||||
&Graphs::updatehddgraph ($disk,"week");
|
||||
&Graphs::updatehddgraph ($disk,"month");
|
||||
&Graphs::updatehddgraph ($disk,"year");
|
||||
}
|
||||
|
||||
&Graphs::updatetempgraph ("day");
|
||||
&Graphs::updatetempgraph ("week");
|
||||
&Graphs::updatetempgraph ("month");
|
||||
&Graphs::updatetempgraph ("year");
|
||||
&Graphs::updatefangraph ("day");
|
||||
&Graphs::updatefangraph ("week");
|
||||
&Graphs::updatefangraph ("month");
|
||||
&Graphs::updatefangraph ("year");
|
||||
&Graphs::updatevoltgraph ("day");
|
||||
&Graphs::updatevoltgraph ("week");
|
||||
&Graphs::updatevoltgraph ("month");
|
||||
&Graphs::updatevoltgraph ("year");
|
||||
|
||||
my @graphs=();
|
||||
|
||||
@@ -159,6 +147,19 @@ if ($cgigraphs[1] =~ /hddtemp/)
|
||||
}
|
||||
elsif ($cgigraphs[1] =~ /(temp|fan|volt)/)
|
||||
{
|
||||
if ($cgigraphs[1] =~ /temp/) {&Graphs::updatetempgraph ("week");&Graphs::updatetempgraph ("month");&Graphs::updatetempgraph ("year");}
|
||||
if ($cgigraphs[1] =~ /fan/) {&Graphs::updatefangraph ("week");&Graphs::updatefangraph ("month");&Graphs::updatefangraph ("year");}
|
||||
if ($cgigraphs[1] =~ /volt/) {&Graphs::updatevoltgraph ("week");&Graphs::updatevoltgraph ("month");&Graphs::updatevoltgraph ("year");}
|
||||
if ($cgigraphs[1] =~ /hddtemp/){
|
||||
my @devices = `kudzu -qps -c HD | grep device: | cut -d" " -f2 | sort | uniq`;
|
||||
|
||||
foreach (@devices) {
|
||||
my $device = $_;
|
||||
chomp($device);
|
||||
&Graphs::updatehddgraph ($disk,"week");
|
||||
&Graphs::updatehddgraph ($disk,"month");
|
||||
&Graphs::updatehddgraph ($disk,"year");}}
|
||||
|
||||
my $graph = $cgigraphs[1];
|
||||
my $graphname = $Lang::tr{"mbmon $cgigraphs[1]"};
|
||||
&Header::openbox('100%', 'center', "$graphname $Lang::tr{'graph'}");
|
||||
|
||||
@@ -39,8 +39,6 @@ foreach (@devices) {
|
||||
my $device = $_;
|
||||
chomp($device);
|
||||
&Graphs::updatediskgraph ("day",$device);
|
||||
&Graphs::updatediskgraph ("week",$device);
|
||||
&Graphs::updatediskgraph ("month",$device);
|
||||
diskbox("$device");
|
||||
}
|
||||
|
||||
|
||||
@@ -22,9 +22,6 @@ require "${General::swroot}/graphs.pl";
|
||||
my %cgiparams=();
|
||||
|
||||
&Graphs::updatememgraph ("day");
|
||||
&Graphs::updatememgraph ("week");
|
||||
&Graphs::updatememgraph ("month");
|
||||
&Graphs::updatememgraph ("year");
|
||||
|
||||
&Header::showhttpheaders();
|
||||
&Header::getcgihash(\%cgiparams);
|
||||
|
||||
@@ -55,19 +55,9 @@ if ($cgiparams[1] =~ /red/) {
|
||||
foreach my $graphname (@graphs) {
|
||||
|
||||
if ($graphname eq "lq" )
|
||||
{
|
||||
&Graphs::updatelqgraph("day");
|
||||
&Graphs::updatelqgraph("week");
|
||||
&Graphs::updatelqgraph("month");
|
||||
&Graphs::updatelqgraph("year");
|
||||
}
|
||||
{ &Graphs::updatelqgraph("day"); }
|
||||
else
|
||||
{
|
||||
&Graphs::updateifgraph($graphname, "day");
|
||||
&Graphs::updateifgraph($graphname, "week");
|
||||
&Graphs::updateifgraph($graphname, "month");
|
||||
&Graphs::updateifgraph($graphname, "year");
|
||||
}
|
||||
{ &Graphs::updateifgraph($graphname, "day"); }
|
||||
|
||||
&Header::openbox('100%', 'center', "$graphname $Lang::tr{'graph'}");
|
||||
if (-e "$Header::graphdir/${graphname}-day.png") {
|
||||
|
||||
@@ -67,13 +67,7 @@ if ($netsettings{'BLUE_DEV'} ne '') {
|
||||
|
||||
# Generate Graphs from rrd Data
|
||||
&Graphs::updatecpugraph ("day");
|
||||
&Graphs::updatecpugraph ("week");
|
||||
&Graphs::updatecpugraph ("month");
|
||||
&Graphs::updatecpugraph ("year");
|
||||
&Graphs::updateloadgraph ("day");
|
||||
&Graphs::updateloadgraph ("week");
|
||||
&Graphs::updateloadgraph ("month");
|
||||
&Graphs::updateloadgraph ("year");
|
||||
|
||||
&Header::showhttpheaders();
|
||||
&Header::getcgihash(\%cgiparams);
|
||||
|
||||
@@ -129,13 +129,13 @@ my $netWidth = '34%';
|
||||
my $inOutWidth = '17%';
|
||||
|
||||
# 4 networks
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(5|7)$/) {
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(4)$/) {
|
||||
$dateWidth = '12%';
|
||||
$netWidth = '22%';
|
||||
$inOutWidth = '11%';
|
||||
}
|
||||
# 3 networks
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(1|3|4|6)$/) {
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(2|3)$/) {
|
||||
$dateWidth = '16%';
|
||||
$netWidth = '28%';
|
||||
$inOutWidth = '14%';
|
||||
@@ -148,16 +148,18 @@ print <<END;
|
||||
<td width='$netWidth' align='center' class='boldbase' ><b>$Lang::tr{'trafficgreen'}</b></td>
|
||||
END
|
||||
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(4|5|6|7)$/) {
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(3|4)$/) {
|
||||
print "<td width='$netWidth' align='center' class='boldbase' ><b>$Lang::tr{'trafficblue'}</b></td>";
|
||||
}
|
||||
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(1|3|5|7)$/) {
|
||||
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;
|
||||
<td width='$netWidth' align='center' class='boldbase'><b>$Lang::tr{'trafficred'}</b></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table width='100%'>
|
||||
@@ -167,22 +169,23 @@ print <<END;
|
||||
<td width='$inOutWidth' align='center' class='boldbase'><font color='#16A61D'><b>$Lang::tr{'trafficout'}</b></font></td>
|
||||
END
|
||||
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(4|5|6|7)$/)
|
||||
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'} =~ /^(1|3|5|7)$/)
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(2|4)$/)
|
||||
{
|
||||
print "<td width='$inOutWidth' align='center' class='boldbase'><font color='#FF9933'><b>$Lang::tr{'trafficin'}</b></font></td>";
|
||||
print "<td width='$inOutWidth' align='center' class='boldbase'><font color='#FF9933'><b>$Lang::tr{'trafficout'}</b></font></td>";
|
||||
}
|
||||
print <<END;
|
||||
<td width='$inOutWidth' align='center' class='boldbase'><font color='#CE1B31'><b>$Lang::tr{'trafficin'}</b></font></td>
|
||||
<td width='$inOutWidth' align='center' class='boldbase'><font color='#CE1B31'><b>$Lang::tr{'trafficout'}</b></font></td>
|
||||
</tr>
|
||||
END
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/)
|
||||
{
|
||||
print "<td width='$inOutWidth' align='center' class='boldbase'><font color='#CE1B31'><b>$Lang::tr{'trafficin'}</b></font></td>";
|
||||
print "<td width='$inOutWidth' align='center' class='boldbase'><font color='#CE1B31'><b>$Lang::tr{'trafficout'}</b></font></td>";
|
||||
}
|
||||
print"</tr>";
|
||||
|
||||
my $total_blue_in=0;
|
||||
my $total_blue_out=0;
|
||||
@@ -214,21 +217,24 @@ foreach (@allDays) {
|
||||
$total_green_in += $allDaysBytes{$_}{${Traffic::green_in}};
|
||||
$total_green_out += $allDaysBytes{$_}{${Traffic::green_out}};
|
||||
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(4|5|6|7)$/)
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(3|4)$/)
|
||||
{
|
||||
$total_blue_in += $allDaysBytes{$_}{${Traffic::blue_in}};
|
||||
$total_blue_out += $allDaysBytes{$_}{${Traffic::blue_out}};
|
||||
}
|
||||
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(1|3|5|7)$/)
|
||||
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 {
|
||||
@@ -238,20 +244,21 @@ foreach (@allDays) {
|
||||
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'} =~ /^(4|5|6|7)$/)
|
||||
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'} =~ /^(1|3|5|7)$/)
|
||||
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++;
|
||||
}
|
||||
|
||||
@@ -273,21 +280,23 @@ print <<END;
|
||||
<td align='center' class='boldbase' nowrap='nowrap'><b>$total_green_out MB</b></td>
|
||||
END
|
||||
|
||||
if ($netsettings{'CONFIG_TYPE'} =~ /^(4|5|6|7)$/)
|
||||
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'} =~ /^(1|3|5|7)$/)
|
||||
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 <<END;
|
||||
<td align='center' class='boldbase' nowrap='nowrap'><b>$total_red_in MB</b></td>
|
||||
<td align='center' class='boldbase' nowrap='nowrap'><b>$total_red_out MB</b></td>
|
||||
</tr>
|
||||
</table>
|
||||
END
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
colour1=#CD5B45
|
||||
colour2=#EE6A50
|
||||
colour3=#FF7256
|
||||
colour4=#EE9572
|
||||
colour5=#FFA07A
|
||||
colour6=#CDAF95
|
||||
colour7=#EECBAD
|
||||
colour8=#FFDAB9
|
||||
colour9=#FFE4C4
|
||||
colour10=#FFCCCC
|
||||
color1=#CD5B45
|
||||
color2=#EE6A50
|
||||
color3=#FF7256
|
||||
color4=#EE9572
|
||||
color5=#FFA07A
|
||||
color6=#CDAF95
|
||||
color7=#EECBAD
|
||||
color8=#FFDAB9
|
||||
color9=#FFE4C4
|
||||
color10=#FFCCCC
|
||||
color11=#0000FF
|
||||
color12=#00FF00
|
||||
color13=#FF0000
|
||||
@@ -18,7 +18,7 @@ color17=#90EE90
|
||||
color18=#F4A460
|
||||
color19=#EAE9EE
|
||||
color20=#E0E0E0
|
||||
color21=#EAE9EE
|
||||
color21=#FFFFFF
|
||||
color22=#F0F0F0
|
||||
color23=#FF00FF
|
||||
color24=#6464FF
|
||||
|
||||
Reference in New Issue
Block a user