]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
3 step in tuning 2.3
authorManiacikarus <maniacikarus@ipfire.org>
Sun, 28 Sep 2008 09:10:30 +0000 (11:10 +0200)
committerManiacikarus <maniacikarus@ipfire.org>
Sun, 28 Sep 2008 09:10:30 +0000 (11:10 +0200)
config/cfgroot/graphs.pl
config/collectd/collectd.conf
config/rootfiles/core/17/files
config/rootfiles/updater/filelists/files
config/rootfiles/updater/update.sh
html/cgi-bin/graphs.cgi [deleted file]
html/cgi-bin/hardwaregraphs.cgi
html/cgi-bin/qos.cgi
html/cgi-bin/qosgraph.cgi [deleted file]
html/cgi-bin/system.cgi
src/scripts/qosd

index e386009152648563179a23574c34cb6c4e2d956b..a233228a71a44c8256768afa5684ff9adab6abdd 100644 (file)
@@ -30,8 +30,6 @@ require "${General::swroot}/lang.pl";
 require "${General::swroot}/header.pl";
 
 my $ERROR;
-my $rrdlog = "/var/log/rrd";
-my $graphs = "/srv/web/ipfire/html/graphs";
 $ENV{PATH}="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin";
 
 # Read the global settings files to get the current theme and after this load
@@ -43,6 +41,11 @@ my %sensorsettings = ();
 &General::readhash("${General::swroot}/main/settings", \%mainsettings);
 &General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
 
+if ( $mainsettings{'RRDLOG'} eq "" ){
+       $mainsettings{'RRDLOG'}="/var/log/rrd";
+       &General::writehash("${General::swroot}/main/settings", \%mainsettings);
+}
+
 # If the collection deamon is working and collecting lm_sensors data there will be
 # some data source named after a common scheme, with the sensorssettingsfile
 # the user is able to deactivate some of this parameters, in case not to show
@@ -54,9 +57,9 @@ my $value;
 my @args = ();
 my $count = 0;
 my @sensorsgraphs = ();
