]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - config/cfgroot/graphs.pl
Merge remote-tracking branch 'alfh/feature_vnstat_1.11' into beyond-next
[people/teissler/ipfire-2.x.git] / config / cfgroot / graphs.pl
index e386009152648563179a23574c34cb6c4e2d956b..4942c98c86a92acfdcd138aadec923bf7694f33a 100644 (file)
@@ -3,7 +3,7 @@
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2007  Michael Tremer & Christian Schmidt                      #
+# Copyright (C) 2005-2010  IPFire Team                                        #
 #                                                                             #
 # This program is free software: you can redistribute it and/or modify        #
 # it under the terms of the GNU General Public License as published by        #
@@ -30,9 +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
 # colors for this theme
@@ -43,22 +40,21 @@ 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
 # false collected values may be disable. The user has the ability to enter
 # custom graph names in order to change temp0 to cpu or motherboard
 
-my $key;
-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-*/`;
-foreach (@sensorsdir)
-{
+my @sensorsdir = `ls -dA $mainsettings{'RRDLOG'}/collectd/localhost/sensors-*/ 2>/dev/null`;
+foreach (@sensorsdir){
        chomp($_);chop($_);
        foreach (`ls $_/*`){
                chomp($_);
@@ -71,18 +67,6 @@ foreach (@sensorsdir)
 }
 
 &General::readhash("${General::swroot}/sensors/settings", \%sensorsettings);
-use Encode 'from_to';
-
-my %tr=();
-if ((${Lang::language} eq 'el') ||
-       (${Lang::language} eq 'fa') ||
-       (${Lang::language} eq 'ru') ||
-       (${Lang::language} eq 'th') ||
-       (${Lang::language} eq 'vi') ||
-       (${Lang::language} eq 'zh') ||
-       (${Lang::language} eq 'zt')) {
-       eval `/bin/cat "${General::swroot}/langs/en.pl"`;
-} else {%tr=%Lang::tr;}
 
 # Generate a nice box for selection of time range in graphs
 # this will generate a nice iframe for the cgi every klick for
@@ -93,29 +77,30 @@ if ((${Lang::language} eq 'el') ||
 # 3 if given is the height of the iframe default if nothing is given
 
 sub makegraphbox {
-       my $height = 275;
+       my $height = 285;
        my $width = 700;
 
        if ( $_[3] ne "" ){ $height = $_[3]; }
 
        print "<center>";
-       print "<a href='".$_[0]."?".$_[1]."?hour' target='".$_[1]."box'>Hour</a>";
+       print "<a href='".$_[0]."?".$_[1]."?hour' target='".$_[1]."box'><b>".$Lang::tr{'hour'}."</b></a>";
        print " - ";
-       print "<a href='".$_[0]."?".$_[1]."?day' target='".$_[1]."box'>Day</a>";
+       print "<a href='".$_[0]."?".$_[1]."?day' target='".$_[1]."box'><b>".$Lang::tr{'day'}."</b></a>";
        print " - ";
-       print "<a href='".$_[0]."?".$_[1]."?week' target='".$_[1]."box'>Week</a>";
+       print "<a href='".$_[0]."?".$_[1]."?week' target='".$_[1]."box'><b>".$Lang::tr{'week'}."</b></a>";
        print " - ";
-       print "<a href='".$_[0]."?".$_[1]."?month' target='".$_[1]."box'>Month</a>";
+       print "<a href='".$_[0]."?".$_[1]."?month' target='".$_[1]."box'><b>".$Lang::tr{'month'}."</b></a>";
        print " - ";
-       print "<a href='".$_[0]."?".$_[1]."?year' target='".$_[1]."box'>Year</a>";
-       print "<iframe src='".$_[0]."?".$_[1]."?".$_[2]."' width='".$width."' height='".$height."' scrolling='no' frameborder='no' marginheight='0' name='".$_[1]."box'></iframe>";
+       print "<a href='".$_[0]."?".$_[1]."?year' target='".$_[1]."box'><b>".$Lang::tr{'year'}."</b></a>";
        print "</center>";
+       print "<iframe src='".$_[0]."?".$_[1]."?".$_[2]."' width='".$width."' height='".$height."' scrolling='no' frameborder='no' marginheight='0' name='".$_[1]."box'></iframe>";
 }
 
 # Generate the CPU Graph for the current period of time for values given by
 # collectd we are now able to handle any kind of cpucount
 
 sub updatecpugraph {
+       my $cpucount = `ls -dA $mainsettings{'RRDLOG'}/collectd/localhost/cpu-*/ 2>/dev/null | wc -l`;
        my $period    = $_[0];
        my @command = (
                "-",
@@ -131,7 +116,7 @@ sub updatecpugraph {
                "-l 0",
                "-u 100",
                "-r",
-               "-t ".$Lang::tr{'cpu usage per'}." ".$Lang::tr{$period},
+               "-t ".$Lang::tr{'cpu usage per'}." ".$Lang::tr{$period."-graph"},
                "-v ".$Lang::tr{'percentage'},
                "--color=SHADEA".$color{"color19"},
                "--color=SHADEB".$color{"color19"},
@@ -154,14 +139,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.",";
@@ -176,66 +162,70 @@ sub updatecpugraph {
                $addstring .= "+,";
        }
 
-       $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");
+       if ( $cpucount > 1){
+               $addstring .= "+";
+               push(@command,$nice.$addstring
+                       ,$interrupt.$addstring
+                       ,$steal.$addstring
+                       ,$user.$addstring
+                       ,$system.$addstring
+                       ,$idle.$addstring
+                       ,$iowait.$addstring
+                       ,$irq.$addstring);
+       }else{
+               chop($nice),chop($interrupt),chop($steal),chop($user),chop($system),chop($idle),chop($iowait),chop($irq);
+               push(@command,$nice,$interrupt,$steal,$user,$system,$idle,$iowait,$irq);
+       }
+
+       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;
@@ -259,19 +249,19 @@ sub updateloadgraph {
                "-h 125",
                "-l 0",
                "-r",
-               "-t Load Average".$Lang::tr{'graph per'}." ".$Lang::tr{$period},
+               "-t Load Average ".$Lang::tr{'graph per'}." ".$Lang::tr{$period."-graph"},
                "-v ".$Lang::tr{'processes'},
                "--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",
-               "AREA:load1".$color{"color13"}."A0:1 Minute:",
+               "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 ".$Lang::tr{'minute'}.":",
                "GPRINT:load1:LAST:%5.2lf",
-               "AREA:load5".$color{"color18"}."A0:5 Minuten:",
+               "AREA:load5".$color{"color18"}."A0:5 ".$Lang::tr{'minutes'}.":",
                "GPRINT:load5:LAST:%5.2lf",
-               "AREA:load15".$color{"color14"}."A0:15 Minuten:",
+               "AREA:load15".$color{"color14"}."A0:15 ".$Lang::tr{'minutes'}.":",
                "GPRINT:load15:LAST:%5.2lf\\j",
                "LINE1:load5".$color{"color13"},
                "LINE1:load1".$color{"color18"},
@@ -298,15 +288,15 @@ sub updatememorygraph {
                "-l 0",
                "-u 100",
                "-r",
-               "-t ".$Lang::tr{'memory usage per'}." ".$Lang::tr{$period},
+               "-t ".$Lang::tr{'memory usage per'}." ".$Lang::tr{$period."-graph"},
                "-v ".$Lang::tr{'percentage'},
                "--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,*",
@@ -360,14 +350,14 @@ sub updateswapgraph {
                "-l 0",
                "-u 100",
                "-r",
-               "-t ".$Lang::tr{'swap usage per'}." ".$Lang::tr{$period},
+               "-t ".$Lang::tr{'swap usage per'}." ".$Lang::tr{$period."-graph"},
                "-v ".$Lang::tr{'percentage'},
                "--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:free=".$mainsettings{'RRDLOG'}."/collectd/localhost/swap/swap-free.rrd:value:AVERAGE",
+               "DEF:used=".$mainsettings{'RRDLOG'}."/collectd/localhost/swap/swap-used.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,/,*",
@@ -382,16 +372,16 @@ sub updateswapgraph {
                "GPRINT:usedpct:AVERAGE:%3.2lf%%",
                "GPRINT:usedpct:MIN:%3.2lf%%",
                "GPRINT:usedpct:LAST:%3.2lf%%\\j",
-               "STACK:freepct".$color{"color12"}."A0:".sprintf("%-25s",$Lang::tr{'free swap'}),
-               "GPRINT:freepct:MAX:%3.2lf%%",
-               "GPRINT:freepct:AVERAGE:%3.2lf%%",
-               "GPRINT:freepct:MIN:%3.2lf%%",
-               "GPRINT:freepct:LAST:%3.2lf%%\\j",
                "STACK:cachedpct".$color{"color13"}."A0:".sprintf("%-25s",$Lang::tr{'cached swap'}),
                "GPRINT:cachedpct:MAX:%3.2lf%%",
                "GPRINT:cachedpct:AVERAGE:%3.2lf%%",
                "GPRINT:cachedpct:MIN:%3.2lf%%",
                "GPRINT:cachedpct:LAST:%3.2lf%%\\j",
+               "STACK:freepct".$color{"color12"}."A0:".sprintf("%-25s",$Lang::tr{'free swap'}),
+               "GPRINT:freepct:MAX:%3.2lf%%",
+               "GPRINT:freepct:AVERAGE:%3.2lf%%",
+               "GPRINT:freepct:MIN:%3.2lf%%",
+               "GPRINT:freepct:LAST:%3.2lf%%\\j",
                );
                $ERROR = RRDs::error;
                print "Error in RRD::graph for memory: ".$ERROR."\n" if $ERROR;
@@ -400,6 +390,7 @@ sub updateswapgraph {
 # Generate the Process Cpu Graph for the current period of time for values given by collecd
 
 sub updateprocessescpugraph {
+       my @processesgraph = getprocesses();
        my $period    = $_[0];
        my $count="0";
 
@@ -416,7 +407,7 @@ sub updateprocessescpugraph {
                "-h 125",
                "-l 0",
                "-r",
-               "-t ".$Lang::tr{'processes'}." ".$Lang::tr{'graph per'}." ".$Lang::tr{$period},
+               "-t ".$Lang::tr{'processes'}." ".$Lang::tr{'graph per'}." ".$Lang::tr{$period."-graph"},
                "--color=SHADEA".$color{"color19"},
                "--color=SHADEB".$color{"color19"},
                "--color=BACK".$color{"color21"}
@@ -431,12 +422,15 @@ sub updateprocessescpugraph {
 
                push(@command,"COMMENT:".$Lang::tr{'caption'}."\\j");
 
+               my $colorIndex = 0;
                foreach(@processesgraph){
+                       my $colorIndex = 10 + $count % 15;
+                       my $color="$color{\"color$colorIndex\"}";
                        chomp($_);my @name=split(/\-/,$_);chop($name[1]);
                        if ($count eq "0"){
-                               push(@command,"AREA:".$name[1].random_hex_color(6)."A0:".$name[1]);
+                               push(@command,"AREA:".$name[1].$color."A0:".$name[1]);
                        }else{
-                               push(@command,"STACK:".$name[1].random_hex_color(6)."A0:".$name[1]);
+                               push(@command,"STACK:".$name[1].$color."A0:".$name[1]);
                        }
                        $count++;
                }
@@ -449,6 +443,7 @@ sub updateprocessescpugraph {
 # Generate the Process Memory Graph for the current period of time for values given by collecd
 
 sub updateprocessesmemorygraph {
+       my @processesgraph = getprocesses();
        my $period    = $_[0];
        my $count="0";
 
@@ -465,7 +460,7 @@ sub updateprocessesmemorygraph {
                "-h 125",
                "-l 0",
                "-r",
-               "-t ".$Lang::tr{'processes'}." ".$Lang::tr{'memory'}." ".$Lang::tr{'graph per'}." ".$Lang::tr{$period},
+               "-t ".$Lang::tr{'processes'}." ".$Lang::tr{'memory'}." ".$Lang::tr{'graph per'}." ".$Lang::tr{$period."-graph"},
                "-v ".$Lang::tr{'bytes'},
                "--color=SHADEA".$color{"color19"},
                "--color=SHADEB".$color{"color19"},
@@ -479,12 +474,15 @@ sub updateprocessesmemorygraph {
 
                push(@command,"COMMENT:".$Lang::tr{'caption'}."\\j");
 
+               my $colorIndex = 0;
                foreach(@processesgraph){
                        chomp($_);my @name=split(/\-/,$_);chop($name[1]);
+                       my $colorIndex = 10 + $count % 15;
+                       my $color="$color{\"color$colorIndex\"}";
                        if ($count eq "0"){
-                               push(@command,"AREA:".$name[1].random_hex_color(6)."A0:".$name[1]);
+                               push(@command,"AREA:".$name[1].$color."A0:".$name[1]);
                        }else{
-                               push(@command,"STACK:".$name[1].random_hex_color(6)."A0:".$name[1]);
+                               push(@command,"STACK:".$name[1].$color."A0:".$name[1]);
                        }
                        $count++;
                }
@@ -511,15 +509,15 @@ sub updatediskgraph {
                "-w 600",
                "-h 125",
                "-r",
-               "-t ".$disk." ".$Lang::tr{'disk access per'}." ".$Lang::tr{$period},
+               "-t ".$disk." ".$Lang::tr{'disk access per'}." ".$Lang::tr{$period."-graph"},
                "-v ".$Lang::tr{'bytes per second'},
                "--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'}),
@@ -561,13 +559,13 @@ sub updateifgraph {
                "-w 600",
                "-h 125",
                "-r",
-               "-t ".$Lang::tr{'traffic on'}." ".$interface." ".$Lang::tr{'graph per'}." ".$Lang::tr{$period},
+               "-t ".$Lang::tr{'traffic on'}." ".$interface." ".$Lang::tr{'graph per'}." ".$Lang::tr{$period."-graph"},
                "-v ".$Lang::tr{'bytes per second'},
                "--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'}),
@@ -605,27 +603,42 @@ sub updatefwhitsgraph {
                "-w 600",
                "-h 125",
                "-r",
-               "-t ".$Lang::tr{'firewall hits per'}." ".$Lang::tr{$period},
+               "-t ".$Lang::tr{'firewall hits per'}." ".$Lang::tr{$period."-graph"},
                "-v ".$Lang::tr{'bytes per second'},
                "--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",
-               "CDEF:amount=output,input,newnotsyn,+,+",
-               "COMMENT:".sprintf("%-20s",$Lang::tr{'caption'}),
+               "DEF:output=".$mainsettings{'RRDLOG'}."/collectd/localhost/iptables-filter-POLICYOUT/ipt_bytes-DROP_OUTPUT.rrd:value:AVERAGE",
+               "DEF:input=".$mainsettings{'RRDLOG'}."/collectd/localhost/iptables-filter-POLICYIN/ipt_bytes-DROP_INPUT.rrd:value:AVERAGE",
+               "DEF:forward=".$mainsettings{'RRDLOG'}."/collectd/localhost/iptables-filter-POLICYFWD/ipt_bytes-DROP_FORWARD.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",
+               "COMMENT:".sprintf("%-26s",$Lang::tr{'caption'}),
                "COMMENT:".sprintf("%15s",$Lang::tr{'maximal'}),
                "COMMENT:".sprintf("%15s",$Lang::tr{'average'}),
-               "COMMENT:".sprintf("%15s",$Lang::tr{'minimal'}),
+               "COMMENT:".sprintf("%14s",$Lang::tr{'minimal'}),
                "COMMENT:".sprintf("%15s",$Lang::tr{'current'})."\\j",
-               "AREA:amount".$color{"color24"}."A0:".sprintf("%-20s",$Lang::tr{'firewallhits'}),
-               "GPRINT:amount:MAX:%8.1lf %sBps",
-               "GPRINT:amount:AVERAGE:%8.1lf %sBps",
-               "GPRINT:amount:MIN:%8.1lf %sBps",
-               "GPRINT:amount:LAST:%8.1lf %sBps\\j",
-               "STACK:portscan".$color{"color25"}."A0:".sprintf("%-20s",$Lang::tr{'portscans'}),
+               "AREA:output".$color{"color25"}."A0:".sprintf("%-25s",$Lang::tr{'firewallhits'}."-OUTPUT"),
+               "GPRINT:output:MAX:%8.1lf %sBps",
+               "GPRINT:output:AVERAGE:%8.1lf %sBps",
+               "GPRINT:output:MIN:%8.1lf %sBps",
+               "GPRINT:output:LAST:%8.1lf %sBps\\j",
+               "STACK:forward".$color{"color23"}."A0:".sprintf("%-25s",$Lang::tr{'firewallhits'}."-FORWARD"),
+               "GPRINT:forward:MAX:%8.1lf %sBps",
+               "GPRINT:forward:AVERAGE:%8.1lf %sBps",
+               "GPRINT:forward:MIN:%8.1lf %sBps",
+               "GPRINT:forward:LAST:%8.1lf %sBps\\j",
+               "STACK:input".$color{"color24"}."A0:".sprintf("%-25s",$Lang::tr{'firewallhits'}."-INPUT"),
+               "GPRINT:input:MAX:%8.1lf %sBps",
+               "GPRINT:input:AVERAGE:%8.1lf %sBps",
+               "GPRINT:input:MIN:%8.1lf %sBps",
+               "GPRINT:input:LAST:%8.1lf %sBps\\j",
+               "STACK:newnotsyn".$color{"color14"}."A0:".sprintf("%-25s","NewNotSyn"),
+               "GPRINT:newnotsyn:MAX:%8.1lf %sBps",
+               "GPRINT:newnotsyn:MIN:%8.1lf %sBps",
+               "GPRINT:newnotsyn:AVERAGE:%8.1lf %sBps",
+               "GPRINT:newnotsyn:LAST:%8.1lf %sBps\\j",
+               "STACK:portscan".$color{"color16"}."A0:".sprintf("%-25s",$Lang::tr{'portscans'}),
                "GPRINT:portscan:MAX:%8.1lf %sBps",
                "GPRINT:portscan:MIN:%8.1lf %sBps",
                "GPRINT:portscan:AVERAGE:%8.1lf %sBps",
@@ -653,12 +666,12 @@ sub updatepinggraph {
                "-h 125",
                "-l 0",
                "-r",
-               "-t ".$Lang::tr{'linkq'}." ".$host." ".$Lang::tr{'graph per'}." ".$Lang::tr{$period},
+               "-t ".$Lang::tr{'linkq'}." ".$host." ".$Lang::tr{'graph per'}." ".$Lang::tr{$period."-graph"},
                "-v ms",
                "--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",
@@ -697,13 +710,13 @@ sub updatewirelessgraph {
                "--alt-y-grid",
                "-w 600",
                "-h 125",
-               "-t Wireless ".$interface." ".$Lang::tr{'graph per'}." ".$Lang::tr{$period},
+               "-t Wireless ".$interface." ".$Lang::tr{'graph per'}." ".$Lang::tr{$period."-graph"},
                "-v dBm",
                "--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'}),
@@ -741,13 +754,13 @@ sub updatehddgraph {
                "-w 600",
                "-h 125",
                "-r",
-               "-t ".$disk." ".$Lang::tr{'harddisk temperature'}." ".$Lang::tr{'graph per'}." ".$Lang::tr{$period},
+               "-t ".$disk." ".$Lang::tr{'harddisk temperature'}." ".$Lang::tr{'graph per'}." ".$Lang::tr{$period."-graph"},
                "-v Celsius",
                "--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",
@@ -781,7 +794,7 @@ sub updatehwtempgraph {
                "-w 600",
                "-h 125",
                "-r",
-               "-t ".$Lang::tr{'sensors temp'}." ".$Lang::tr{'graph per'}." ".$Lang::tr{$period},
+               "-t ".$Lang::tr{'mbmon temp'}." ".$Lang::tr{'graph per'}." ".$Lang::tr{$period."-graph"},
                "--color=SHADEA".$color{"color19"},
                "--color=SHADEB".$color{"color19"},
                "--color=BACK".$color{"color21"},
@@ -834,7 +847,7 @@ sub updatehwfangraph {
                "-w 600",
                "-h 125",
                "-r",
-               "-t ".$Lang::tr{'mbmon fan'}." ".$Lang::tr{'graph per'}." ".$Lang::tr{$period},
+               "-t ".$Lang::tr{'mbmon fan'}." ".$Lang::tr{'graph per'}." ".$Lang::tr{$period."-graph"},
                "--color=SHADEA".$color{"color19"},
                "--color=SHADEB".$color{"color19"},
                "--color=BACK".$color{"color21"},
@@ -887,7 +900,7 @@ sub updatehwvoltgraph {
                "-w 600",
                "-h 125",
                "-r",
-               "-t ".$Lang::tr{'mbmon volt'}." ".$Lang::tr{'graph per'}." ".$Lang::tr{$period},
+               "-t ".$Lang::tr{'mbmon volt'}." ".$Lang::tr{'graph per'}." ".$Lang::tr{$period."-graph"},
                "--color=SHADEA".$color{"color19"},
                "--color=SHADEB".$color{"color19"},
                "--color=BACK".$color{"color21"},
@@ -924,138 +937,175 @@ sub updatehwvoltgraph {
 }
 
 
+# Generate the QoS Graph for the current period of time
 
+sub updateqosgraph {
 
+       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';
+       }
 
+       my $ERROR="";
+       my $count="1";
+       my $color="#000000";
 
+       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."-graph"},
+               "-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"
+       );
 
+               open( FILE, "< $classfile" ) or die "Unable to read $classfile";
+               @classes = <FILE>;
+               close FILE;
+
+               my $colorIndex = 0;
+               foreach $classentry (sort @classes){
+                       @classline = split( /\;/, $classentry );
+                       if ( $classline[0] eq $qossettings{'DEV'} ){
+                               my $colorIndex = 10 + $count % 15;
+                               $color="$color{\"color$colorIndex\"}";
+                               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:$Lang::tr{'Class'} $classline[1] -".sprintf("%15s",$classline[8]));
+                               } else {
+                                       push(@command, "STACK:$classline[1]$color:$Lang::tr{'Class'} $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++;
+                       }
+               }
+               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
 
-
-
-
-
-
-# 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");
+       my $cpucount = `ls -dA $mainsettings{'RRDLOG'}/collectd/localhost/cpu-*/ 2>/dev/null | wc -l`;
+       my $period    = $_[0];
+       my @command = (
+               "-",
+               "--start",
+               "-1".$period,
+               "-aPNG",
+               "-i",
+               "-z",
+               "-W www.ipfire.org",
+               "--alt-y-grid",
+               "-w 600",
+               "-h 125",
+               "-r",
+               "-t ".$Lang::tr{'cpu frequency per'}." ".$Lang::tr{$period."-graph"},
+               "-v MHz",
+               "--color=SHADEA".$color{"color19"},
+               "--color=SHADEB".$color{"color19"},
+               "--color=BACK".$color{"color21"},
+               "COMMENT:".sprintf("%-10s",$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"
+       );
 
-               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",);
+       for(my $i = 0; $i < $cpucount; $i++) {
+               my $j=$i+1;
+               push(@command,"DEF:cpu".$i."_=".$mainsettings{'RRDLOG'}."/collectd/localhost/cpufreq/cpufreq-".$i.".rrd:value:AVERAGE"
+                               ,"CDEF:cpu".$i."=cpu".$i."_,1000000,/"
+                               ,"LINE1:cpu".$i.$color{"color1$j"}."A0:cpu ".$i." "
+                               ,"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");
        }
-       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;
-    }
+       $ERROR = RRDs::error;
+       print "Error in RRD::graph for cpu freq: ".$ERROR."\n" if $ERROR;
 }
 
-# Generate the QoS Graph for the current period of time
-
-sub updateqosgraph {
+# Generate the Thermal Zone Temp CPU Graph
 
-  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];
-       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"},
-               "COMMENT:".sprintf("%-28s",$Lang::tr{'caption'}),
+sub updatethermaltempgraph {
+       my $thermalcount = `ls -dA $mainsettings{'RRDLOG'}/collectd/localhost/thermal-thermal_zone* 2>/dev/null | wc -l`;
+       my $period    = $_[0];
+       my @command = (
+               "-",
+               "--start",
+               "-1".$period,
+               "-aPNG",
+               "-i",
+               "-z",
+               "-W www.ipfire.org",
+               "--alt-y-grid",
+               "-w 600",
+               "-h 125",
+               "-r",
+               "-t "."ACPI Thermal-Zone Temperature"." - ".$Lang::tr{$period."-graph"},
+               "-v Grad Celsius",
+               "--color=SHADEA".$color{"color19"},
+               "--color=SHADEB".$color{"color19"},
+               "--color=BACK".$color{"color21"},
+               "COMMENT:".sprintf("%-10s",$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]));
 
-                       }
-                       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++;
-               }
+       for(my $i = 0; $i < $thermalcount; $i++) {
+               my $j=$i+1;
+               push(@command,"DEF:temp".$i."_=".$mainsettings{'RRDLOG'}."/collectd/localhost/thermal-thermal_zone".$i."/temperature-temperature.rrd:value:AVERAGE"
+                               ,"CDEF:temp".$i."=temp".$i."_,1,/"
+                               ,"LINE3:temp".$i.$color{"color1$j"}."A0:Temp ".$i." "
+                               ,"GPRINT:temp".$i.":MAX:%3.0lf Grad C"
+                               ,"GPRINT:temp".$i.":AVERAGE:%3.0lf Grad C"
+                               ,"GPRINT:temp".$i.":MIN:%3.0lf Grad C"
+                               ,"GPRINT:temp".$i.":LAST:%3.0lf Grad C\\j");
        }
+
        RRDs::graph (@command);
        $ERROR = RRDs::error;
-       print "$ERROR";
+       print "Error in RRD::graph for thermal temp: ".$ERROR."\n" if $ERROR;
 }
 
+
 # Generate a random color, used by Qos Graph to be independent from the amount of values
 
 sub random_hex_color {
@@ -1066,3 +1116,41 @@ sub random_hex_color {
        push @color, @hex[rand(@hex)] for 1 .. $size;
        return join('', '#', @color);
 }
+
+sub getprocesses {
+       my @processesgraph = `ls -dA $mainsettings{'RRDLOG'}/collectd/localhost/processes-*/ 2>/dev/null`;
+       return @processesgraph;
+}
+
+sub updateentropygraph {
+       my $period    = $_[0];
+       my @command = (
+               "-",
+               "--start",
+               "-1".$period,
+               "-aPNG",
+               "-i",
+               "-z",
+               "-W www.ipfire.org",
+               "--alt-y-grid",
+               "-w 600",
+               "-h 225",
+               "-r",
+               "--lower-limit","0",
+               "-t $Lang::tr{'entropy'}",
+               "-v $Lang::tr{'bit'}",
+               "DEF:entropy=$mainsettings{'RRDLOG'}/collectd/localhost/entropy/entropy.rrd:entropy:AVERAGE",
+               "LINE3:entropy#ff0000:" . sprintf("%-15s", $Lang::tr{'entropy'}),
+               "VDEF:entrmin=entropy,MINIMUM",
+               "VDEF:entrmax=entropy,MAXIMUM",
+               "VDEF:entravg=entropy,AVERAGE",
+               "GPRINT:entrmax:" . sprintf("%12s\\: %%5.0lf", $Lang::tr{'maximum'}),
+               "GPRINT:entrmin:" . sprintf("%12s\\: %%5.0lf", $Lang::tr{'minimum'}),
+               "GPRINT:entravg:" . sprintf("%12s\\: %%5.0lf", $Lang::tr{'average'}) . "\\n",
+       );
+
+       RRDs::graph (@command);
+       $ERROR = RRDs::error;
+
+       print "Error in RRD::graph for entropy: ".$ERROR."\n" if $ERROR;
+}