]> 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 f8b182b5e83d3168a5f7841c98cbe1d577b3d9b8..4942c98c86a92acfdcd138aadec923bf7694f33a 100644 (file)
@@ -92,8 +92,8 @@ sub makegraphbox {
        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'><b>".$Lang::tr{'year'}."</b></a>";
-       print "<iframe src='".$_[0]."?".$_[1]."?".$_[2]."' width='".$width."' height='".$height."' scrolling='no' frameborder='no' marginheight='0' name='".$_[1]."box'></iframe>";
        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
@@ -216,7 +216,7 @@ sub updatecpugraph {
                        ,"GPRINT:userpct:AVERAGE:%3.2lf%%"
                        ,"GPRINT:userpct:MIN:%3.2lf%%"
                        ,"GPRINT:userpct:LAST:%3.2lf%%\\j"
-                       ,"STACK:systempct".$color{"color13"}."A0:".sprintf("%-26s",$Lang::tr{'cpu system usage'})
+                       ,"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%%"
@@ -422,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++;
                }
@@ -471,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++;
                }
@@ -627,12 +633,12 @@ sub updatefwhitsgraph {
                "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("%-24s","NewNotSyn"),
+               "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("%-24s",$Lang::tr{'portscans'}),
+               "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",
@@ -983,17 +989,18 @@ sub updateqosgraph {
                @classes = <FILE>;
                close FILE;
 
+               my $colorIndex = 0;
                foreach $classentry (sort @classes){
                        @classline = split( /\;/, $classentry );
                        if ( $classline[0] eq $qossettings{'DEV'} ){
-                               $color=random_hex_color(6);
+                               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:Klasse $classline[1] -".sprintf("%15s",$classline[8]));
+                                       push(@command, "AREA:$classline[1]$color:$Lang::tr{'Class'} $classline[1] -".sprintf("%15s",$classline[8]));
                                } else {
-                                       push(@command, "STACK:$classline[1]$color:Klasse $classline[1] -".sprintf("%15s",$classline[8]));
-
+                                       push(@command, "STACK:$classline[1]$color:$Lang::tr{'Class'} $classline[1] -".sprintf("%15s",$classline[8]));
                                }
 
                                push(@command, "GPRINT:$classline[1]:MAX:%8.1lf %sBps"
@@ -1114,3 +1121,36 @@ 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;
+}