-my $cpucount = `ls -dA /media/ramd/rrd/collectd/localhost/cpu-*/ | wc -l`;
-my @processesgraph = `ls -dA $rrdlog/collectd/localhost/processes-*/`;
-my @sensorsdir = `ls -dA $rrdlog/collectd/localhost/sensors-*/`;
+my $cpucount = `ls -dA $mainsettings{'RRDLOG'}/collectd/localhost/cpu-*/ | wc -l`;
+my @processesgraph = `ls -dA $mainsettings{'RRDLOG'}/collectd/localhost/processes-*/`;
+my @sensorsdir = `ls -dA $mainsettings{'RRDLOG'}/collectd/localhost/sensors-*/`;
 foreach (@sensorsdir)
 {
        chomp($_);chop($_);
@@ -154,14 +157,15 @@ sub updatecpugraph {
        my $addstring = "";
        
        for(my $i = 0; $i < $cpucount; $i++) {
-               push(@command,"DEF:iowait".$i."=".$rrdlog."/collectd/localhost/cpu-".$i."/cpu-wait.rrd:value:AVERAGE");
-               push(@command,"DEF:nice".$i."=".$rrdlog."/collectd/localhost/cpu-".$i."/cpu-nice.rrd:value:AVERAGE");
-               push(@command,"DEF:interrupt".$i."=".$rrdlog."/collectd/localhost/cpu-".$i."/cpu-interrupt.rrd:value:AVERAGE");
-               push(@command,"DEF:steal".$i."=".$rrdlog."/collectd/localhost/cpu-".$i."/cpu-steal.rrd:value:AVERAGE");
-               push(@command,"DEF:user".$i."=".$rrdlog."/collectd/localhost/cpu-".$i."/cpu-user.rrd:value:AVERAGE");
-               push(@command,"DEF:system".$i."=".$rrdlog."/collectd/localhost/cpu-".$i."/cpu-system.rrd:value:AVERAGE");
-               push(@command,"DEF:idle".$i."=".$rrdlog."/collectd/localhost/cpu-".$i."/cpu-idle.rrd:value:AVERAGE");
-               push(@command,"DEF:irq".$i."=".$rrdlog."/collectd/localhost/cpu-".$i."/cpu-softirq.rrd:value:AVERAGE");
+               push(@command,"DEF:iowait".$i."=".$mainsettings{'RRDLOG'}."/collectd/localhost/cpu-".$i."/cpu-wait.rrd:value:AVERAGE"
+                               ,"DEF:nice".$i."=".$mainsettings{'RRDLOG'}."/collectd/localhost/cpu-".$i."/cpu-nice.rrd:value:AVERAGE"
+                               ,"DEF:interrupt".$i."=".$mainsettings{'RRDLOG'}."/collectd/localhost/cpu-".$i."/cpu-interrupt.rrd:value:AVERAGE"
+                               ,"DEF:steal".$i."=".$mainsettings{'RRDLOG'}."/collectd/localhost/cpu-".$i."/cpu-steal.rrd:value:AVERAGE"
+                               ,"DEF:user".$i."=".$mainsettings{'RRDLOG'}."/collectd/localhost/cpu-".$i."/cpu-user.rrd:value:AVERAGE"
+                               ,"DEF:system".$i."=".$mainsettings{'RRDLOG'}."/collectd/localhost/cpu-".$i."/cpu-system.rrd:value:AVERAGE"
+                               ,"DEF:idle".$i."=".$mainsettings{'RRDLOG'}."/collectd/localhost/cpu-".$i."/cpu-idle.rrd:value:AVERAGE"
+                               ,"DEF:irq".$i."=".$mainsettings{'RRDLOG'}."/collectd/localhost/cpu-".$i."/cpu-softirq.rrd:value:AVERAGE");
+
                $nice .= "nice".$i.",";
                $interrupt .= "interrupt".$i.",";
                $steal .= "steal".$i.",";
@@ -178,64 +182,64 @@ sub updatecpugraph {
 
        $addstring .= "+";
 
-       push(@command,$nice.$addstring);
-       push(@command,$interrupt.$addstring);
-       push(@command,$steal.$addstring);
-       push(@command,$user.$addstring);
-       push(@command,$system.$addstring);
-       push(@command,$idle.$addstring);
-       push(@command,$iowait.$addstring);
-       push(@command,$irq.$addstring);
-
-       push(@command,"CDEF:total=user,system,idle,iowait,irq,nice,interrupt,steal,+,+,+,+,+,+,+");
-       push(@command,"CDEF:userpct=100,user,total,/,*");
-       push(@command,"CDEF:nicepct=100,nice,total,/,*");
-       push(@command,"CDEF:interruptpct=100,interrupt,total,/,*");
-       push(@command,"CDEF:stealpct=100,steal,total,/,*");
-       push(@command,"CDEF:systempct=100,system,total,/,*");
-       push(@command,"CDEF:idlepct=100,idle,total,/,*");
-       push(@command,"CDEF:iowaitpct=100,iowait,total,/,*");
-       push(@command,"CDEF:irqpct=100,irq,total,/,*");
-       push(@command,"AREA:iowaitpct".$color{"color14"}.":".sprintf("%-25s",$Lang::tr{'cpu iowait usage'}));
-       push(@command,"GPRINT:iowaitpct:MAX:%3.2lf%%");
-       push(@command,"GPRINT:iowaitpct:AVERAGE:%3.2lf%%");
-       push(@command,"GPRINT:iowaitpct:MIN:%3.2lf%%");
-       push(@command,"GPRINT:iowaitpct:LAST:%3.2lf%%\\j");
-       push(@command,"STACK:irqpct".$color{"color23"}."A0:".sprintf("%-25s",$Lang::tr{'cpu irq usage'}));
-       push(@command,"GPRINT:irqpct:MAX:%3.2lf%%");
-       push(@command,"GPRINT:irqpct:AVERAGE:%3.2lf%%");
-       push(@command,"GPRINT:irqpct:MIN:%3.2lf%%");
-       push(@command,"GPRINT:irqpct:LAST:%3.2lf%%\\j");
-       push(@command,"STACK:nicepct".$color{"color16"}."A0:".sprintf("%-25s",$Lang::tr{'cpu nice usage'}));
-       push(@command,"GPRINT:nicepct:MAX:%3.2lf%%");
-       push(@command,"GPRINT:nicepct:AVERAGE:%3.2lf%%");
-       push(@command,"GPRINT:nicepct:MIN:%3.2lf%%");
-       push(@command,"GPRINT:nicepct:LAST:%3.2lf%%\\j");
-       push(@command,"STACK:interruptpct".$color{"color15"}."A0:".sprintf("%-25s",$Lang::tr{'cpu interrupt usage'}));
-       push(@command,"GPRINT:interruptpct:MAX:%3.2lf%%");
-       push(@command,"GPRINT:interruptpct:AVERAGE:%3.2lf%%");
-       push(@command,"GPRINT:interruptpct:MIN:%3.2lf%%");
-       push(@command,"GPRINT:interruptpct:LAST:%3.2lf%%\\j");
-       push(@command,"STACK:stealpct".$color{"color18"}."A0:".sprintf("%-25s",$Lang::tr{'cpu steal usage'}));
-       push(@command,"GPRINT:stealpct:MAX:%3.2lf%%");
-       push(@command,"GPRINT:stealpct:AVERAGE:%3.2lf%%");
-       push(@command,"GPRINT:stealpct:MIN:%3.2lf%%");
-       push(@command,"GPRINT:stealpct:LAST:%3.2lf%%\\j");
-       push(@command,"STACK:userpct".$color{"color11"}."A0:".sprintf("%-25s",$Lang::tr{'cpu user usage'}));
-       push(@command,"GPRINT:userpct:MAX:%3.2lf%%");
-       push(@command,"GPRINT:userpct:AVERAGE:%3.2lf%%");
-       push(@command,"GPRINT:userpct:MIN:%3.2lf%%");
-       push(@command,"GPRINT:userpct:LAST:%3.2lf%%\\j");
-       push(@command,"STACK:systempct".$color{"color13"}."A0:".sprintf("%-25s",$Lang::tr{'cpu system usage'}));
-       push(@command,"GPRINT:systempct:MAX:%3.2lf%%");
-       push(@command,"GPRINT:systempct:AVERAGE:%3.2lf%%");
-       push(@command,"GPRINT:systempct:MIN:%3.2lf%%");
-       push(@command,"GPRINT:systempct:LAST:%3.2lf%%\\j");
-       push(@command,"STACK:idlepct".$color{"color12"}."A0:".sprintf("%-25s",$Lang::tr{'cpu idle usage'}));
-       push(@command,"GPRINT:idlepct:MAX:%3.2lf%%");
-       push(@command,"GPRINT:idlepct:AVERAGE:%3.2lf%%");
-       push(@command,"GPRINT:idlepct:MIN:%3.2lf%%");
-       push(@command,"GPRINT:idlepct:LAST:%3.2lf%%\\j");
+       push(@command,$nice.$addstring
+               ,$interrupt.$addstring
+               ,$steal.$addstring
+               ,$user.$addstring
+               ,$system.$addstring
+               ,$idle.$addstring
+               ,$iowait.$addstring
+               ,$irq.$addstring);
+
+       push(@command,"CDEF:total=user,system,idle,iowait,irq,nice,interrupt,steal,+,+,+,+,+,+,+"
+                       ,"CDEF:userpct=100,user,total,/,*"
+                       ,"CDEF:nicepct=100,nice,total,/,*"
+                       ,"CDEF:interruptpct=100,interrupt,total,/,*"
+                       ,"CDEF:stealpct=100,steal,total,/,*"
+                       ,"CDEF:systempct=100,system,total,/,*"
+                       ,"CDEF:idlepct=100,idle,total,/,*"
+                       ,"CDEF:iowaitpct=100,iowait,total,/,*"
+                       ,"CDEF:irqpct=100,irq,total,/,*"
+                       ,"AREA:iowaitpct".$color{"color14"}.":".sprintf("%-25s",$Lang::tr{'cpu iowait usage'})
+                       ,"GPRINT:iowaitpct:MAX:%3.2lf%%"
+                       ,"GPRINT:iowaitpct:AVERAGE:%3.2lf%%"
+                       ,"GPRINT:iowaitpct:MIN:%3.2lf%%"
+                       ,"GPRINT:iowaitpct:LAST:%3.2lf%%\\j"
+                       ,"STACK:irqpct".$color{"color23"}."A0:".sprintf("%-25s",$Lang::tr{'cpu irq usage'})
+                       ,"GPRINT:irqpct:MAX:%3.2lf%%"
+                       ,"GPRINT:irqpct:AVERAGE:%3.2lf%%"
+                       ,"GPRINT:irqpct:MIN:%3.2lf%%"
+                       ,"GPRINT:irqpct:LAST:%3.2lf%%\\j"
+                       ,"STACK:nicepct".$color{"color16"}."A0:".sprintf("%-25s",$Lang::tr{'cpu nice usage'})
+                       ,"GPRINT:nicepct:MAX:%3.2lf%%"
+                       ,"GPRINT:nicepct:AVERAGE:%3.2lf%%"
+                       ,"GPRINT:nicepct:MIN:%3.2lf%%"
+                       ,"GPRINT:nicepct:LAST:%3.2lf%%\\j"
+                       ,"STACK:interruptpct".$color{"color15"}."A0:".sprintf("%-25s",$Lang::tr{'cpu interrupt usage'})
+                       ,"GPRINT:interruptpct:MAX:%3.2lf%%"
+                       ,"GPRINT:interruptpct:AVERAGE:%3.2lf%%"
+                       ,"GPRINT:interruptpct:MIN:%3.2lf%%"
+                       ,"GPRINT:interruptpct:LAST:%3.2lf%%\\j"
+                       ,"STACK:stealpct".$color{"color18"}."A0:".sprintf("%-25s",$Lang::tr{'cpu steal usage'})
+                       ,"GPRINT:stealpct:MAX:%3.2lf%%"
+                       ,"GPRINT:stealpct:AVERAGE:%3.2lf%%"
+                       ,"GPRINT:stealpct:MIN:%3.2lf%%"
+                       ,"GPRINT:stealpct:LAST:%3.2lf%%\\j"
+                       ,"STACK:userpct".$color{"color11"}."A0:".sprintf("%-25s",$Lang::tr{'cpu user usage'})
+                       ,"GPRINT:userpct:MAX:%3.2lf%%"
+                       ,"GPRINT:userpct:AVERAGE:%3.2lf%%"
+                       ,"GPRINT:userpct:MIN:%3.2lf%%"
+                       ,"GPRINT:userpct:LAST:%3.2lf%%\\j"
+                       ,"STACK:systempct".$color{"color13"}."A0:".sprintf("%-25s",$Lang::tr{'cpu system usage'})
+                       ,"GPRINT:systempct:MAX:%3.2lf%%"
+                       ,"GPRINT:systempct:AVERAGE:%3.2lf%%"
+                       ,"GPRINT:systempct:MIN:%3.2lf%%"
+                       ,"GPRINT:systempct:LAST:%3.2lf%%\\j"
+                       ,"STACK:idlepct".$color{"color12"}."A0:".sprintf("%-25s",$Lang::tr{'cpu idle usage'})
+                       ,"GPRINT:idlepct:MAX:%3.2lf%%"
+                       ,"GPRINT:idlepct:AVERAGE:%3.2lf%%"
+                       ,"GPRINT:idlepct:MIN:%3.2lf%%"
+                       ,"GPRINT:idlepct:LAST:%3.2lf%%\\j");
 
        RRDs::graph (@command);
        $ERROR = RRDs::error;
@@ -264,9 +268,9 @@ sub updateloadgraph {
                "--color=SHADEA".$color{"color19"},
                "--color=SHADEB".$color{"color19"},
                "--color=BACK".$color{"color21"},
-               "DEF:load1=".$rrdlog."/collectd/localhost/load/load.rrd:shortterm:AVERAGE",
-               "DEF:load5=".$rrdlog."/collectd/localhost/load/load.rrd:midterm:AVERAGE",
-               "DEF:load15=".$rrdlog."/collectd/localhost/load/load.rrd:longterm:AVERAGE",
+               "DEF:load1=".$mainsettings{'RRDLOG'}."/collectd/localhost/load/load.rrd:shortterm:AVERAGE",
+               "DEF:load5=".$mainsettings{'RRDLOG'}."/collectd/localhost/load/load.rrd:midterm:AVERAGE",
+               "DEF:load15=".$mainsettings{'RRDLOG'}."/collectd/localhost/load/load.rrd:longterm:AVERAGE",
                "AREA:load1".$color{"color13"}."A0:1 Minute:",
                "GPRINT:load1:LAST:%5.2lf",
                "AREA:load5".$color{"color18"}."A0:5 Minuten:",
@@ -303,10 +307,10 @@ sub updatememorygraph {
                "--color=SHADEA".$color{"color19"},
                "--color=SHADEB".$color{"color19"},
                "--color=BACK".$color{"color21"},
-               "DEF:used=".$rrdlog."/collectd/localhost/memory/memory-used.rrd:value:AVERAGE",
-               "DEF:free=".$rrdlog."/collectd/localhost/memory/memory-free.rrd:value:AVERAGE",
-               "DEF:buffer=".$rrdlog."/collectd/localhost/memory/memory-buffered.rrd:value:AVERAGE",
-               "DEF:cache=".$rrdlog."/collectd/localhost/memory/memory-cached.rrd:value:AVERAGE",
+               "DEF:used=".$mainsettings{'RRDLOG'}."/collectd/localhost/memory/memory-used.rrd:value:AVERAGE",
+               "DEF:free=".$mainsettings{'RRDLOG'}."/collectd/localhost/memory/memory-free.rrd:value:AVERAGE",
+               "DEF:buffer=".$mainsettings{'RRDLOG'}."/collectd/localhost/memory/memory-buffered.rrd:value:AVERAGE",
+               "DEF:cache=".$mainsettings{'RRDLOG'}."/collectd/localhost/memory/memory-cached.rrd:value:AVERAGE",
                "CDEF:total=used,free,cache,buffer,+,+,+",
                "CDEF:usedpct=used,total,/,100,*",
                "CDEF:bufferpct=buffer,total,/,100,*",
@@ -365,9 +369,9 @@ sub updateswapgraph {
                "--color=SHADEA".$color{"color19"},
                "--color=SHADEB".$color{"color19"},
                "--color=BACK".$color{"color21"},
-               "DEF:used=".$rrdlog."/collectd/localhost/swap/swap-used.rrd:value:AVERAGE",
-               "DEF:free=".$rrdlog."/collectd/localhost/swap/swap-free.rrd:value:AVERAGE",
-               "DEF:cached=".$rrdlog."/collectd/localhost/swap/swap-cached.rrd:value:AVERAGE",
+               "DEF:used=".$mainsettings{'RRDLOG'}."/collectd/localhost/swap/swap-used.rrd:value:AVERAGE",
+               "DEF:free=".$mainsettings{'RRDLOG'}."/collectd/localhost/swap/swap-free.rrd:value:AVERAGE",
+               "DEF:cached=".$mainsettings{'RRDLOG'}."/collectd/localhost/swap/swap-cached.rrd:value:AVERAGE",
                "CDEF:total=used,free,cached,+,+",
                "CDEF:usedpct=100,used,total,/,*",
                "CDEF:freepct=100,free,total,/,*",
@@ -516,10 +520,10 @@ sub updatediskgraph {
                "--color=SHADEA".$color{"color19"},
                "--color=SHADEB".$color{"color19"},
                "--color=BACK".$color{"color21"},
-               "DEF:read=".$rrdlog."/collectd/localhost/disk-$disk/disk_octets.rrd:read:AVERAGE",
-               "DEF:write=".$rrdlog."/collectd/localhost/disk-$disk/disk_octets.rrd:write:AVERAGE",
+               "DEF:read=".$mainsettings{'RRDLOG'}."/collectd/localhost/disk-$disk/disk_octets.rrd:read:AVERAGE",
+               "DEF:write=".$mainsettings{'RRDLOG'}."/collectd/localhost/disk-$disk/disk_octets.rrd:write:AVERAGE",
                "CDEF:writen=write,-1,*",
-               "DEF:standby=".$rrdlog."/hddshutdown-".$disk.".rrd:standby:AVERAGE",
+               "DEF:standby=".$mainsettings{'RRDLOG'}."/hddshutdown-".$disk.".rrd:standby:AVERAGE",
                "CDEF:st=standby,INF,*",
                "CDEF:st1=standby,-INF,*",
                "COMMENT:".sprintf("%-25s",$Lang::tr{'caption'}),
@@ -566,8 +570,8 @@ sub updateifgraph {
                "--color=SHADEA".$color{"color19"},
                "--color=SHADEB".$color{"color19"},
                "--color=BACK".$color{"color21"},
-               "DEF:incoming=".$rrdlog."/collectd/localhost/interface/if_octets-".$interface.".rrd:rx:AVERAGE",
-               "DEF:outgoing=".$rrdlog."/collectd/localhost/interface/if_octets-".$interface.".rrd:tx:AVERAGE",
+               "DEF:incoming=".$mainsettings{'RRDLOG'}."/collectd/localhost/interface/if_octets-".$interface.".rrd:rx:AVERAGE",
+               "DEF:outgoing=".$mainsettings{'RRDLOG'}."/collectd/localhost/interface/if_octets-".$interface.".rrd:tx:AVERAGE",
                "CDEF:outgoingn=outgoing,-1,*",
                "COMMENT:".sprintf("%-20s",$Lang::tr{'caption'}),
                "COMMENT:".sprintf("%15s",$Lang::tr{'maximal'}),
@@ -610,10 +614,10 @@ sub updatefwhitsgraph {
                "--color=SHADEA".$color{"color19"},
                "--color=SHADEB".$color{"color19"},
                "--color=BACK".$color{"color21"},
-               "DEF:output=".$rrdlog."/collectd/localhost/iptables-filter-FORWARD/ipt_bytes-DROP_OUTPUT.rrd:value:AVERAGE",
-               "DEF:input=".$rrdlog."/collectd/localhost/iptables-filter-INPUT/ipt_bytes-DROP_INPUT.rrd:value:AVERAGE",
-               "DEF:newnotsyn=".$rrdlog."/collectd/localhost/iptables-filter-NEWNOTSYN/ipt_bytes-DROP_NEWNOTSYN.rrd:value:AVERAGE",
-               "DEF:portscan=".$rrdlog."/collectd/localhost/iptables-filter-PSCAN/ipt_bytes-DROP_PScan.rrd:value:AVERAGE",
+               "DEF:output=".$mainsettings{'RRDLOG'}."/collectd/localhost/iptables-filter-FORWARD/ipt_bytes-DROP_OUTPUT.rrd:value:AVERAGE",
+               "DEF:input=".$mainsettings{'RRDLOG'}."/collectd/localhost/iptables-filter-INPUT/ipt_bytes-DROP_INPUT.rrd:value:AVERAGE",
+               "DEF:newnotsyn=".$mainsettings{'RRDLOG'}."/collectd/localhost/iptables-filter-NEWNOTSYN/ipt_bytes-DROP_NEWNOTSYN.rrd:value:AVERAGE",
+               "DEF:portscan=".$mainsettings{'RRDLOG'}."/collectd/localhost/iptables-filter-PSCAN/ipt_bytes-DROP_PScan.rrd:value:AVERAGE",
                "CDEF:amount=output,input,newnotsyn,+,+",
                "COMMENT:".sprintf("%-20s",$Lang::tr{'caption'}),
                "COMMENT:".sprintf("%15s",$Lang::tr{'maximal'}),
@@ -658,7 +662,7 @@ sub updatepinggraph {
                "--color=SHADEA".$color{"color19"},
                "--color=SHADEB".$color{"color19"},
                "--color=BACK".$color{"color21"},
-               "DEF:roundtrip=".$rrdlog."/collectd/localhost/ping/ping-".$host.".rrd:ping:AVERAGE",
+               "DEF:roundtrip=".$mainsettings{'RRDLOG'}."/collectd/localhost/ping/ping-".$host.".rrd:ping:AVERAGE",
                "COMMENT:".sprintf("%-20s",$Lang::tr{'caption'})."\\j",
                "CDEF:roundavg=roundtrip,PREV(roundtrip),+,2,/",
                "CDEF:r0=roundtrip,30,MIN",
@@ -702,8 +706,8 @@ sub updatewirelessgraph {
                "--color=SHADEA".$color{"color19"},
                "--color=SHADEB".$color{"color19"},
                "--color=BACK".$color{"color21"},
-               "DEF:noise=".$rrdlog."/collectd/localhost/wireless-".$interface."/signal_noise.rrd:value:AVERAGE",
-               "DEF:power=".$rrdlog."/collectd/localhost/wireless-".$interface."/signal_power.rrd:value:AVERAGE",
+               "DEF:noise=".$mainsettings{'RRDLOG'}."/collectd/localhost/wireless-".$interface."/signal_noise.rrd:value:AVERAGE",
+               "DEF:power=".$mainsettings{'RRDLOG'}."/collectd/localhost/wireless-".$interface."/signal_power.rrd:value:AVERAGE",
                "COMMENT:".sprintf("%-20s",$Lang::tr{'caption'}),
                "COMMENT:".sprintf("%15s",$Lang::tr{'maximal'}),
                "COMMENT:".sprintf("%15s",$Lang::tr{'average'}),
@@ -746,8 +750,8 @@ sub updatehddgraph {
                "--color=SHADEA".$color{"color19"},
                "--color=SHADEB".$color{"color19"},
                "--color=BACK".$color{"color21"},
-               "DEF:temperature=".$rrdlog."/hddtemp-$disk.rrd:temperature:AVERAGE",
-               "DEF:standby=".$rrdlog."/hddshutdown-$disk.rrd:standby:AVERAGE",
+               "DEF:temperature=".$mainsettings{'RRDLOG'}."/hddtemp-$disk.rrd:temperature:AVERAGE",
+               "DEF:standby=".$mainsettings{'RRDLOG'}."/hddshutdown-$disk.rrd:standby:AVERAGE",
                "CDEF:st=standby,INF,*",
                "AREA:st".$color{"color20"}."A0:standby",
                "LINE3:temperature".$color{"color11"}."A0:$Lang::tr{'hdd temperature in'} C\\j",
@@ -924,136 +928,126 @@ sub updatehwvoltgraph {
 }
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-# Generate the CPU Frequency Graph for the current period of time for values given by
-# only 1 or 2 cpus is working
-sub updatecpufreqgraph {
-               if ( -e "$rrdlog/collectd/localhost/cpufreq/cpufreq-0.rrd" ){
-
-               my $period    = $_[0];
-       my @command = ("$graphs/cpufreq-$period.png",
-               "--start", "-1$period", "-aPNG", "-i", "-z", "-W www.ipfire.org", "-v Mhz",
-               "-w 600", "-h 125",  "-r",
-               "--color", "SHADEA".$color{"color19"},
-               "--color", "SHADEB".$color{"color19"},
-               "--color", "BACK".$color{"color21"},
-               "-t $Lang::tr{'cpu frequency per'} $Lang::tr{$period}");
-
-               if ( -e "$rrdlog/collectd/localhost/cpufreq/cpufreq-1.rrd" ){
-           push(@command,"DEF:cpu1_=$rrdlog/collectd/localhost/cpufreq/cpufreq-1.rrd:value:AVERAGE");
-       }
-       push(@command,"DEF:cpu0_=$rrdlog/collectd/localhost/cpufreq/cpufreq-0.rrd:value:AVERAGE");
-
-               if ( -e "$rrdlog/collectd/localhost/cpufreq/cpufreq-1.rrd" ){
-           push(@command,"CDEF:cpu1=cpu1_,1000000,/");
-       }
-       push(@command,"CDEF:cpu0=cpu0_,1000000,/",
-                       "COMMENT:CPU",
-                       "COMMENT:$Lang::tr{'maximal'}",
-                       "COMMENT:$Lang::tr{'average'}",
-                       "COMMENT:$Lang::tr{'minimal'}",
-                       "COMMENT:$Lang::tr{'current'}\\j",);
-
-
-               if ( -e "$rrdlog/collectd/localhost/cpufreq/cpufreq-1.rrd" ){
-                       push(@command,"LINE3:cpu1".$color{"color12"}."A0:1",
-                       "GPRINT:cpu1:MAX:%3.0lf Mhz",
-                       "GPRINT:cpu1:AVERAGE:%3.0lf Mhz",
-                       "GPRINT:cpu1:MIN:%3.0lf Mhz",
-                       "GPRINT:cpu1:LAST:%3.0lf Mhz\\j",);
-       }
-       push(@command,"LINE2:cpu0".$color{"color11"}."A1:0",
-                       "GPRINT:cpu0:MAX:%3.0lf Mhz",
-                       "GPRINT:cpu0:AVERAGE:%3.0lf Mhz",
-                       "GPRINT:cpu0:MIN:%3.0lf Mhz",
-                       "GPRINT:cpu0:LAST:%3.0lf Mhz\\j",);
-
-       RRDs::graph (@command);
-               $ERROR = RRDs::error;
-               print "Error in RRD::graph for cpu: $ERROR\n" if $ERROR;
-    }
-}
-
 # Generate the QoS Graph for the current period of time
 
 sub updateqosgraph {
 
-  my $period = $_[0];
-  my $periodstring;
-  my $description;
-  my %qossettings = ();
-  &General::readhash("${General::swroot}/qos/settings", \%qossettings);
-  my $classentry = "";
-  my @classes = ();
-  my @classline = ();
-  my $classfile = "/var/ipfire/qos/classes";
-
-       $qossettings{'DEV'} = $_[1];
+       my $period = $_[1];
+       my %qossettings = ();
+       &General::readhash("${General::swroot}/qos/settings", \%qossettings);
+
+       my $classentry = "";
+       my @classes = ();
+       my @classline = ();
+       my $classfile = "/var/ipfire/qos/classes";
+
+       $qossettings{'DEV'} = $_[0];
        if ( $qossettings{'DEV'} eq $qossettings{'RED_DEV'} ) {
                $qossettings{'CLASSPRFX'} = '1';
        } else {
                $qossettings{'CLASSPRFX'} = '2';
        }
 
-  if ( $period ne '3240' ){ $periodstring = "-1$period";}else{ $periodstring = "-".$period;}
-  if ( $period ne '3240' ){ $description = "-t $Lang::tr{'Utilization on'} ($qossettings{'DEV'}) ($Lang::tr{'graph per'} $Lang::tr{$period})";}else{ $description = "-t $Lang::tr{'Utilization on'} ($qossettings{'DEV'})";}
-
        my $ERROR="";
        my $count="1";
        my $color="#000000";
-       my @command=("/srv/web/ipfire/html/graphs/qos-graph-$qossettings{'DEV'}-$period.png",
-               "--start", $periodstring, "-aPNG", "-i", "-z", "-W www.ipfire.org",
-               "--alt-y-grid", "-w 600", "-h 125", "-r", "-v $Lang::tr{'bytes per second'}",
-    "--color", "SHADEA".$color{"color19"},
-    "--color", "SHADEB".$color{"color19"},
-    "--color", "BACK".$color{"color21"},
+
+       my @command = (
+               "-",
+               "--start",
+               "-1".$period,
+               "-aPNG",
+               "-i",
+               "-z",
+               "-W www.ipfire.org",
+               "--alt-y-grid",
+               "-w 600",
+               "-h 125",
+               "-r",
+               "-t ".$Lang::tr{'Utilization on'}." (".$qossettings{'DEV'}.") ".$Lang::tr{'graph per'}." ".$Lang::tr{$period},
+               "-v ".$Lang::tr{'bytes per second'},
+               "--color=SHADEA".$color{"color19"},
+               "--color=SHADEB".$color{"color19"},
+               "--color=BACK".$color{"color21"},
                "COMMENT:".sprintf("%-28s",$Lang::tr{'caption'}),
                "COMMENT:".sprintf("%15s",$Lang::tr{'maximal'}),
                "COMMENT:".sprintf("%15s",$Lang::tr{'average'}),
                "COMMENT:".sprintf("%15s",$Lang::tr{'minimal'}),
-               "COMMENT:".sprintf("%15s",$Lang::tr{'current'})."\\j",
-               $description
+               "COMMENT:".sprintf("%15s",$Lang::tr{'current'})."\\j"
        );
-       open( FILE, "< $classfile" ) or die "Unable to read $classfile";
-       @classes = <FILE>;
-       close FILE;
-       foreach $classentry (sort @classes)
-       {
-               @classline = split( /\;/, $classentry );
-               if ( $classline[0] eq $qossettings{'DEV'} )
-               {
-                       $color=random_hex_color(6);
-                       push(@command, "DEF:$classline[1]=$rrdlog/class_$qossettings{'CLASSPRFX'}-$classline[1]_$qossettings{'DEV'}.rrd:bytes:AVERAGE");
-
-                       if ($count eq "1") {
-                               push(@command, "AREA:$classline[1]$color:Klasse $classline[1] -".sprintf("%15s",$classline[8]));
-                       } else {
-                               push(@command, "STACK:$classline[1]$color:Klasse $classline[1] -".sprintf("%15s",$classline[8]));
 
+               open( FILE, "< $classfile" ) or die "Unable to read $classfile";
+               @classes = <FILE>;
+               close FILE;
+
+               foreach $classentry (sort @classes){
+                       @classline = split( /\;/, $classentry );
+                       if ( $classline[0] eq $qossettings{'DEV'} ){
+                               $color=random_hex_color(6);
+                               push(@command, "DEF:$classline[1]=$mainsettings{'RRDLOG'}/class_$qossettings{'CLASSPRFX'}-$classline[1]_$qossettings{'DEV'}.rrd:bytes:AVERAGE");
+
+                               if ($count eq "1") {
+                                       push(@command, "AREA:$classline[1]$color:Klasse $classline[1] -".sprintf("%15s",$classline[8]));
+                               } else {
+                                       push(@command, "STACK:$classline[1]$color:Klasse $classline[1] -".sprintf("%15s",$classline[8]));
+
+                               }
+
+                               push(@command, "GPRINT:$classline[1]:MAX:%8.1lf %sBps"
+                                               , "GPRINT:$classline[1]:AVERAGE:%8.1lf %sBps"
+                                               , "GPRINT:$classline[1]:MIN:%8.1lf %sBps"
+                                               , "GPRINT:$classline[1]:LAST:%8.1lf %sBps\\j");
+                               $count++;
                        }
-                       push(@command, "GPRINT:$classline[1]:MAX:%8.1lf %sBps");
-                       push(@command, "GPRINT:$classline[1]:AVERAGE:%8.1lf %sBps");
-                       push(@command, "GPRINT:$classline[1]:MIN:%8.1lf %sBps");
-                       push(@command, "GPRINT:$classline[1]:LAST:%8.1lf %sBps\\j");
-                       $count++;
                }
+               RRDs::graph (@command);
+               $ERROR = RRDs::error;
+               print "Error in RRD::graph for qos device ".$qossettings{'DEV'}.": ".$ERROR."\n" if $ERROR;
+}
+
+# Generate the CPU Frequency Graph for the current period of time for values given by collectd an lm_sensors
+
+sub updatecpufreqgraph {
+       my $period    = $_[0];
+       my @command = (
+               "-",
+               "--start",
+               "-1".$period,
+               "-aPNG",
+               "-i",
+               "-z",
+               "-W www.ipfire.org",
+               "--alt-y-grid",
+               "-w 600",
+               "-h 125",
+               "-l 0",
+               "-u 100",
+               "-r",
+               "-t ".$Lang::tr{'cpu frequency per'}." ".$Lang::tr{$period},
+               "-v MHz",
+               "--color=SHADEA".$color{"color19"},
+               "--color=SHADEB".$color{"color19"},
+               "--color=BACK".$color{"color21"},
+               "COMMENT:".sprintf("%-29s",$Lang::tr{'caption'}),
+               "COMMENT:".sprintf("%15s",$Lang::tr{'maximal'}),
+               "COMMENT:".sprintf("%15s",$Lang::tr{'average'}),
+               "COMMENT:".sprintf("%15s",$Lang::tr{'minimal'}),
+               "COMMENT:".sprintf("%15s",$Lang::tr{'current'})."\\j"
+       );
+
+       for(my $i = 0; $i < $cpucount; $i++) {
+               push(@command,"DEF:cpu".$i."_=".$mainsettings{'RRDLOG'}."/collectd/localhost/cpufreq/cpufreq-".$i.".rrd:value:AVERAGE"
+                               ,"CDEF:cpu".$i."=cpu".$i."_,1000000,/"
+                               ,"LINE3:cpu".$i.$color{"color12"}."A0:1"
+                               ,"GPRINT:cpu".$i.":MAX:%3.0lf Mhz"
+                               ,"GPRINT:cpu".$i.":AVERAGE:%3.0lf Mhz"
+                               ,"GPRINT:cpu".$i.":MIN:%3.0lf Mhz"
+                               ,"GPRINT:cpu".$i.":LAST:%3.0lf Mhz\\j");
        }
+
        RRDs::graph (@command);
        $ERROR = RRDs::error;
-       print "$ERROR";
+       print "Error in RRD::graph for cpu freq: ".$ERROR."\n" if $ERROR;
 }
 
 # Generate a random color, used by Qos Graph to be independent from the amount of values
index f92ecf2c8ac64e5d0f9d3f3b57149ffc2a4ca894..c2a974a1009e9c0ea07c48057e43a5b258796b49 100644 (file)
@@ -19,7 +19,6 @@ LoadPlugin interface
 LoadPlugin iptables
 LoadPlugin load
 #LoadPlugin logfile
-#LoadPlugin mbmon
 LoadPlugin memory
 LoadPlugin ping
 LoadPlugin processes
@@ -76,8 +75,6 @@ LoadPlugin syslog
 
 <Plugin rrdtool>
        DataDir "/var/log/rrd/collectd"
-       CacheTimeout 300
-       CacheFlush   900
 </Plugin>
 
 <Plugin syslog>
index 51d7280f57e9882cb0017e1e4e5b9ab8f049b700..3ccf9c851e7d48c6f72d5d45383a473305cf2741 100644 (file)
@@ -8,14 +8,9 @@ bin/ntfs-3g
 lib/libntfs-3g.so
 lib/libntfs-3g.so.38
 lib/libntfs-3g.so.38.0.0
-srv/web/ipfire/html/images/updbooster/
-srv/web/ipfire/cgi-bin/updatexlrator.cgi
-var/ipfire/updatexlrator/bin/
-usr/sbin/updxlrator
 srv/web/ipfire/cgi-bin/qos.cgi
 usr/local/bin/qosd
 var/ipfire/qos/bin
-var/ipfire/langs
 usr/lib/collectd/
 var/lib/collectd/
 usr/sbin/collectd
index ba7ba3409c9574c4470a024cc3998517acae83f3..d0f192f5398e7f20e30b4df7e81007683aabfb51 100644 (file)
@@ -41,3 +41,9 @@ var/ipfire/sensors/
 var/ipfire/graphs.pl
 var/ipfire/firebuild
 var/ipfire/proxy/advanced/useragents
+srv/web/ipfire/html/images/updbooster/
+srv/web/ipfire/cgi-bin/updatexlrator.cgi
+var/ipfire/updatexlrator/bin/
+usr/sbin/updxlrator
+var/ipfire/langs
+usr/local/bin/qosd
index b1e2d9685e237c9e676969660a4556bac22ee8f0..632429fbbb06057cfb43c0cfabac357c2c7c13a0 100755 (executable)
@@ -59,6 +59,8 @@ echo boot >> /opt/pakfire/tmp/ROOTFILES
 echo srv/web/ipfire/cgi-bin/fwhits.cgi >> /opt/pakfire/tmp/ROOTFILES
 echo srv/web/ipfire/cgi-bin/network.cgi >> /opt/pakfire/tmp/ROOTFILES
 echo srv/web/ipfire/cgi-bin/traffics.cgi >> /opt/pakfire/tmp/ROOTFILES
+echo srv/web/ipfire/cgi-bin/graphs.cgi >> /opt/pakfire/tmp/ROOTFILES
+echo srv/web/ipfire/cgi-bin/qosgraph.cgi >> /opt/pakfire/tmp/ROOTFILES
 #
 tar cjvf /var/ipfire/backup/update_$OLDVERSION-$NEWVERSION.tar.bz2 \
    -T /opt/pakfire/tmp/ROOTFILES --exclude='#*' -C / > /dev/null 2>&1 
@@ -78,6 +80,8 @@ rm -rf /etc/rc.d/rc3.d/S99squid
 rm -rf /srv/web/ipfire/cgi-bin/fwhits.cgi
 rm -rf /srv/web/ipfire/cgi-bin/network.cgi
 rm -rf /srv/web/ipfire/cgi-bin/traffics.cgi
+rm -rf /srv/web/ipfire/cgi-bin/graphs.cgi
+rm -rf /srv/web/ipfire/cgi-bin/qosgraph.cgi
 #
 # Delete old iptables libs...
 #
diff --git a/html/cgi-bin/graphs.cgi b/html/cgi-bin/graphs.cgi
deleted file mode 100644 (file)
index 76f7bc4..0000000
+++ /dev/null
@@ -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();
index 3bdad6404141835ebe936422898a84089ce40e45..73885a0d7e6445d28d9e8429208e594ad93c975c 100644 (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 $_/*`){
index 3ddee0560cd1dbabdd8baa56f4c0d512ec219bbc..371c8f3ca1b62fb6ed652ef87040a86604b5cc6b 100644 (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();
 
+}
+
 ############################################################################################################################
 ############################################################################################################################
 
diff --git a/html/cgi-bin/qosgraph.cgi b/html/cgi-bin/qosgraph.cgi
deleted file mode 100644 (file)
index a01edf7..0000000
+++ /dev/null
@@ -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();
index 6c85e3823807c43d4131618cb2a4e1623d618643..3343ad57ffecdef09aca4eae15599344616f2023 100644 (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();
index 4587d126d8fa2d613aa8a6dc95829378385c020f..dee8ee2014ff08567b294d8558d9c91e839c03fb 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w 
+#!/usr/bin/perl -w
 use strict;
 
 ##########################################
@@ -47,8 +47,11 @@ use strict;
 # Configuration options:
 #
 my  $device        = "$ARGV[0]";
-our $rrd_datadir   = "/var/log/rrd/";
-our $event_datadir = $rrd_datadir;
+
+my %mainsettings = ();
+&General::readhash("${General::swroot}/main/settings", \%mainsettings);
+
+our $event_datadir = $mainsettings{'RRDLOG'};
 our $STEP          = 10;
 our $tc_command    = "/sbin/tc";
 
@@ -58,20 +61,20 @@ our $tc_command    = "/sbin/tc";
 my $include_dir = '/var/ipfire/qos/bin';
 
 
-# Create the $rrd_datadir if it doesn't exists
-if ( ! -d $rrd_datadir ) {
-    print "RRD-datadir not found, creating it: $rrd_datadir \n";
-    my $status = system("mkdir $rrd_datadir");
-    die "\nERROR cannot create \"$rrd_datadir\"\n" unless $status == 0;
+# Create the $mainsettings{'RRDLOG'} if it doesn't exists
+if ( ! -d $mainsettings{'RRDLOG'} ) {
+    print "RRD-datadir not found, creating it: $mainsettings{'RRDLOG'} \n";
+    my $status = system("mkdir $mainsettings{'RRDLOG'}");
+    die "\nERROR cannot create \"$mainsettings{'RRDLOG'}\"\n" unless $status == 0;
 }
 
 # use POSIX;
 #
-#POSIX::setsid() 
+#POSIX::setsid()
 #    or die "Can't become a daemon: $!";
 
 # The init scripts will do the right "daemon" thing...
-# Become a daemon  
+# Become a daemon
 print "Becoming a daemon...\n";
 my $pid = fork;
 exit if $pid;
@@ -88,6 +91,7 @@ $SIG{PIPE} = 'IGNORE';
 our %classes_data;
 our %classes_info;
 require "$include_dir/parse-func.pl";
+require "$include_dir/event-func.pl";
 require "$include_dir/RRD-func.pl";
 
 until ($time_to_die) {
@@ -103,10 +107,12 @@ until ($time_to_die) {
     #if ( $res ) {
     #  print " Error updating RRDs: \"$res\"\n";
     #}
-    
+
+    process_events();
+
 #    my $timestamp = time;
 #    print "$timestamp\n";
-   
+
     sleep($STEP);
 }