From b05768be3b86eda86a4e3e6ef043b03a83984eb7 Mon Sep 17 00:00:00 2001 From: maniacikarus Date: Tue, 22 May 2007 19:04:48 +0000 Subject: [PATCH] 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 --- html/cgi-bin/graphs.cgi | 23 ++++++++- html/cgi-bin/hardwaregraphs.cgi | 25 ++++----- html/cgi-bin/media.cgi | 2 - html/cgi-bin/memory.cgi | 3 -- html/cgi-bin/network.cgi | 14 +---- html/cgi-bin/system.cgi | 6 --- html/cgi-bin/traffic.cgi | 59 +++++++++++++--------- html/html/themes/ipfire/include/colors.txt | 22 ++++---- 8 files changed, 81 insertions(+), 73 deletions(-) diff --git a/html/cgi-bin/graphs.cgi b/html/cgi-bin/graphs.cgi index 82357e729..19bbafeb3 100644 --- a/html/cgi-bin/graphs.cgi +++ b/html/cgi-bin/graphs.cgi @@ -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 { diff --git a/html/cgi-bin/hardwaregraphs.cgi b/html/cgi-bin/hardwaregraphs.cgi index 453799485..9cbaf12be 100644 --- a/html/cgi-bin/hardwaregraphs.cgi +++ b/html/cgi-bin/hardwaregraphs.cgi @@ -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'}"); diff --git a/html/cgi-bin/media.cgi b/html/cgi-bin/media.cgi index 2dfc3a02c..54aa3ba5a 100644 --- a/html/cgi-bin/media.cgi +++ b/html/cgi-bin/media.cgi @@ -39,8 +39,6 @@ foreach (@devices) { my $device = $_; chomp($device); &Graphs::updatediskgraph ("day",$device); - &Graphs::updatediskgraph ("week",$device); - &Graphs::updatediskgraph ("month",$device); diskbox("$device"); } diff --git a/html/cgi-bin/memory.cgi b/html/cgi-bin/memory.cgi index 030afe867..5e84c80de 100644 --- a/html/cgi-bin/memory.cgi +++ b/html/cgi-bin/memory.cgi @@ -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); diff --git a/html/cgi-bin/network.cgi b/html/cgi-bin/network.cgi index 70bdf35c6..4e6c3e7f9 100644 --- a/html/cgi-bin/network.cgi +++ b/html/cgi-bin/network.cgi @@ -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") { diff --git a/html/cgi-bin/system.cgi b/html/cgi-bin/system.cgi index 02f038422..5cc813f39 100644 --- a/html/cgi-bin/system.cgi +++ b/html/cgi-bin/system.cgi @@ -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); diff --git a/html/cgi-bin/traffic.cgi b/html/cgi-bin/traffic.cgi index dae5c96ce..22867d76a 100644 --- a/html/cgi-bin/traffic.cgi +++ b/html/cgi-bin/traffic.cgi @@ -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 <$Lang::tr{'trafficgreen'} END -if ($netsettings{'CONFIG_TYPE'} =~ /^(4|5|6|7)$/) { +if ($netsettings{'CONFIG_TYPE'} =~ /^(3|4)$/) { print "$Lang::tr{'trafficblue'}"; } -if ($netsettings{'CONFIG_TYPE'} =~ /^(1|3|5|7)$/) { +if ($netsettings{'CONFIG_TYPE'} =~ /^(2|4)$/) { print "$Lang::tr{'trafficorange'}"; } +if ($netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/) { + print "$Lang::tr{'trafficred'}"; + } print <$Lang::tr{'trafficred'} @@ -167,22 +169,23 @@ print <$Lang::tr{'trafficout'} END -if ($netsettings{'CONFIG_TYPE'} =~ /^(4|5|6|7)$/) +if ($netsettings{'CONFIG_TYPE'} =~ /^(3|4)$/) { print ""; print ""; } -if ($netsettings{'CONFIG_TYPE'} =~ /^(1|3|5|7)$/) +if ($netsettings{'CONFIG_TYPE'} =~ /^(2|4)$/) { print ""; print ""; } -print <$Lang::tr{'trafficin'} - - -END +if ($netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/) +{ + print ""; + print ""; +} + print""; 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 ""; } else { @@ -238,20 +244,21 @@ foreach (@allDays) { printf "\n", ($allDaysBytes{$_}{${Traffic::green_in}}/1048576); printf "\n", ($allDaysBytes{$_}{${Traffic::green_out}}/1048576); - if ($netsettings{'CONFIG_TYPE'} =~ /^(4|5|6|7)$/) + if ($netsettings{'CONFIG_TYPE'} =~ /^(3|4)$/) { printf "\n", ($allDaysBytes{$_}{${Traffic::blue_in}}/1048576); printf "\n", ($allDaysBytes{$_}{${Traffic::blue_out}}/1048576); } - if ($netsettings{'CONFIG_TYPE'} =~ /^(1|3|5|7)$/) + if ($netsettings{'CONFIG_TYPE'} =~ /^(2|4)$/) { printf "\n", ($allDaysBytes{$_}{${Traffic::orange_in}}/1048576); printf "\n", ($allDaysBytes{$_}{${Traffic::orange_out}}/1048576); } - + if ($netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/) + { printf "\n", ($allDaysBytes{$_}{${Traffic::red_in}}/1048576); printf "\n", ($allDaysBytes{$_}{${Traffic::red_out}}/1048576); - + } $lines++; } @@ -273,21 +280,23 @@ print <$total_green_out MB END -if ($netsettings{'CONFIG_TYPE'} =~ /^(4|5|6|7)$/) +if ($netsettings{'CONFIG_TYPE'} =~ /^(3|4)$/) { print ""; print ""; } -if ($netsettings{'CONFIG_TYPE'} =~ /^(1|3|5|7)$/) +if ($netsettings{'CONFIG_TYPE'} =~ /^(2|4)$/) { print ""; print ""; } - +if ($netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/) +{ + print ""; + print ""; +} print <$total_red_in MB -
$Lang::tr{'trafficin'}$Lang::tr{'trafficout'}$Lang::tr{'trafficin'}$Lang::tr{'trafficout'}$Lang::tr{'trafficout'}
$Lang::tr{'trafficin'}$Lang::tr{'trafficout'}
%.3f%.3f%.3f%.3f%.3f%.3f%.3f%.3f
$total_blue_in MB$total_blue_out MB$total_orange_in MB$total_orange_out MB$total_red_in MB$total_red_out MB$total_red_out MB
END diff --git a/html/html/themes/ipfire/include/colors.txt b/html/html/themes/ipfire/include/colors.txt index 547e20a43..f51993d72 100644 --- a/html/html/themes/ipfire/include/colors.txt +++ b/html/html/themes/ipfire/include/colors.txt @@ -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