diff --git a/config/cfgroot/graphs.pl b/config/cfgroot/graphs.pl
index 7e6ee25cf..08dc6d3d9 100644
--- a/config/cfgroot/graphs.pl
+++ b/config/cfgroot/graphs.pl
@@ -1,7 +1,24 @@
#!/usr/bin/perl
# Generate Graphs exported from Makegraphs to minimize system load an only generate the Graphs when displayed
-# This is part of the IPFire Firewall
-
+###############################################################################
+# #
+# 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 . #
+# #
+###############################################################################
package Graphs;
@@ -13,7 +30,7 @@ require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
my $ERROR;
-my $rrdlog = "/var/log/rrd";
+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";
@@ -26,7 +43,6 @@ my %sensorsettings = ();
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
-
# 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
@@ -38,6 +54,7 @@ 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)
@@ -58,473 +75,745 @@ 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; # use translated version for other languages
+ (${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 requesting every klick for
+# the graph will be handled inside the iframe
+# 0 is the cgi revering to
+# 1 is the graph name
+# 2 is the time range for the graph
+# 3 if given is the height of the iframe default if nothing is given
+
+sub makegraphbox {
+ my $height = 275;
+ my $width = 700;
+
+ if ( $_[3] ne "" ){ $height = $_[3]; }
+
+ print "
";
+ print "Hour ";
+ print " - ";
+ print "Day ";
+ print " - ";
+ print "Week ";
+ print " - ";
+ print "Month ";
+ print " - ";
+ print "Year ";
+ print "";
+ print " ";
}
# Generate the CPU Graph for the current period of time for values given by
-# collectd atm only cpu average is displayed and only 1 or 2 cpus is working
+# collectd we are now able to handle any kind of cpucount
sub updatecpugraph {
- my $period = $_[0];
- my @command = ("$graphs/cpu-$period.png",
- "--start", "-1$period", "-aPNG", "-i", "-z", "-W www.ipfire.org", "-v $Lang::tr{'percentage'}",
- "--alt-y-grid", "-w 600", "-h 125", "-l 0", "-u 100", "-r",
- "--color", "SHADEA".$color{"color19"},
- "--color", "SHADEB".$color{"color19"},
- "--color", "BACK".$color{"color21"},
- "-t $Lang::tr{'cpu usage per'} $Lang::tr{$period}");
-
- if ( -e "$rrdlog/collectd/localhost/cpu-1/" ){
- push(@command,"DEF:iowait0=$rrdlog/collectd/localhost/cpu-0/cpu-wait.rrd:value:AVERAGE",
- "DEF:nice0=$rrdlog/collectd/localhost/cpu-0/cpu-nice.rrd:value:AVERAGE",
- "DEF:interrupt0=$rrdlog/collectd/localhost/cpu-0/cpu-interrupt.rrd:value:AVERAGE",
- "DEF:steal0=$rrdlog/collectd/localhost/cpu-0/cpu-steal.rrd:value:AVERAGE",
- "DEF:user0=$rrdlog/collectd/localhost/cpu-0/cpu-user.rrd:value:AVERAGE",
- "DEF:system0=$rrdlog/collectd/localhost/cpu-0/cpu-system.rrd:value:AVERAGE",
- "DEF:idle0=$rrdlog/collectd/localhost/cpu-0/cpu-idle.rrd:value:AVERAGE",
- "DEF:irq0=$rrdlog/collectd/localhost/cpu-0/cpu-softirq.rrd:value:AVERAGE");
- push(@command,"DEF:iowait1=$rrdlog/collectd/localhost/cpu-1/cpu-wait.rrd:value:AVERAGE",
- "DEF:nice1=$rrdlog/collectd/localhost/cpu-1/cpu-nice.rrd:value:AVERAGE",
- "DEF:interrupt1=$rrdlog/collectd/localhost/cpu-1/cpu-interrupt.rrd:value:AVERAGE",
- "DEF:steal1=$rrdlog/collectd/localhost/cpu-1/cpu-steal.rrd:value:AVERAGE",
- "DEF:user1=$rrdlog/collectd/localhost/cpu-1/cpu-user.rrd:value:AVERAGE",
- "DEF:system1=$rrdlog/collectd/localhost/cpu-1/cpu-system.rrd:value:AVERAGE",
- "DEF:idle1=$rrdlog/collectd/localhost/cpu-1/cpu-idle.rrd:value:AVERAGE",
- "DEF:irq1=$rrdlog/collectd/localhost/cpu-1/cpu-softirq.rrd:value:AVERAGE");
- push(@command,"CDEF:user=user0,user1,+",
- "CDEF:nice=nice0,nice1,+",
- "CDEF:interrupt=interrupt0,interrupt1,+",
- "CDEF:steal=steal0,steal1,+",
- "CDEF:system=system0,system1,+",
- "CDEF:idle=idle0,idle1,+",
- "CDEF:iowait=iowait0,iowait1,+",
- "CDEF:irq=irq0,irq1,+");
- }
- else {
- push(@command,"DEF:iowait=$rrdlog/collectd/localhost/cpu-0/cpu-wait.rrd:value:AVERAGE",
- "DEF:nice=$rrdlog/collectd/localhost/cpu-0/cpu-nice.rrd:value:AVERAGE",
- "DEF:interrupt=$rrdlog/collectd/localhost/cpu-0/cpu-interrupt.rrd:value:AVERAGE",
- "DEF:steal=$rrdlog/collectd/localhost/cpu-0/cpu-steal.rrd:value:AVERAGE",
- "DEF:user=$rrdlog/collectd/localhost/cpu-0/cpu-user.rrd:value:AVERAGE",
- "DEF:system=$rrdlog/collectd/localhost/cpu-0/cpu-system.rrd:value:AVERAGE",
- "DEF:idle=$rrdlog/collectd/localhost/cpu-0/cpu-idle.rrd:value:AVERAGE",
- "DEF:irq=$rrdlog/collectd/localhost/cpu-0/cpu-softirq.rrd:value:AVERAGE");
- }
- 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,/,*",
- "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",
- "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;
- print "Error in RRD::graph for cpu: $ERROR\n" if $ERROR;
-}
-
-# 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");
+ 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 usage per'}." ".$Lang::tr{$period},
+ "-v ".$Lang::tr{'percentage'},
+ "--color=SHADEA".$color{"color19"},
+ "--color=SHADEB".$color{"color19"},
+ "--color=BACK".$color{"color21"}
+ );
+
+ my $nice = "CDEF:nice=";
+ my $interrupt = "CDEF:interrupt=";
+ my $steal = "CDEF:steal=";
+ my $user = "CDEF:user=";
+ my $system = "CDEF:system=";
+ my $idle = "CDEF:idle=";
+ my $iowait = "CDEF:iowait=";
+ my $irq = "CDEF:irq=";
+ 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");
+ $nice .= "nice".$i.",";
+ $interrupt .= "interrupt".$i.",";
+ $steal .= "steal".$i.",";
+ $user .= "user".$i.",";
+ $system .= "system".$i.",";
+ $idle .= "idle".$i.",";
+ $iowait .= "iowait".$i.",";
+ $irq .= "irq".$i.",";
}
- 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,/");
+
+ for(my $i = 2; $i < $cpucount; $i++) {
+ $addstring .= "+,";
}
- 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",);
+ $addstring .= "+";
- 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",);
+ 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");
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: ".$ERROR."\n" if $ERROR;
}
-
# Generate the Load Graph for the current period of time for values given by collecd
sub updateloadgraph {
- my $period = $_[0];
-
- RRDs::graph ("$graphs/load-$period.png",
- "--start", "-1$period", "-aPNG",
- "-w 600", "-h 125", "-i", "-z", "-W www.ipfire.org", "-l 0", "-r", "--alt-y-grid",
- "-t Load Average $Lang::tr{'graph per'} $Lang::tr{$period}", "-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:",
- "GPRINT:load1:LAST:%5.2lf",
- "AREA:load5".$color{"color18"}."A0:5 Minuten:",
- "GPRINT:load5:LAST:%5.2lf",
- "AREA:load15".$color{"color14"}."A0:15 Minuten:",
- "GPRINT:load15:LAST:%5.2lf\\j",
- "LINE1:load5".$color{"color13"},
- "LINE1:load1".$color{"color18"});
- $ERROR = RRDs::error;
- print "Error in RRD::graph for load: $ERROR\n" if $ERROR;
+ my $period = $_[0];
+ RRDs::graph(
+ "-",
+ "--start",
+ "-1".$period,
+ "-aPNG",
+ "-i",
+ "-z",
+ "-W www.ipfire.org",
+ "--alt-y-grid",
+ "-w 600",
+ "-h 125",
+ "-l 0",
+ "-r",
+ "-t Load Average".$Lang::tr{'graph per'}." ".$Lang::tr{$period},
+ "-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:",
+ "GPRINT:load1:LAST:%5.2lf",
+ "AREA:load5".$color{"color18"}."A0:5 Minuten:",
+ "GPRINT:load5:LAST:%5.2lf",
+ "AREA:load15".$color{"color14"}."A0:15 Minuten:",
+ "GPRINT:load15:LAST:%5.2lf\\j",
+ "LINE1:load5".$color{"color13"},
+ "LINE1:load1".$color{"color18"},
+ );
+ $ERROR = RRDs::error;
+ print "Error in RRD::graph for load: ".$ERROR."\n" if $ERROR;
}
+# Generate the Memory Graph for the current period of time for values given by collecd
-# Generate the Memory and Swap Graph for the current period of time for values given by collecd
+sub updatememorygraph {
+ my $period = $_[0];
+ RRDs::graph(
+ "-",
+ "--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{'memory usage per'}." ".$Lang::tr{$period},
+ "-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",
+ "CDEF:total=used,free,cache,buffer,+,+,+",
+ "CDEF:usedpct=used,total,/,100,*",
+ "CDEF:bufferpct=buffer,total,/,100,*",
+ "CDEF:cachepct=cache,total,/,100,*",
+ "CDEF:freepct=free,total,/,100,*",
+ "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",
+ "AREA:usedpct".$color{"color11"}."A0:".sprintf("%-25s",$Lang::tr{'used memory'}),
+ "GPRINT:usedpct:MAX:%3.2lf%%",
+ "GPRINT:usedpct:AVERAGE:%3.2lf%%",
+ "GPRINT:usedpct:MIN:%3.2lf%%",
+ "GPRINT:usedpct:LAST:%3.2lf%%\\j",
+ "STACK:bufferpct".$color{"color23"}."A0:".sprintf("%-25s",$Lang::tr{'buffered memory'}),
+ "GPRINT:bufferpct:MAX:%3.2lf%%",
+ "GPRINT:bufferpct:AVERAGE:%3.2lf%%",
+ "GPRINT:bufferpct:MIN:%3.2lf%%",
+ "GPRINT:bufferpct:LAST:%3.2lf%%\\j",
+ "STACK:cachepct".$color{"color14"}."A0:".sprintf("%-25s",$Lang::tr{'cached memory'}),
+ "GPRINT:cachepct:MAX:%3.2lf%%",
+ "GPRINT:cachepct:AVERAGE:%3.2lf%%",
+ "GPRINT:cachepct:MIN:%3.2lf%%",
+ "GPRINT:cachepct:LAST:%3.2lf%%\\j",
+ "STACK:freepct".$color{"color12"}."A0:".sprintf("%-25s",$Lang::tr{'free memory'}),
+ "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;
+}
-sub updatememgraph {
- my $period = $_[0];
+# Generate the Swap Graph for the current period of time for values given by collecd
- RRDs::graph ("$graphs/memory-$period.png",
- "--start", "-1$period", "-aPNG", "-i", "-z", "-W www.ipfire.org", "-v $Lang::tr{'percentage'}",
- "--alt-y-grid", "-w 600", "-h 125", "-l 0", "-u 100", "-r",
- "--color", "SHADEA".$color{"color19"},
- "--color", "SHADEB".$color{"color19"},
- "--color", "BACK".$color{"color21"},
- "-t $Lang::tr{'memory usage per'} $Lang::tr{$period}",
- "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",
- "CDEF:total=used,free,cache,buffer,+,+,+",
- "CDEF:usedpct=used,total,/,100,*",
- "CDEF:bufferpct=buffer,total,/,100,*",
- "CDEF:cachepct=cache,total,/,100,*",
- "CDEF:freepct=free,total,/,100,*",
- "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",
- "AREA:usedpct".$color{"color11"}."A0:".sprintf("%-25s",$Lang::tr{'used memory'}),
- "GPRINT:usedpct:MAX:%3.2lf%%",
- "GPRINT:usedpct:AVERAGE:%3.2lf%%",
- "GPRINT:usedpct:MIN:%3.2lf%%",
- "GPRINT:usedpct:LAST:%3.2lf%%\\j",
- "STACK:bufferpct".$color{"color23"}."A0:".sprintf("%-25s",$Lang::tr{'buffered memory'}),
- "GPRINT:bufferpct:MAX:%3.2lf%%",
- "GPRINT:bufferpct:AVERAGE:%3.2lf%%",
- "GPRINT:bufferpct:MIN:%3.2lf%%",
- "GPRINT:bufferpct:LAST:%3.2lf%%\\j",
- "STACK:cachepct".$color{"color14"}."A0:".sprintf("%-25s",$Lang::tr{'cached memory'}),
- "GPRINT:cachepct:MAX:%3.2lf%%",
- "GPRINT:cachepct:AVERAGE:%3.2lf%%",
- "GPRINT:cachepct:MIN:%3.2lf%%",
- "GPRINT:cachepct:LAST:%3.2lf%%\\j",
- "STACK:freepct".$color{"color12"}."A0:".sprintf("%-25s",$Lang::tr{'free memory'}),
- "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 mem: $ERROR\n" if $ERROR;
+sub updateswapgraph {
+ my $period = $_[0];
+ RRDs::graph(
+ "-",
+ "--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{'swap usage per'}." ".$Lang::tr{$period},
+ "-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",
+ "CDEF:total=used,free,cached,+,+",
+ "CDEF:usedpct=100,used,total,/,*",
+ "CDEF:freepct=100,free,total,/,*",
+ "CDEF:cachedpct=100,cached,total,/,*",
+ "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",
+ "AREA:usedpct".$color{"color11"}."A0:".sprintf("%-25s",$Lang::tr{'used swap'}),
+ "GPRINT:usedpct:MAX:%3.2lf%%",
+ "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",
+ );
+ $ERROR = RRDs::error;
+ print "Error in RRD::graph for memory: ".$ERROR."\n" if $ERROR;
+}
- RRDs::graph ("$graphs/swap-$period.png",
- "--start", "-1$period", "-aPNG", "-i", "-z", "-W www.ipfire.org", "-v $Lang::tr{'percentage'}",
- "--alt-y-grid", "-w 600", "-h 125", "-l 0", "-u 100", "-r",
- "--color", "SHADEA".$color{"color19"},
- "--color", "SHADEB".$color{"color19"},
- "--color", "BACK".$color{"color21"},
- "-t $Lang::tr{'swap usage per'} $Lang::tr{$period}",
- "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",
- "CDEF:total=used,free,cached,+,+",
- "CDEF:usedpct=100,used,total,/,*",
- "CDEF:freepct=100,free,total,/,*",
- "CDEF:cachedpct=100,cached,total,/,*",
- "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",
- "AREA:usedpct".$color{"color11"}."A0:".sprintf("%-25s",$Lang::tr{'used swap'}),
- "GPRINT:usedpct:MAX:%3.2lf%%",
- "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");
- $ERROR = RRDs::error;
- print "Error in RRD::graph for swap: $ERROR\n" if $ERROR;
+# Generate the Process Cpu Graph for the current period of time for values given by collecd
+
+sub updateprocessescpugraph {
+ my $period = $_[0];
+ my $count="0";
+
+ my @command = (
+ "-",
+ "--start",
+ "-1".$period,
+ "-aPNG",
+ "-i",
+ "-z",
+ "-W www.ipfire.org",
+ "--alt-y-grid",
+ "-w 600",
+ "-h 125",
+ "-l 0",
+ "-r",
+ "-t ".$Lang::tr{'processes'}." ".$Lang::tr{'graph per'}." ".$Lang::tr{$period},
+ "--color=SHADEA".$color{"color19"},
+ "--color=SHADEB".$color{"color19"},
+ "--color=BACK".$color{"color21"}
+ );
+
+ foreach(@processesgraph){
+ chomp($_);my @name=split(/\-/,$_);chop($name[1]);
+ push(@command,"DEF:".$name[1]."user=".$_."ps_cputime.rrd:user:AVERAGE");
+ push(@command,"DEF:".$name[1]."system=".$_."ps_cputime.rrd:syst:AVERAGE");
+ push(@command,"CDEF:".$name[1]."=".$name[1]."user,".$name[1]."system,+");
+ }
+
+ push(@command,"COMMENT:".$Lang::tr{'caption'}."\\j");
+
+ foreach(@processesgraph){
+ chomp($_);my @name=split(/\-/,$_);chop($name[1]);
+ if ($count eq "0"){
+ push(@command,"AREA:".$name[1].random_hex_color(6)."A0:".$name[1]);
+ }else{
+ push(@command,"STACK:".$name[1].random_hex_color(6)."A0:".$name[1]);
+ }
+ $count++;
+ }
+
+ RRDs::graph (@command);
+ $ERROR = RRDs::error;
+ print "Error in RRD::graph for processes: ".$ERROR."\n" if $ERROR;
+}
+
+# Generate the Process Memory Graph for the current period of time for values given by collecd
+
+sub updateprocessesmemorygraph {
+ my $period = $_[0];
+ my $count="0";
+
+ my @command = (
+ "-",
+ "--start",
+ "-1".$period,
+ "-aPNG",
+ "-i",
+ "-z",
+ "-W www.ipfire.org",
+ "--alt-y-grid",
+ "-w 600",
+ "-h 125",
+ "-l 0",
+ "-r",
+ "-t ".$Lang::tr{'processes'}." ".$Lang::tr{'memory'}." ".$Lang::tr{'graph per'}." ".$Lang::tr{$period},
+ "-v ".$Lang::tr{'bytes'},
+ "--color=SHADEA".$color{"color19"},
+ "--color=SHADEB".$color{"color19"},
+ "--color=BACK".$color{"color21"}
+ );
+
+ foreach(@processesgraph){
+ chomp($_);my @name=split(/\-/,$_);chop($name[1]);
+ push(@command,"DEF:".$name[1]."=".$_."ps_rss.rrd:value:AVERAGE");
+ }
+
+ push(@command,"COMMENT:".$Lang::tr{'caption'}."\\j");
+
+ foreach(@processesgraph){
+ chomp($_);my @name=split(/\-/,$_);chop($name[1]);
+ if ($count eq "0"){
+ push(@command,"AREA:".$name[1].random_hex_color(6)."A0:".$name[1]);
+ }else{
+ push(@command,"STACK:".$name[1].random_hex_color(6)."A0:".$name[1]);
+ }
+ $count++;
+ }
+
+ RRDs::graph (@command);
+ $ERROR = RRDs::error;
+ print "Error in RRD::graph for processesmemory: ".$ERROR."\n" if $ERROR;
}
# Generate the Disk Graph for the current period of time for values given by collecd
sub updatediskgraph {
- my $period = $_[0];
- my $disk = $_[1];
-
- RRDs::graph ("$graphs/disk-$disk-$period.png",
- "--start", "-1$period", "-aPNG", "-i", "-W www.ipfire.org", "-v $Lang::tr{'bytes per second'}",
- "--alt-y-grid", "-w 600", "-h 125", "-r", "-z",
- "--color", "SHADEA".$color{"color19"},
- "--color", "SHADEB".$color{"color19"},
- "--color", "BACK".$color{"color21"},
- "-t $disk $Lang::tr{'disk access per'} $Lang::tr{$period}",
- "DEF:read=$rrdlog/collectd/localhost/disk-$disk/disk_octets.rrd:read:AVERAGE",
- "DEF:write=$rrdlog/collectd/localhost/disk-$disk/disk_octets.rrd:write:AVERAGE",
- "CDEF:writen=write,-1,*",
- "DEF:standby=$rrdlog/hddshutdown-$disk.rrd:standby:AVERAGE",
- "CDEF:st=standby,INF,*",
- "CDEF:st1=standby,-INF,*",
- "COMMENT:".sprintf("%-25s",$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",
- "AREA:st".$color{"color20"}."A0:",
- "AREA:st1".$color{"color20"}."A0:standby\\j",
- "AREA:read".$color{"color12"}."A0:".sprintf("%-25s",$Lang::tr{'read bytes'}),
- "GPRINT:read:MAX:%8.1lf %sBps",
- "GPRINT:read:AVERAGE:%8.1lf %sBps",
- "GPRINT:read:MIN:%8.1lf %sBps",
- "GPRINT:read:LAST:%8.1lf %sBps\\j",
- "AREA:writen".$color{"color13"}."A0:".sprintf("%-25s",$Lang::tr{'written bytes'}),
- "GPRINT:write:MAX:%8.1lf %sBps",
- "GPRINT:write:AVERAGE:%8.1lf %sBps",
- "GPRINT:write:MIN:%8.1lf %sBps",
- "GPRINT:write:LAST:%8.1lf %sBps\\j");
- $ERROR = RRDs::error;
- print "Error in RRD::graph for disk: $ERROR\n" if $ERROR;
+ my $disk = $_[0];
+ my $period = $_[1];
+ RRDs::graph(
+ "-",
+ "--start",
+ "-1".$period,
+ "-aPNG",
+ "-i",
+ "-z",
+ "-W www.ipfire.org",
+ "--alt-y-grid",
+ "-w 600",
+ "-h 125",
+ "-r",
+ "-t ".$disk." ".$Lang::tr{'disk access per'}." ".$Lang::tr{$period},
+ "-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",
+ "CDEF:writen=write,-1,*",
+ "DEF:standby=".$rrdlog."/hddshutdown-".$disk.".rrd:standby:AVERAGE",
+ "CDEF:st=standby,INF,*",
+ "CDEF:st1=standby,-INF,*",
+ "COMMENT:".sprintf("%-25s",$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",
+ "AREA:st".$color{"color20"}."A0:",
+ "AREA:st1".$color{"color20"}."A0:standby\\j",
+ "AREA:read".$color{"color12"}."A0:".sprintf("%-25s",$Lang::tr{'read bytes'}),
+ "GPRINT:read:MAX:%8.1lf %sBps",
+ "GPRINT:read:AVERAGE:%8.1lf %sBps",
+ "GPRINT:read:MIN:%8.1lf %sBps",
+ "GPRINT:read:LAST:%8.1lf %sBps\\j",
+ "AREA:writen".$color{"color13"}."A0:".sprintf("%-25s",$Lang::tr{'written bytes'}),
+ "GPRINT:write:MAX:%8.1lf %sBps",
+ "GPRINT:write:AVERAGE:%8.1lf %sBps",
+ "GPRINT:write:MIN:%8.1lf %sBps",
+ "GPRINT:write:LAST:%8.1lf %sBps\\j",
+ );
+ $ERROR = RRDs::error;
+ print "Error in RRD::graph for ".$disk.": ".$ERROR."\n" if $ERROR;
}
# Generate the Interface Graph for the current period of time for values given by collecd
sub updateifgraph {
- my $interface = $_[0];
- my $period = $_[1];
-
- RRDs::graph ("$graphs/$interface-$period.png",
- "--start", "-1$period", "-aPNG", "-i", "-W www.ipfire.org", "-v $Lang::tr{'bytes per second'}",
- "--alt-y-grid", "-w 600", "-h 125", "-z", "-r",
- "--color", "SHADEA".$color{"color19"},
- "--color", "SHADEB".$color{"color19"},
- "--color", "BACK".$color{"color21"},
- "-t $Lang::tr{'traffic on'} $interface $Lang::tr{'graph per'} $Lang::tr{$period}",
- "-v$Lang::tr{'bytes per second'}",
- "DEF:incoming=$rrdlog/collectd/localhost/interface/if_octets-$interface.rrd:rx:AVERAGE",
- "DEF:outgoing=$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'}),
- "COMMENT:".sprintf("%15s",$Lang::tr{'average'}),
- "COMMENT:".sprintf("%15s",$Lang::tr{'minimal'}),
- "COMMENT:".sprintf("%15s",$Lang::tr{'current'})."\\j",
- "AREA:incoming".$color{"color12"}."A0:".sprintf("%-20s",$Lang::tr{'incoming traffic in bytes per second'}),
- "GPRINT:incoming:MAX:%8.1lf %sBps",
- "GPRINT:incoming:AVERAGE:%8.1lf %sBps",
- "GPRINT:incoming:MIN:%8.1lf %sBps",
- "GPRINT:incoming:LAST:%8.1lf %sBps\\j",
- "AREA:outgoingn".$color{"color13"}."A0:".sprintf("%-20s",$Lang::tr{'outgoing traffic in bytes per second'}),
- "GPRINT:outgoing:MAX:%8.1lf %sBps",
- "GPRINT:outgoing:AVERAGE:%8.1lf %sBps",
- "GPRINT:outgoing:MIN:%8.1lf %sBps",
- "GPRINT:outgoing:LAST:%8.1lf %sBps\\j");
- $ERROR = RRDs::error;
- print "Error in RRD::graph for $interface: $ERROR\n" if $ERROR;
+ my $interface = $_[0];
+ my $period = $_[1];
+ RRDs::graph(
+ "-",
+ "--start",
+ "-1".$period,
+ "-aPNG",
+ "-i",
+ "-z",
+ "-W www.ipfire.org",
+ "--alt-y-grid",
+ "-w 600",
+ "-h 125",
+ "-r",
+ "-t ".$Lang::tr{'traffic on'}." ".$interface." ".$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"},
+ "DEF:incoming=".$rrdlog."/collectd/localhost/interface/if_octets-".$interface.".rrd:rx:AVERAGE",
+ "DEF:outgoing=".$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'}),
+ "COMMENT:".sprintf("%15s",$Lang::tr{'average'}),
+ "COMMENT:".sprintf("%15s",$Lang::tr{'minimal'}),
+ "COMMENT:".sprintf("%15s",$Lang::tr{'current'})."\\j",
+ "AREA:incoming".$color{"color12"}."A0:".sprintf("%-20s",$Lang::tr{'incoming traffic in bytes per second'}),
+ "GPRINT:incoming:MAX:%8.1lf %sBps",
+ "GPRINT:incoming:AVERAGE:%8.1lf %sBps",
+ "GPRINT:incoming:MIN:%8.1lf %sBps",
+ "GPRINT:incoming:LAST:%8.1lf %sBps\\j",
+ "AREA:outgoingn".$color{"color13"}."A0:".sprintf("%-20s",$Lang::tr{'outgoing traffic in bytes per second'}),
+ "GPRINT:outgoing:MAX:%8.1lf %sBps",
+ "GPRINT:outgoing:AVERAGE:%8.1lf %sBps",
+ "GPRINT:outgoing:MIN:%8.1lf %sBps",
+ "GPRINT:outgoing:LAST:%8.1lf %sBps\\j",
+ );
+ $ERROR = RRDs::error;
+ print "Error in RRD::graph for ".$interface.": ".$ERROR."\n" if $ERROR;
}
# Generate the Firewall Graph for the current period of time for values given by collecd
sub updatefwhitsgraph {
- my $period = $_[0];
- RRDs::graph ("$graphs/fwhits-$period.png",
- "--start", "-1$period", "-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"},
- "-t $Lang::tr{'firewall hits per'} $Lang::tr{$period}",
- "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'}),
- "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",
- "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'}),
- "GPRINT:portscan:MAX:%8.1lf %sBps",
- "GPRINT:portscan:MIN:%8.1lf %sBps",
- "GPRINT:portscan:AVERAGE:%8.1lf %sBps",
- "GPRINT:portscan:LAST:%8.1lf %sBps\\j");
- $ERROR = RRDs::error;
- print "Error in RRD::graph for Firewallhits: $ERROR\n" if $ERROR;
+ my $period = $_[0];
+ RRDs::graph(
+ "-",
+ "--start",
+ "-1".$period,
+ "-aPNG",
+ "-i",
+ "-z",
+ "-W www.ipfire.org",
+ "--alt-y-grid",
+ "-w 600",
+ "-h 125",
+ "-r",
+ "-t ".$Lang::tr{'firewall hits per'}." ".$Lang::tr{$period},
+ "-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'}),
+ "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",
+ "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'}),
+ "GPRINT:portscan:MAX:%8.1lf %sBps",
+ "GPRINT:portscan:MIN:%8.1lf %sBps",
+ "GPRINT:portscan:AVERAGE:%8.1lf %sBps",
+ "GPRINT:portscan:LAST:%8.1lf %sBps\\j",
+ );
+ $ERROR = RRDs::error;
+ print "Error in RRD::graph for firewallhits: ".$ERROR."\n" if $ERROR;
}
# Generate the Line Quality Graph for the current period of time for values given by collecd
sub updatepinggraph {
- my $period = $_[0];
- my $host = $_[1];
- RRDs::graph ("$graphs/$host-$period.png",
- "--start", "-1$period", "-aPNG", "-i", "-W www.ipfire.org",
- "--alt-y-grid", "-w 600", "-h 125", "-l 0", "-r", "-v ms",
- "-t $Lang::tr{'linkq'} $host $Lang::tr{'graph per'} $Lang::tr{$period}",
- "--color", "SHADEA".$color{"color19"},
- "--color", "SHADEB".$color{"color19"},
- "--color", "BACK".$color{"color21"},
- "DEF:roundtrip=$rrdlog/collectd/localhost/ping/ping-$host.rrd:ping:AVERAGE",
- "COMMENT:$Lang::".sprintf("%-20s",$Lang::tr{'caption'})."\\j",
- "CDEF:roundavg=roundtrip,PREV(roundtrip),+,2,/",
- "CDEF:r0=roundtrip,30,MIN",
- "CDEF:r1=roundtrip,70,MIN",
- "CDEF:r2=roundtrip,150,MIN",
- "CDEF:r3=roundtrip,300,MIN",
- "AREA:roundtrip".$color{"color25"}."A0:>300 ms",
- "AREA:r3".$color{"color18"}."A0:150-300 ms",
- "AREA:r2".$color{"color14"}."A0:70-150 ms",
- "AREA:r1".$color{"color17"}."A0:30-70 ms",
- "AREA:r0".$color{"color12"}."A0:<30 ms\\j",
- "COMMENT:$Lang::tr{'maximal'}",
- "COMMENT:$Lang::tr{'average'}",
- "COMMENT:$Lang::tr{'minimal'}","COMMENT:$Lang::tr{'current'}\\j",
- "LINE1:roundtrip#707070:",
- "GPRINT:roundtrip:MAX:%3.2lf ms",
- "GPRINT:roundtrip:AVERAGE:%3.2lf ms",
- "GPRINT:roundtrip:MIN:%3.2lf ms",
- "GPRINT:roundtrip:LAST:%3.2lf ms\\j");
- $ERROR = RRDs::error;
- print "Error in RRD::graph for Link Quality: $ERROR\n" if $ERROR;
+ my $period = $_[1];
+ my $host = $_[0];
+ RRDs::graph(
+ "-",
+ "--start",
+ "-1".$period,
+ "-aPNG",
+ "-i",
+ "-z",
+ "-W www.ipfire.org",
+ "--alt-y-grid",
+ "-w 600",
+ "-h 125",
+ "-l 0",
+ "-r",
+ "-t ".$Lang::tr{'linkq'}." ".$host." ".$Lang::tr{'graph per'}." ".$Lang::tr{$period},
+ "-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",
+ "COMMENT:".sprintf("%-20s",$Lang::tr{'caption'})."\\j",
+ "CDEF:roundavg=roundtrip,PREV(roundtrip),+,2,/",
+ "CDEF:r0=roundtrip,30,MIN",
+ "CDEF:r1=roundtrip,70,MIN",
+ "CDEF:r2=roundtrip,150,MIN",
+ "CDEF:r3=roundtrip,300,MIN",
+ "AREA:roundtrip".$color{"color25"}."A0:>300 ms",
+ "AREA:r3".$color{"color18"}."A0:150-300 ms",
+ "AREA:r2".$color{"color14"}."A0:70-150 ms",
+ "AREA:r1".$color{"color17"}."A0:30-70 ms",
+ "AREA:r0".$color{"color12"}."A0:<30 ms\\j",
+ "COMMENT:$Lang::tr{'maximal'}",
+ "COMMENT:$Lang::tr{'average'}",
+ "COMMENT:$Lang::tr{'minimal'}","COMMENT:$Lang::tr{'current'}\\j",
+ "LINE1:roundtrip#707070:",
+ "GPRINT:roundtrip:MAX:%3.2lf ms",
+ "GPRINT:roundtrip:AVERAGE:%3.2lf ms",
+ "GPRINT:roundtrip:MIN:%3.2lf ms",
+ "GPRINT:roundtrip:LAST:%3.2lf ms\\j",
+ );
+ $ERROR = RRDs::error;
+ print "Error in RRD::graph for link quality: ".$ERROR."\n" if $ERROR;
}
-# Generate the Hdd Graph for the current period of time for values given by collecd
-
-sub updatehddgraph {
-
- my $disk = $_[0];
- my $period = $_[1];
-
- RRDs::graph ("$graphs/hddtemp-$disk-$period.png",
- "--start", "-1$period", "-aPNG", "-i", "-z", "-W www.ipfire.org",
- "--alt-y-grid", "-w 600", "-h 125",
- "--color", "SHADEA".$color{"color19"},
- "--color", "SHADEB".$color{"color19"},
- "--color", "BACK".$color{"color21"},
- "-t $disk $Lang::tr{'harddisk temperature'} $Lang::tr{'graph per'} $Lang::tr{$period}",
- "DEF:temperature=$rrdlog/hddtemp-$disk.rrd:temperature:AVERAGE",
- "DEF:standby=$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",
- "COMMENT:$Lang::tr{'maximal'}",
- "COMMENT:$Lang::tr{'average'}",
- "COMMENT:$Lang::tr{'minimal'}",
- "COMMENT:$Lang::tr{'current'}\\j",
- "GPRINT:temperature:MAX:%3.0lf Grad C",
- "GPRINT:temperature:AVERAGE:%3.0lf Grad C",
- "GPRINT:temperature:MIN:%3.0lf Grad C",
- "GPRINT:temperature:LAST:%3.0lf Grad C\\j",
- );
- $ERROR = RRDs::error;
- print "Error in RRD::graph for hdd-$disk: $ERROR\n" if $ERROR;
+sub updatewirelessgraph {
+ my $period = $_[1];
+ my $interface = $_[0];
+ RRDs::graph(
+ "-",
+ "--start",
+ "-1".$period,
+ "-aPNG",
+ "-i",
+ "-z",
+ "-W www.ipfire.org",
+ "--alt-y-grid",
+ "-w 600",
+ "-h 125",
+ "-r",
+ "-t Wireless ".$interface." ".$Lang::tr{'graph per'}." ".$Lang::tr{$period},
+ "-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",
+ "COMMENT:".sprintf("%-20s",$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",
+ "LINE1:noise".$color{"color11"}."A0:".sprintf("%-20s","Signal Noise Ratio"),
+ "GPRINT:noise:MAX:%5.1lf %sdBm",
+ "GPRINT:noise:AVERAGE:%5.1lf %sdBm",
+ "GPRINT:noise:MIN:%5.1lf %sdBm",
+ "GPRINT:noise:LAST:%5.1lf %sdBm\\j",
+ "LINE1:power".$color{"color12"}."A0:".sprintf("%-20s","Signal Power Ratio"),
+ "GPRINT:power:MAX:%5.1lf %sdBm",
+ "GPRINT:power:AVERAGE:%5.1lf %sdBm",
+ "GPRINT:power:MIN:%5.1lf %sdBm",
+ "GPRINT:power:LAST:%5.1lf %sdBm\\j",
+ );
+ $ERROR = RRDs::error;
+ print "Error in RRD::graph for wireless: ".$ERROR."\n" if $ERROR;
}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# 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 overviewgraph {
+sub updateqosgraph {
my $period = $_[0];
my $periodstring;
@@ -591,7 +880,39 @@ sub overviewgraph {
print "$ERROR";
}
-# Generate the Temperature Graph for the current period of time for values given by collecd and lm_sensors
+# Generate the HDD Temp Graph for the current period of time for values given by collecd and lm_sensors
+
+sub updatehddgraph {
+
+ my $disk = $_[0];
+ my $period = $_[1];
+
+ RRDs::graph ("$graphs/hddtemp-$disk-$period.png",
+ "--start", "-1$period", "-aPNG", "-i", "-z", "-W www.ipfire.org",
+ "--alt-y-grid", "-w 600", "-h 125",
+ "--color", "SHADEA".$color{"color19"},
+ "--color", "SHADEB".$color{"color19"},
+ "--color", "BACK".$color{"color21"},
+ "-t $disk $Lang::tr{'harddisk temperature'} $Lang::tr{'graph per'} $Lang::tr{$period}",
+ "DEF:temperature=$rrdlog/hddtemp-$disk.rrd:temperature:AVERAGE",
+ "DEF:standby=$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",
+ "COMMENT:$Lang::tr{'maximal'}",
+ "COMMENT:$Lang::tr{'average'}",
+ "COMMENT:$Lang::tr{'minimal'}",
+ "COMMENT:$Lang::tr{'current'}\\j",
+ "GPRINT:temperature:MAX:%3.0lf Grad C",
+ "GPRINT:temperature:AVERAGE:%3.0lf Grad C",
+ "GPRINT:temperature:MIN:%3.0lf Grad C",
+ "GPRINT:temperature:LAST:%3.0lf Grad C\\j",
+ );
+ $ERROR = RRDs::error;
+ print "Error in RRD::graph for hdd-$disk: $ERROR\n" if $ERROR;
+}
+
+# Generate the Temp Graph for the current period of time for values given by collecd and lm_sensors
sub updatehwtempgraph {
@@ -667,7 +988,7 @@ sub updatehwvoltgraph {
print "$ERROR";
}
-# Generate the Load Graph for the current period of time for values given by collecd and lm_sensors
+# Generate the Fan Graph for the current period of time for values given by collecd and lm_sensors
sub updatehwfangraph {
@@ -705,102 +1026,15 @@ sub updatehwfangraph {
print "$ERROR";
}
-sub updateprocessesgraph {
- my $period = $_[0];
- my $count="0";
-
- my @command = ("$graphs/processes-$period.png",
- "--start", "-1$period", "-aPNG", "-i", "-W www.ipfire.org",
- "--alt-y-grid", "-w 600", "-h 125",
- "--color", "SHADEA".$color{"color19"},"--color",
- "SHADEB".$color{"color19"},"--color",
- "BACK".$color{"color21"},
- "-t $Lang::tr{'processes'} $Lang::tr{'graph per'} $Lang::tr{$period}");
-
- foreach(@processesgraph){
- chomp($_);my @name=split(/\-/,$_);chop($name[1]);
- push(@command,"DEF:".$name[1]."user=".$_."ps_cputime.rrd:user:AVERAGE");
- push(@command,"DEF:".$name[1]."system=".$_."ps_cputime.rrd:syst:AVERAGE");
- push(@command,"CDEF:".$name[1]."=".$name[1]."user,".$name[1]."system,+");}
-
- push(@command,"COMMENT:".$Lang::tr{'caption'}."\\j");
-
- foreach(@processesgraph){
- chomp($_);my @name=split(/\-/,$_);chop($name[1]);
- if ($count eq "0") {push(@command,"AREA:".$name[1].random_hex_color(6)."A0:".$name[1]);}
- else {push(@command,"STACK:".$name[1].random_hex_color(6)."A0:".$name[1]);}
- $count++;}
-
- RRDs::graph (@command);
- $ERROR = RRDs::error;
- print "$ERROR";
-
- my $count="0";
-
- my @command = ("$graphs/processesmem-$period.png",
- "--start", "-1$period", "-aPNG", "-i", "-W www.ipfire.org",
- "--alt-y-grid", "-w 600", "-h 125",
- "--color", "SHADEA".$color{"color19"},"--color",
- "SHADEB".$color{"color19"},"--color",
- "BACK".$color{"color21"},
- "-t $Lang::tr{'processes'} $Lang::tr{'memory'} $Lang::tr{'graph per'} $Lang::tr{$period}");
-
- foreach(@processesgraph){
- chomp($_);my @name=split(/\-/,$_);chop($name[1]);
- push(@command,"DEF:".$name[1]."=".$_."ps_rss.rrd:value:AVERAGE");}
- push(@command,"COMMENT:".$Lang::tr{'caption'}."\\j");
-
- foreach(@processesgraph){
- chomp($_);my @name=split(/\-/,$_);chop($name[1]);
- if ($count eq "0") {push(@command,"AREA:".$name[1].random_hex_color(6)."A0:".$name[1]);}
- else {push(@command,"STACK:".$name[1].random_hex_color(6)."A0:".$name[1]);}
- $count++;}
-
- RRDs::graph (@command);
- $ERROR = RRDs::error;
- print "$ERROR";
-}
-
-sub wireless {
- my $period = $_[0];
- my $interface = $_[1];
- RRDs::graph ("$graphs/wireless-$interface-$period.png",
- "--start", "-1$period", "-aPNG", "-i", "-W www.ipfire.org",
- "--alt-y-grid", "-w 600", "-h 125", "-v dBm", "-z",
- "-t Wireless $interface $Lang::tr{'graph per'} $Lang::tr{$period}",
- "--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",
- "COMMENT:".sprintf("%-20s",$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",
- "LINE1:noise".$color{"color11"}."A0:".sprintf("%-20s","Signal Noise Ratio"),
- "GPRINT:noise:MAX:%5.1lf %sdBm",
- "GPRINT:noise:AVERAGE:%5.1lf %sdBm",
- "GPRINT:noise:MIN:%5.1lf %sdBm",
- "GPRINT:noise:LAST:%5.1lf %sdBm\\j",
- "LINE1:power".$color{"color12"}."A0:".sprintf("%-20s","Signal Power Ratio"),
- "GPRINT:power:MAX:%5.1lf %sdBm",
- "GPRINT:power:AVERAGE:%5.1lf %sdBm",
- "GPRINT:power:MIN:%5.1lf %sdBm",
- "GPRINT:power:LAST:%5.1lf %sdBm\\j",
- );
- $ERROR = RRDs::error;
- print "Error in RRD::graph for Wireless: $ERROR\n" if $ERROR;
-}
# Generate a random color, used by Qos Graph to be independent from the amount of values
sub random_hex_color {
- my $size = shift;
- $size = 6 if $size !~ /^3|6$/;
- my @hex = ( 0 .. 9, 'a' .. 'f' );
- my @color;
- push @color, @hex[rand(@hex)] for 1 .. $size;
- return join('', '#', @color);
+ my $size = shift;
+ $size = 6 if $size !~ /^3|6$/;
+ my @hex = ( 0 .. 9, 'a' .. 'f' );
+ my @color;
+ push @color, @hex[rand(@hex)] for 1 .. $size;
+ return join('', '#', @color);
}
diff --git a/config/etc/fstab b/config/etc/fstab
index 48aa63e19..15475c2e1 100644
--- a/config/etc/fstab
+++ b/config/etc/fstab
@@ -8,4 +8,6 @@ DEVICE4 /var FSTYPE defaults 1 1
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
devpts /dev/pts devpts gid=4,mode=620 0 0
-shm /dev/shm tmpfs defaults 0 0
+shm /dev/shm tmpfs defaults,size=25% 0 0
+none /tmp tmpfs defaults,size=128M 0 0
+none /var/log/rrd tmps defaults,size=64M 0 0
diff --git a/config/menu/20-status.menu b/config/menu/20-status.menu
index f1f44be18..daf5f49a8 100644
--- a/config/menu/20-status.menu
+++ b/config/menu/20-status.menu
@@ -24,22 +24,19 @@
};
$substatus->{'50.networkred'} = {
'caption' => "$Lang::tr{'network red'}",
- 'uri' => '/cgi-bin/network.cgi',
- 'vars' => 'network=red',
+ 'uri' => '/cgi-bin/netexternal.cgi',
'title' => "$Lang::tr{'network red'}",
'enabled' => 1,
};
$substatus->{'51.networkinternal'} = {
'caption' => "$Lang::tr{'network internal'}",
- 'uri' => '/cgi-bin/network.cgi',
- 'vars' => 'network=internal',
+ 'uri' => '/cgi-bin/netinternal.cgi',
'title' => "$Lang::tr{'network internal'}",
'enabled' => 1,
};
$substatus->{'52.networkother'} = {
'caption' => "$Lang::tr{'network other'}",
- 'uri' => '/cgi-bin/network.cgi',
- 'vars' => 'network=other',
+ 'uri' => '/cgi-bin/netother.cgi',
'title' => "$Lang::tr{'network other'}",
'enabled' => 1,
};
diff --git a/config/rootfiles/common/apache2 b/config/rootfiles/common/apache2
index 61ba23fc6..6a612b104 100644
--- a/config/rootfiles/common/apache2
+++ b/config/rootfiles/common/apache2
@@ -1268,7 +1268,6 @@ srv/web/ipfire/cgi-bin/dhcp.cgi
#srv/web/ipfire/cgi-bin/dial/index.cgi
srv/web/ipfire/cgi-bin/dmzholes.cgi
srv/web/ipfire/cgi-bin/extrahd.cgi
-srv/web/ipfire/cgi-bin/fwhits.cgi
srv/web/ipfire/cgi-bin/graphs.cgi
srv/web/ipfire/cgi-bin/gui.cgi
srv/web/ipfire/cgi-bin/hardwaregraphs.cgi
@@ -1293,7 +1292,9 @@ srv/web/ipfire/cgi-bin/logs.cgi
srv/web/ipfire/cgi-bin/media.cgi
srv/web/ipfire/cgi-bin/memory.cgi
srv/web/ipfire/cgi-bin/modem.cgi
-srv/web/ipfire/cgi-bin/network.cgi
+srv/web/ipfire/cgi-bin/netexternal.cgi
+srv/web/ipfire/cgi-bin/netinternal.cgi
+srv/web/ipfire/cgi-bin/netother.cgi
srv/web/ipfire/cgi-bin/networks.cgi
srv/web/ipfire/cgi-bin/outgoingfw.cgi
srv/web/ipfire/cgi-bin/ovpnmain.cgi
@@ -1301,7 +1302,6 @@ srv/web/ipfire/cgi-bin/pakfire.cgi
srv/web/ipfire/cgi-bin/portfw.cgi
srv/web/ipfire/cgi-bin/pppsetup.cgi
srv/web/ipfire/cgi-bin/proxy.cgi
-srv/web/ipfire/cgi-bin/proxygraphs.cgi
srv/web/ipfire/cgi-bin/qos.cgi
srv/web/ipfire/cgi-bin/qosgraph.cgi
srv/web/ipfire/cgi-bin/remote.cgi
@@ -1310,7 +1310,6 @@ srv/web/ipfire/cgi-bin/speed.cgi
srv/web/ipfire/cgi-bin/system.cgi
srv/web/ipfire/cgi-bin/time.cgi
srv/web/ipfire/cgi-bin/traffic.cgi
-srv/web/ipfire/cgi-bin/traffics.cgi
srv/web/ipfire/cgi-bin/updatexlrator.cgi
srv/web/ipfire/cgi-bin/upnp.cgi
srv/web/ipfire/cgi-bin/urlfilter.cgi
diff --git a/config/rootfiles/updater/filelists/files b/config/rootfiles/updater/filelists/files
index 4ac9b0753..5d2a4e6ca 100644
--- a/config/rootfiles/updater/filelists/files
+++ b/config/rootfiles/updater/filelists/files
@@ -3,6 +3,7 @@ etc/init.d/mISDN
etc/modprobe.d/blacklist
usr/bin/bc
usr/bin/dc
+etc/fstab
etc/ppp/dialer
etc/rc.d/init.d/checkfstab
etc/rc.d/rcsysinit.d/S19checkfstab
@@ -26,7 +27,10 @@ srv/web/ipfire/cgi-bin/hardwaregraphs.cgi
srv/web/ipfire/cgi-bin/connections.cgi
srv/web/ipfire/cgi-bin/graphs.cgi
srv/web/ipfire/cgi-bin/pppsetup.cgi
-srv/web/ipfire/cgi-bin/network.cgi
+srv/web/ipfire/cgi-bin/netexternal.cgi
+srv/web/ipfire/cgi-bin/netinernal.cgi
+srv/web/ipfire/cgi-bin/netother.cgi
+
srv/web/ipfire/cgi-bin/system.cgi
srv/web/ipfire/cgi-bin/ids.cgi
var/ipfire/sensors/
diff --git a/html/cgi-bin/fwhits.cgi b/html/cgi-bin/fwhits.cgi
deleted file mode 100644
index 9c5729019..000000000
--- a/html/cgi-bin/fwhits.cgi
+++ /dev/null
@@ -1,105 +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 . #
-# #
-###############################################################################
-
-
-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 @cgigraphs=();
-my @graphs=();
-
-&Graphs::updatefwhitsgraph ("day");
-&Graphs::updatefwhitsgraph ("week");
-&Graphs::updatefwhitsgraph ("month");
-&Graphs::updatefwhitsgraph ("year");
-
-$ENV{'QUERY_STRING'} =~ s/&//g;
-@cgigraphs = split(/graph=/,$ENV{'QUERY_STRING'});
-$cgigraphs[1] = '' unless defined $cgigraphs[1];
-
-&Header::showhttpheaders();
-
-my $graphdir = "/home/httpd/html/graphs";
-my @LOCALCHECK=();
-my $errormessage="";
-
-&Header::openpage($Lang::tr{'firewall graphs'}, 1, '');
-&Header::openbigbox('100%', 'left', '', $errormessage);
-
- &Header::openbox('100%', 'center', $Lang::tr{"daily firewallhits"});
-if (-e "$Header::graphdir/firewallhits-day-area.png") {
- my $ftime = localtime((stat("$Header::graphdir/firewallhits-day-area.png"))[9]);
- print "$Lang::tr{'the statistics were last updated at'}: $ftime \n";
- print " ";
- print " \n";
-} else {
- print $Lang::tr{'no information available'};
-}
-print " \n";
- &Header::closebox();
-
- &Header::openbox('100%', 'center', $Lang::tr{"weekly firewallhits"});
-if (-e "$Header::graphdir/firewallhits-week-area.png") {
- my $ftime = localtime((stat("$Header::graphdir/firewallhits-week-area.png"))[9]);
- print "$Lang::tr{'the statistics were last updated at'}: $ftime \n";
- print " ";
- print " \n";
-} else {
- print $Lang::tr{'no information available'};
-}
-print " \n";
- &Header::closebox();
-
- &Header::openbox('100%', 'center', $Lang::tr{"monthly firewallhits"});
-if (-e "$Header::graphdir/firewallhits-month-area.png") {
- my $ftime = localtime((stat("$Header::graphdir/firewallhits-month-area.png"))[9]);
- print "$Lang::tr{'the statistics were last updated at'}: $ftime \n";
- print " ";
- print " \n";
-} else {
- print $Lang::tr{'no information available'};
-}
-print " \n";
- &Header::closebox();
-
- &Header::openbox('100%', 'center', $Lang::tr{"yearly firewallhits"});
-if (-e "$Header::graphdir/firewallhits-year-area.png") {
- my $ftime = localtime((stat("$Header::graphdir/firewallhits-year-area.png"))[9]);
- print "$Lang::tr{'the statistics were last updated at'}: $ftime \n";
- print " ";
- print " \n";
-} else {
- print $Lang::tr{'no information available'};
-}
-print " \n";
- &Header::closebox();
-
-&Header::closebigbox();
-&Header::closepage();
diff --git a/html/cgi-bin/media.cgi b/html/cgi-bin/media.cgi
index 1eacb3428..490ffcad9 100644
--- a/html/cgi-bin/media.cgi
+++ b/html/cgi-bin/media.cgi
@@ -2,7 +2,7 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
-# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
+# Copyright (C) 2008 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 #
@@ -30,38 +30,50 @@ require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
require "${General::swroot}/graphs.pl";
+my %color = ();
+my %mainsettings = ();
+&General::readhash("${General::swroot}/main/settings", \%mainsettings);
+&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
+
#workaround to suppress a warning when a variable is used only once
my @dummy = ( ${Header::colourred} );
undef (@dummy);
my %cgiparams=();
-&Header::showhttpheaders();
-
-&Header::getcgihash(\%cgiparams);
-
-&Header::openpage($Lang::tr{'media information'}, 1, '');
-
-&Header::openbigbox('100%', 'left');
+my @querry = split(/\?/,$ENV{'QUERY_STRING'});
+$querry[0] = '' unless defined $querry[0];
+$querry[1] = 'hour' unless defined $querry[1];
my @devices = `kudzu -qps -c HD | grep device: | cut -d" " -f2 | sort | uniq`;
-foreach (@devices) {
- my $device = $_;
- chomp($device);
- my @array = split(/\//,$device);
- &Graphs::updatediskgraph ("day",$array[$#array]);
- diskbox($array[$#array]);
-}
+if ( $querry[0] =~ "sd?" || $querry[0] =~ "hd?" ){
+ print "Content-type: image/png\n\n";
+ binmode(STDOUT);
+
+ &Graphs::updatediskgraph($querry[0],$querry[1]);
+}else{
+ &Header::showhttpheaders();
+ &Header::openpage($Lang::tr{'media information'}, 1, '');
+ &Header::openbigbox('100%', 'left');
-&Header::openbox('100%', 'center', $Lang::tr{'disk usage'});
-print "\n";
-open(DF,'/bin/df -B M -x rootfs|');
-while()
-{
- if ($_ =~ m/^Filesystem/ )
- {
- print <\n";
+ open(DF,'/bin/df -B M -x rootfs|');
+ while(){
+ if ($_ =~ m/^Filesystem/ ){
+ print <
$Lang::tr{'device'}
$Lang::tr{'mounted on'}
@@ -72,11 +84,9 @@ while()
END
;
- }
- else
- {
- my ($device,$size,$used,$free,$percent,$mount) = split;
- print <
$device
$mount
@@ -86,24 +96,22 @@ END
END
;
- &percentbar($percent);
- print <
$percent
END
;
- }
-}
-close DF;
-print " \n Inodes \n";
+ }
+ }
+ close DF;
+ print " \n Inodes \n";
-open(DF,'/bin/df -i -x rootfs|');
-while()
-{
- if ($_ =~ m/^Filesystem/ )
- {
- print <){
+ if ($_ =~ m/^Filesystem/ ){
+ print <
$Lang::tr{'device'}
$Lang::tr{'mounted on'}
@@ -114,11 +122,9 @@ while()
END
;
- }
- else
- {
- my ($device,$size,$used,$free,$percent,$mount) = split;
- print <
$device
$mount
@@ -128,33 +134,35 @@ END
END
;
- &percentbar($percent);
- print <
$percent
END
;
- }
+ }
+ }
+ close DF;
+ my @iostat1 = qx(/usr/bin/iostat -dm -p | grep -v "Linux" | awk '{print \$1}');
+ my @iostat2 = qx(/usr/bin/iostat -dm -p | grep -v "Linux" | awk '{print \$5}');
+ my @iostat3 = qx(/usr/bin/iostat -dm -p | grep -v "Linux" | awk '{print \$6}');
+ print " \n transfers ";
+ my $i=0;
+
+ for(my $i = 1; $i <= $#iostat1; $i++){
+ if ( $i eq '1' ){
+ print "Device MB read MB writen ";
+ }else{
+ print "$iostat1[$i] $iostat2[$i] $iostat3[$i] ";
+ }
+ }
+ print "
\n";
+ &Header::closebox();
+
+ &Header::closebigbox();
+ &Header::closepage();
}
-close DF;
-my @iostat1 = qx(/usr/bin/iostat -dm -p | grep -v "Linux" | awk '{print \$1}');
-my @iostat2 = qx(/usr/bin/iostat -dm -p | grep -v "Linux" | awk '{print \$5}');
-my @iostat3 = qx(/usr/bin/iostat -dm -p | grep -v "Linux" | awk '{print \$6}');
-print " \n transfers ";
-my $i=0;
-
-for(my $i = 1; $i <= $#iostat1; $i++)
-{
-if ( $i eq '1' ){print "Device MB read MB writen ";}
-else {print "$iostat1[$i] $iostat2[$i] $iostat3[$i] ";}
-}
-print "\n";
-&Header::closebox();
-
-&Header::closebigbox();
-
-&Header::closepage();
sub percentbar
{
@@ -184,44 +192,33 @@ END
}
sub diskbox {
- my $disk = $_[0];
- chomp $disk;
- my @status;
- if (-e "$Header::graphdir/disk-$disk-day.png") {
- &Header::openbox('100%', 'center', "Disk $disk $Lang::tr{'graph'}");
- my $ftime = localtime((stat("$Header::graphdir/disk-$disk-day.png"))[9]);
- print "$Lang::tr{'the statistics were last updated at'}: $ftime \n";
- print "";
- print " ";
- print " ";
- print " \n";
+ my $disk = $_[0];
+ chomp $disk;
+ my @status;
+ if (-e "/tmp/hddstatus"){
+ open(DATEI, ";
+ close(DATEI);
- if (-e "/tmp/hddstatus") {
- open(DATEI, ";
- close(DATEI);
+ foreach (@diskstate){
+ if ( $_ =~/$disk/ ){@status = split(/-/,$_);}
+ }
- foreach (@diskstate){
- if ( $_ =~/$disk/ ){@status = split(/-/,$_);}
- }
+ if ( $status[1]=~/standby/){
+ my $ftime = localtime((stat("/tmp/hddshutdown-$disk"))[9]);
+ print"Disk $disk status:".$status[1]." (since $ftime)";
+ }else{
+ print"Disk $disk status:".$status[1]." ";
+ }
+ }
- if ( $status[1]=~/standby/){
- my $ftime = localtime((stat("/tmp/hddshutdown-$disk"))[9]);
- print"Disk $disk status:".$status[1]." (since $ftime)";
- }
- else{
- print"Disk $disk status:".$status[1]." ";
- }
- }
- my $smart = `/usr/local/bin/smartctrl $disk`;
- $smart = &Header::cleanhtml($smart);
- print <
-
+ my $smart = `/usr/local/bin/smartctrl $disk`;
+ $smart = &Header::cleanhtml($smart);
+ print <
+
END
;
- &Header::closebox();
- }
}
diff --git a/html/cgi-bin/memory.cgi b/html/cgi-bin/memory.cgi
index ed73fb3f8..35ce7a0f1 100644
--- a/html/cgi-bin/memory.cgi
+++ b/html/cgi-bin/memory.cgi
@@ -2,7 +2,7 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
-# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
+# Copyright (C) 2008 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 #
@@ -30,57 +30,51 @@ require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
require "${General::swroot}/graphs.pl";
-my %cgiparams=();
+my %color = ();
+my %mainsettings = ();
+&General::readhash("${General::swroot}/main/settings", \%mainsettings);
+&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
-&Graphs::updatememgraph ("day");
+my @querry = split(/\?/,$ENV{'QUERY_STRING'});
+$querry[0] = '' unless defined $querry[0];
+$querry[1] = 'hour' unless defined $querry[1];
-&Header::showhttpheaders();
-&Header::getcgihash(\%cgiparams);
-&Header::openpage($Lang::tr{'memory information'}, 1, '');
-&Header::openbigbox('100%', 'left');
+if ( $querry[0] =~ "memory"){
+ print "Content-type: image/png\n\n";
+ binmode(STDOUT);
+ &Graphs::updatememorygraph($querry[1]);
+}elsif ( $querry[0] =~ "swap"){
+ print "Content-type: image/png\n\n";
+ binmode(STDOUT);
+ &Graphs::updateswapgraph($querry[1]);
+}else{
+ &Header::showhttpheaders();
+ &Header::openpage($Lang::tr{'memory information'}, 1, '');
+ &Header::openbigbox('100%', 'left');
-&Header::openbox('100%', 'center', "Memory $Lang::tr{'graph'}");
-if (-e "$Header::graphdir/memory-day.png") {
- my $ftime = localtime((stat("$Header::graphdir/memory-day.png"))[9]);
- print "$Lang::tr{'the statistics were last updated at'}: $ftime \n";
- print "";
- print " ";
- print " ";
-} else {
- print $Lang::tr{'no information available'};
-}
-print " \n";
-&Header::closebox();
+ &Header::openbox('100%', 'center', "Memory $Lang::tr{'graph'}");
+ &Graphs::makegraphbox("memory.cgi","memory","day");
+ &Header::closebox();
-&Header::openbox('100%', 'center', "Swap $Lang::tr{'graph'}");
-if (-e "$Header::graphdir/swap-day.png") {
- my $ftime = localtime((stat("$Header::graphdir/swap-day.png"))[9]);
- print "$Lang::tr{'the statistics were last updated at'}: $ftime \n";
- print "";
- print " ";
- print " ";
-} else {
- print $Lang::tr{'no information available'};
-}
-print " \n";
-&Header::closebox();
+ &Header::openbox('100%', 'center', "Swap $Lang::tr{'graph'}");
+ &Graphs::makegraphbox("memory.cgi","swap","day");
+ &Header::closebox();
+
+ &Header::openbox('100%', 'center', $Lang::tr{'memory'});
+ print "";
+ my $ram=0;
+ my $size=0;
+ my $used=0;
+ my $free=0;
+ my $percent=0;
+ my $shared=0;
+ my $buffers=0;
+ my $cached=0;
-&Header::openbox('100%', 'center', $Lang::tr{'memory'});
-print "";
-my $ram=0;
-my $size=0;
-my $used=0;
-my $free=0;
-my $percent=0;
-my $shared=0;
-my $buffers=0;
-my $cached=0;
-open(FREE,'/usr/bin/free |');
-while()
-{
- if ($_ =~ m/^\s+total\s+used\s+free\s+shared\s+buffers\s+cached$/ )
- {
- print <){
+ if ($_ =~ m/^\s+total\s+used\s+free\s+shared\s+buffers\s+cached$/ ){
+ print <
$Lang::tr{'size'}
@@ -90,52 +84,51 @@ while()
END
;
- } else {
- if ($_ =~ m/^Mem:\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)$/) {
- ($ram,$size,$used,$free,$shared,$buffers,$cached) = ($1,$1,$2,$3,$4,$5,$6);
- ($percent = ($used/$size)*100) =~ s/^(\d+)(\.\d+)?$/$1%/;
- print <
$Lang::tr{'ram'}
$size KB
END
;
- } elsif ($_ =~ m/^Swap:\s+(\d+)\s+(\d+)\s+(\d+)$/) {
- ($size,$used,$free) = ($1,$2,$3);
- if ($size != 0)
- {
- ($percent = ($used/$size)*100) =~ s/^(\d+)(\.\d+)?$/$1%/;
- } else {
- ($percent = '');
- }
- print <
$Lang::tr{'swap'}
$size KB
END
;
- } elsif ($ram and $_ =~ m/^-\/\+ buffers\/cache:\s+(\d+)\s+(\d+)$/ ) {
- ($used,$free) = ($1,$2);
- ($percent = ($used/$ram)*100) =~ s/^(\d+)(\.\d+)?$/$1%/;
- print "$Lang::tr{'excluding buffers and cache'} "
- }
- print <$Lang::tr{'excluding buffers and cache'} ";
+ }
+ print <$used KB
$free KB
END
;
- &percentbar($percent);
- print <
$percent
END
;
- }
-}
-close FREE;
-print <
$Lang::tr{'shared'} $shared KB
$Lang::tr{'buffers'} $buffers KB
@@ -143,35 +136,33 @@ print <
END
;
-&Header::closebox();
+ &Header::closebox();
-&Header::closebigbox();
+ &Header::closebigbox();
+ &Header::closepage();
+}
-&Header::closepage();
+sub percentbar{
+ my $percent = $_[0];
+ my $fg = '#a0a0a0';
+ my $bg = '#e2e2e2';
-sub percentbar
-{
- my $percent = $_[0];
- my $fg = '#a0a0a0';
- my $bg = '#e2e2e2';
-
- if ($percent =~ m/^(\d+)%$/ )
- {
- print <
END
;
- if ($percent eq "100%") {
- print ""
- } elsif ($percent eq "0%") {
- print " "
- } else {
- print " "
- }
- print <";
+ }elsif($percent eq "0%"){
+ print "";
+ }else{
+ print " ";
+ }
+ print <
END
;
- }
+ }
}
diff --git a/html/cgi-bin/netexternal.cgi b/html/cgi-bin/netexternal.cgi
new file mode 100755
index 000000000..fba57605b
--- /dev/null
+++ b/html/cgi-bin/netexternal.cgi
@@ -0,0 +1,169 @@
+#!/usr/bin/perl
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2008 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 . #
+# #
+###############################################################################
+
+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 %color = ();
+my %mainsettings = ();
+my %netsettings=();
+&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
+&General::readhash("${General::swroot}/main/settings", \%mainsettings);
+&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
+
+my @graphs=();
+my %dhcpinfo=();
+
+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::updateifgraph($querry[0],$querry[1]);
+}else{
+
+ &Header::showhttpheaders();
+ &Header::openpage($Lang::tr{'network traffic graphs external'}, 1, '');
+ &Header::openbigbox('100%', 'left');
+
+ if ($netsettings{'RED_TYPE'} ne 'PPPOE'){
+ if ($netsettings{'RED_DEV'} ne $netsettings{'GREEN_DEV'}){
+ push (@graphs, ($netsettings{'RED_DEV'}));
+ }
+ }else{
+ push (@graphs, "ppp0");
+ }
+
+ if (-e "/var/log/rrd/collectd/localhost/interface/if_octets-ipsec0.rrd"){
+ push (@graphs, ("ipsec0"));
+ }
+
+ if (-e "/var/log/rrd/collectd/localhost/interface/if_octets-tun0.rrd"){
+ push (@graphs, ("tun0"));
+ }
+
+ foreach (@graphs) {
+ &Header::openbox('100%', 'center', "$_ $Lang::tr{'graph'}");
+ &Graphs::makegraphbox("netexternal.cgi",$_,"day");
+ &Header::closebox();
+ }
+
+ if ( $netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ && $netsettings{'RED_TYPE'} eq "DHCP"){
+
+ &Header::openbox('100%', 'left', "RED $Lang::tr{'dhcp configuration'}");
+ if (-s "${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info") {
+
+ &General::readhash("${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info", \%dhcpinfo);
+
+ my $DNS1=`echo $dhcpinfo{'DNS'} | cut -f 1 -d ,`;
+ my $DNS2=`echo $dhcpinfo{'DNS'} | cut -f 2 -d ,`;
+
+ my $lsetme=0;
+ my $leasetime="";
+ if ($dhcpinfo{'LEASETIME'} ne "") {
+ $lsetme=$dhcpinfo{'LEASETIME'};
+ $lsetme=($lsetme/60);
+
+ if ($lsetme > 59) {
+ $lsetme=($lsetme/60); $leasetime=$lsetme." Hour";
+ }else{
+ $leasetime=$lsetme." Minute";
+ }
+
+ if ($lsetme > 1) {
+ $leasetime=$leasetime."s";
+ }
+ }
+
+ my $rentme=0;
+ my $rnwltime="";
+
+ if ($dhcpinfo{'RENEWALTIME'} ne "") {
+ $rentme=$dhcpinfo{'RENEWALTIME'};
+ $rentme=($rentme/60);
+
+ if ($rentme > 59){
+ $rentme=($rentme/60); $rnwltime=$rentme." Hour";
+ }else{
+ $rnwltime=$rentme." Minute";
+ }
+
+ if ($rentme > 1){
+ $rnwltime=$rnwltime."s";
+ }
+ }
+
+ my $maxtme=0;
+ my $maxtime="";
+
+ if ($dhcpinfo{'REBINDTIME'} ne "") {
+ $maxtme=$dhcpinfo{'REBINDTIME'};
+ $maxtme=($maxtme/60);
+
+ if ($maxtme > 59){
+ $maxtme=($maxtme/60); $maxtime=$maxtme." Hour";
+ } else {
+ $maxtime=$maxtme." Minute";
+ }
+
+ if ($maxtme > 1) {
+ $maxtime=$maxtime."s";
+ }
+ }
+
+ print "";
+
+ if ($dhcpinfo{'HOSTNAME'}) {
+ print "$Lang::tr{'hostname'} $dhcpinfo{'HOSTNAME'}.$dhcpinfo{'DOMAIN'} \n";
+ } else {
+ print "$Lang::tr{'domain'} $dhcpinfo{'DOMAIN'} \n";
+ }
+
+ print <$Lang::tr{'gateway'} $dhcpinfo{'GATEWAY'}
+$Lang::tr{'primary dns'} $DNS1
+$Lang::tr{'secondary dns'} $DNS2
+$Lang::tr{'dhcp server'} $dhcpinfo{'DHCPSIADDR'}
+$Lang::tr{'def lease time'} $leasetime
+$Lang::tr{'default renewal time'} $rnwltime
+$Lang::tr{'max renewal time'} $maxtime
+
+END
+;
+ }else{
+ print "$Lang::tr{'no dhcp lease'}";
+ }
+ &Header::closebox();
+ }
+
+ &Header::closebigbox();
+ &Header::closepage();
+}
diff --git a/html/cgi-bin/netinternal.cgi b/html/cgi-bin/netinternal.cgi
new file mode 100755
index 000000000..bf6840f4e
--- /dev/null
+++ b/html/cgi-bin/netinternal.cgi
@@ -0,0 +1,87 @@
+#!/usr/bin/perl
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2008 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 . #
+# #
+###############################################################################
+
+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 %color = ();
+my %mainsettings = ();
+my %netsettings=();
+&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
+&General::readhash("${General::swroot}/main/settings", \%mainsettings);
+&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
+
+my @graphs=();
+my @wireless=();
+
+my @querry = split(/\?/,$ENV{'QUERY_STRING'});
+$querry[0] = '' unless defined $querry[0];
+$querry[1] = 'hour' unless defined $querry[1];
+$querry[2] = '' unless defined $querry[2];
+
+if ( $querry[0] =~ /wireless/ ){
+ print "Content-type: image/png\n\n";
+ binmode(STDOUT);
+ $querry[0] =~ s/wireless//g;
+ &Graphs::updatewirelessgraph($querry[0],$querry[1]);
+}elsif ( $querry[0] ne "" ){
+ print "Content-type: image/png\n\n";
+ binmode(STDOUT);
+ &Graphs::updateifgraph($querry[0],$querry[1]);
+}else{
+
+ &Header::showhttpheaders();
+ &Header::openpage($Lang::tr{'network traffic graphs internal'}, 1, '');
+ &Header::openbigbox('100%', 'left');
+
+ push (@graphs, ($netsettings{'GREEN_DEV'}));
+ if ($netsettings{'BLUE_DEV'}) {push (@graphs, ($netsettings{'BLUE_DEV'})); }
+ if ($netsettings{'ORANGE_DEV'}) {push (@graphs, ($netsettings{'ORANGE_DEV'})); }
+
+ my @wirelessgraphs = `ls -dA /var/log/rrd/collectd/localhost/wireless*`;
+ foreach (@wirelessgraphs){
+ $_ =~ /(.*)\/wireless-(.*)/;
+ push(@wireless,$2);
+ }
+
+ foreach (@graphs) {
+ &Header::openbox('100%', 'center', "$_ $Lang::tr{'graph'}");
+ &Graphs::makegraphbox("netinternal.cgi",$_,"day");
+ &Header::closebox();
+ }
+
+ foreach (@wireless) {
+ &Header::openbox('100%', 'center', "Wireless $_ $Lang::tr{'graph'}");
+ &Graphs::makegraphbox("netinternal.cgi","wireless".$_,"day");
+ &Header::closebox();
+ }
+
+ &Header::closebigbox();
+ &Header::closepage();
+}
diff --git a/html/cgi-bin/proxygraphs.cgi b/html/cgi-bin/netother.cgi
old mode 100644
new mode 100755
similarity index 55%
rename from html/cgi-bin/proxygraphs.cgi
rename to html/cgi-bin/netother.cgi
index c0f5428a9..52da9c8b7
--- a/html/cgi-bin/proxygraphs.cgi
+++ b/html/cgi-bin/netother.cgi
@@ -2,7 +2,7 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
-# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
+# Copyright (C) 2008 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 #
@@ -28,50 +28,49 @@ use strict;
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 @graphs=();
+my %color = ();
+my %mainsettings = ();
+&General::readhash("${General::swroot}/main/settings", \%mainsettings);
+&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
-&Header::showhttpheaders();
+my @pings=();
-my $dir = "/srv/web/ipfire/html/sgraph";
-$cgiparams{'ACTION'} = '';
-&Header::getcgihash(\%cgiparams);
-my $sgraphdir = "/srv/web/ipfire/html/sgraph";
+my @querry = split(/\?/,$ENV{'QUERY_STRING'});
+$querry[0] = '' unless defined $querry[0];
+$querry[1] = 'hour' unless defined $querry[1];
-&Header::openpage($Lang::tr{'proxy access graphs'}, 1, '');
+if ( $querry[0] =~ "fwhits"){
+ print "Content-type: image/png\n\n";
+ binmode(STDOUT);
+ &Graphs::updatefwhitsgraph($querry[0],$querry[1]);
+}elsif ( $querry[0] ne ""){
+ print "Content-type: image/png\n\n";
+ binmode(STDOUT);
+ &Graphs::updatepinggraph($querry[0],$querry[1]);
+}else{
-&Header::openbigbox('100%', 'left');
-
-&Header::openbox('100%', 'left', $Lang::tr{'proxy access graphs'} . ":" );
-
-if (open(IPACHTML, "$sgraphdir/index.html"))
-{
- my $skip = 1;
- while ()
- {
- $skip = 1 if /^ $/;
- if ($skip)
- {
- $skip = 0 if //;
- next;
- }
- s/ ]+)>/ /;
- s/ / /g;
- s/ / /g;
- s/<([^>]*)>/\L<$1>\E/g;
- s/(size|align|border|color)=([^'"> ]+)/$1='$2'/g;
- print;
+ &Header::showhttpheaders();
+ &Header::openpage($Lang::tr{'network traffic graphs others'}, 1, '');
+ &Header::openbigbox('100%', 'left');
+
+ my @pinggraphs = `ls -dA /var/log/rrd/collectd/localhost/ping/*`;
+ foreach (@pinggraphs){
+ $_ =~ /(.*)\/ping\/ping-(.*)\.rrd/;
+ push(@pings,$2);
}
- close(IPACHTML);
-}
-else {
- print $Lang::tr{'no information available'}; }
-&Header::closebox();
+ foreach (@pings) {
+ &Header::openbox('100%', 'center', "$_ $Lang::tr{'graph'}");
+ &Graphs::makegraphbox("netother.cgi",$_,"day");
+ &Header::closebox();
+ }
-&Header::closebigbox();
+ &Header::openbox('100%', 'center', "Firewall Hits $Lang::tr{'graph'}");
+ &Graphs::makegraphbox("netother.cgi","fwhits","day");
+ &Header::closebox();
-&Header::closepage();
+ &Header::closebigbox();
+ &Header::closepage();
+}
diff --git a/html/cgi-bin/network.cgi b/html/cgi-bin/network.cgi
deleted file mode 100644
index 1434bd1bb..000000000
--- a/html/cgi-bin/network.cgi
+++ /dev/null
@@ -1,251 +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 . #
-# #
-###############################################################################
-
-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 @cgiparams=();
-my @graphs=();
-my @pings=();
-my @wireless=();
-my $iface='';
-my %dhcpsettings=();
-my %dhcpinfo=();
-my $output='';
-
-&Header::showhttpheaders();
-
-&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
-
-$ENV{'QUERY_STRING'} =~ s/&//g;
-@cgiparams = split(/network=/,$ENV{'QUERY_STRING'});
-$cgiparams[1] = '' unless defined $cgiparams[1];
-
-if ($cgiparams[1] =~ /red/) {
- &Header::openpage($Lang::tr{'network traffic graphs external'}, 1, '');
- if ($netsettings{'RED_TYPE'} ne 'PPPOE') {
- if ($netsettings{'RED_DEV'} ne $netsettings{'GREEN_DEV'}) {
- push (@graphs, ($netsettings{'RED_DEV'}));
- }
- } else {
- push (@graphs, "ppp0");
- }
- if (-e "/var/log/rrd/collectd/localhost/interface/if_octets-ipsec0.rrd") {push (@graphs, ("ipsec0"));}
- if (-e "/var/log/rrd/collectd/localhost/interface/if_octets-tun0.rrd") {push (@graphs, ("tun0"));}
-}elsif ($cgiparams[1] =~ /other/) {
- &Header::openpage($Lang::tr{'network traffic graphs others'}, 1, '');
- my @pinggraphs = `ls -dA /var/log/rrd/collectd/localhost/ping/*`;
- foreach (@pinggraphs){
- $_ =~ /(.*)\/ping\/ping-(.*)\.rrd/;
- push(@pings,$2);
- }
- push (@graphs, ("fwhits"));
-
-}else {
- &Header::openpage($Lang::tr{'network traffic graphs internal'}, 1, '');
- push (@graphs, ($netsettings{'GREEN_DEV'}));
- if ($netsettings{'BLUE_DEV'}) {
- push (@graphs, ($netsettings{'BLUE_DEV'})); }
- if ($netsettings{'ORANGE_DEV'}) {
- push (@graphs, ($netsettings{'ORANGE_DEV'})); }
- my @wirelessgraphs = `ls -dA /var/log/rrd/collectd/localhost/wireless*`;
- foreach (@wirelessgraphs){
- $_ =~ /(.*)\/wireless-(.*)/;
- push(@wireless,$2);
- }
-}
-
-&Header::openbigbox('100%', 'left');
-
-foreach my $graphname (@pings) {
-
- if ($graphname eq "gateway" )
- { &Graphs::updatepinggraph("day","gateway"); }
- else
- { &Graphs::updatepinggraph("day","$graphname"); }
-
- &Header::openbox('100%', 'center', "$graphname $Lang::tr{'graph'}");
- if (-e "$Header::graphdir/${graphname}-day.png") {
- my $ftime = localtime((stat("$Header::graphdir/${graphname}-day.png"))[9]);
- print "$Lang::tr{'the statistics were last updated at'}: $ftime \n";
- print "";
- print " ";
- print " ";
- } else {
- print $Lang::tr{'no information available'};
- }
- print " \n";
- &Header::closebox();
-}
-
-foreach my $graphname (@graphs) {
-
- if ($graphname eq "fwhits" )
- { &Graphs::updatefwhitsgraph("day"); }
- else
- { &Graphs::updateifgraph($graphname, "day"); }
-
- &Header::openbox('100%', 'center', "$graphname $Lang::tr{'graph'}");
- if (-e "$Header::graphdir/${graphname}-day.png") {
- my $ftime = localtime((stat("$Header::graphdir/${graphname}-day.png"))[9]);
- print "$Lang::tr{'the statistics were last updated at'}: $ftime \n";
- print "";
- print " ";
- print " ";
- } else {
- print $Lang::tr{'no information available'};
- }
- print " \n";
- &Header::closebox();
-}
-
-foreach my $graphname (@wireless) {
-
- &Graphs::wireless("day",$graphname);
-
- &Header::openbox('100%', 'center', "wireless $graphname $Lang::tr{'graph'}");
- if (-e "$Header::graphdir/wireless-${graphname}-day.png") {
- my $ftime = localtime((stat("$Header::graphdir/wireless-${graphname}-day.png"))[9]);
- print "$Lang::tr{'the statistics were last updated at'}: $ftime \n";
- print "";
- print " ";
- print " ";
- } else {
- print $Lang::tr{'no information available'};
- }
- print " \n";
- &Header::closebox();
-}
-
-if ($cgiparams[1] =~ /red/) {
-
- if ( $netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ && $netsettings{'RED_TYPE'} eq "DHCP") {
-
- &Header::openbox('100%', 'left', "RED $Lang::tr{'dhcp configuration'}");
- if (-s "${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info") {
-
- &General::readhash("${General::swroot}/dhcpc/dhcpcd-$netsettings{'RED_DEV'}.info", \%dhcpinfo);
-
- my $DNS1=`echo $dhcpinfo{'DNS'} | cut -f 1 -d ,`;
- my $DNS2=`echo $dhcpinfo{'DNS'} | cut -f 2 -d ,`;
-
- my $lsetme=0;
- my $leasetime="";
- if ($dhcpinfo{'LEASETIME'} ne "") {
- $lsetme=$dhcpinfo{'LEASETIME'};
- $lsetme=($lsetme/60);
- if ($lsetme > 59) {
- $lsetme=($lsetme/60); $leasetime=$lsetme." Hour";
- } else {
- $leasetime=$lsetme." Minute";
- }
- if ($lsetme > 1) {
- $leasetime=$leasetime."s";
- }
- }
- my $rentme=0;
- my $rnwltime="";
- if ($dhcpinfo{'RENEWALTIME'} ne "") {
- $rentme=$dhcpinfo{'RENEWALTIME'};
- $rentme=($rentme/60);
- if ($rentme > 59){
- $rentme=($rentme/60); $rnwltime=$rentme." Hour";
- } else {
- $rnwltime=$rentme." Minute";
- }
- if ($rentme > 1){
- $rnwltime=$rnwltime."s";
- }
- }
- my $maxtme=0;
- my $maxtime="";
- if ($dhcpinfo{'REBINDTIME'} ne "") {
- $maxtme=$dhcpinfo{'REBINDTIME'};
- $maxtme=($maxtme/60);
- if ($maxtme > 59){
- $maxtme=($maxtme/60); $maxtime=$maxtme." Hour";
- } else {
- $maxtime=$maxtme." Minute";
- }
- if ($maxtme > 1) {
- $maxtime=$maxtime."s";
- }
- }
-
- print " ";
- if ($dhcpinfo{'HOSTNAME'}) {
- print "$Lang::tr{'hostname'} $dhcpinfo{'HOSTNAME'}.$dhcpinfo{'DOMAIN'} \n";
- } else {
- print "$Lang::tr{'domain'} $dhcpinfo{'DOMAIN'} \n";
- }
- print <$Lang::tr{'gateway'} $dhcpinfo{'GATEWAY'}
- $Lang::tr{'primary dns'} $DNS1
- $Lang::tr{'secondary dns'} $DNS2
- $Lang::tr{'dhcp server'} $dhcpinfo{'DHCPSIADDR'}
- $Lang::tr{'def lease time'} $leasetime
- $Lang::tr{'default renewal time'} $rnwltime
- $Lang::tr{'max renewal time'} $maxtime
-
-END
- ;
- }
- else
- {
- print "$Lang::tr{'no dhcp lease'}";
- }
- &Header::closebox();
- }
-
- if ($dhcpsettings{'ENABLE_GREEN'} eq 'on' || $dhcpsettings{'ENABLE_BLUE'} eq 'on') {
- &Header::CheckSortOrder;
- &Header::PrintActualLeases;
- }
-
-} else {
-
- &Header::openbox('100%', 'left', $Lang::tr{'routing table entries'});
- $output = `/sbin/ip route show`;
- $output = &Header::cleanhtml($output,"y");
- print "$output \n";
- &Header::closebox();
-
- &Header::openbox('100%', 'left', $Lang::tr{'arp table entries'});
- $output = `/sbin/ip neigh show`;
- $output = &Header::cleanhtml($output,"y");
- print "$output \n";
- &Header::closebox();
-
-}
-
-&Header::closebigbox();
-&Header::closepage();
diff --git a/html/cgi-bin/services.cgi b/html/cgi-bin/services.cgi
index 1b781404c..c24b4601c 100644
--- a/html/cgi-bin/services.cgi
+++ b/html/cgi-bin/services.cgi
@@ -2,7 +2,7 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
-# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
+# Copyright (C) 2008 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 #
@@ -22,33 +22,30 @@
use strict;
# enable only the following on debugging purpose
-#use warnings;
-#use CGI::Carp 'fatalsToBrowser';
+use warnings;
+use CGI::Carp 'fatalsToBrowser';
require '/var/ipfire/general-functions.pl';
require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
require "${General::swroot}/graphs.pl";
+my %color = ();
+my %mainsettings = ();
+my %netsettings=();
+&General::readhash("${General::swroot}/main/settings", \%mainsettings);
+&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
+&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
+
#workaround to suppress a warning when a variable is used only once
my @dummy = ( ${Header::colourred} );
undef (@dummy);
-my %color = ();
-my %mainsettings = ();
-&General::readhash("${General::swroot}/main/settings", \%mainsettings);
-&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
-
-my %netsettings=();
-&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
-
-&Graphs::updateprocessesgraph ("day");
my %cgiparams=();
# Maps a nice printable name to the changing part of the pid file, which
# is also the name of the program
-my %servicenames =
-(
+my %servicenames =(
$Lang::tr{'dhcp server'} => 'dhcpd',
$Lang::tr{'web server'} => 'httpd',
$Lang::tr{'cron server'} => 'fcron',
@@ -65,65 +62,73 @@ my %servicenames =
my $lines=0; # Used to count the outputlines to make different bgcolor
my $iface = '';
-if (open(FILE, "${General::swroot}/red/iface"))
-{
+if (open(FILE, "${General::swroot}/red/iface")){
$iface = ;
close FILE;
chomp $iface;
}
+
$servicenames{"$Lang::tr{'intrusion detection system'} (RED)"} = "snort_${iface}";
$servicenames{"$Lang::tr{'intrusion detection system'} (GREEN)"} = "snort_$netsettings{'GREEN_DEV'}";
-if ($netsettings{'ORANGE_DEV'} ne '') {
+
+if ($netsettings{'ORANGE_DEV'} ne ''){
$servicenames{"$Lang::tr{'intrusion detection system'} (ORANGE)"} = "snort_$netsettings{'ORANGE_DEV'}";
}
-if ($netsettings{'BLUE_DEV'} ne '') {
+if ($netsettings{'BLUE_DEV'} ne ''){
$servicenames{"$Lang::tr{'intrusion detection system'} (BLUE)"} = "snort_$netsettings{'BLUE_DEV'}";
}
-&Header::showhttpheaders();
-&Header::getcgihash(\%cgiparams);
-&Header::openpage($Lang::tr{'status information'}, 1, '');
-&Header::openbigbox('100%', 'left');
+my @querry = split(/\?/,$ENV{'QUERY_STRING'});
+$querry[0] = '' unless defined $querry[0];
+$querry[1] = 'hour' unless defined $querry[1];
-&Header::openbox('100%', 'left', $Lang::tr{'services'});
+if ( $querry[0] =~ "processescpu"){
+ print "Content-type: image/png\n\n";
+ binmode(STDOUT);
+ &Graphs::updateprocessescpugraph($querry[1]);
+}elsif ( $querry[0] =~ "processesmemory"){
+ print "Content-type: image/png\n\n";
+ binmode(STDOUT);
+ &Graphs::updateprocessesmemorygraph($querry[1]);
+}else{
+ &Header::showhttpheaders();
+ &Header::openpage($Lang::tr{'status information'}, 1, '');
+ &Header::openbigbox('100%', 'left');
-print <
$Lang::tr{'services'} $Lang::tr{'status'} PID $Lang::tr{'memory'}
END
;
+ my $key = '';
+ foreach $key (sort keys %servicenames){
+ $lines++;
+ if ($lines % 2){
+ print "\n$key \n";
+ }else{
+ print " \n$key \n";
+ }
-my $key = '';
-foreach $key (sort keys %servicenames)
-{
- $lines++;
- if ($lines % 2)
- { print " \n$key \n";}
- else
- { print " \n$key \n";}
+ my $shortname = $servicenames{$key};
+ my $status = &isrunning($shortname);
- my $shortname = $servicenames{$key};
- my $status = &isrunning($shortname);
+ print "$status\n";
+ print " \n";
+ }
- print "$status\n";
- print "\n";
-}
+ print "
\n";
+ &Header::closebox();
+ &Header::openbox('100%', 'left', "Addon - $Lang::tr{services}");
+ my $paramstr=$ENV{QUERY_STRING};
+ my @param=split(/!/, $paramstr);
+ if ($param[1] ne ''){
+ system("/usr/local/bin/addonctrl @param[0] @param[1] > /dev/null 2>&1");
+ }
-print "
\n";
-
-&Header::closebox();
-
-&Header::openbox('100%', 'left', "Addon - $Lang::tr{services}");
-
-my $paramstr=$ENV{QUERY_STRING};
-my @param=split(/!/, $paramstr);
-if ($param[1] ne '') {
- system("/usr/local/bin/addonctrl @param[0] @param[1] > /dev/null 2>&1");
-}
-
-print <
@@ -137,101 +142,76 @@ print </dev/null | cut -d"-" -f2`;
-foreach (@pak)
-{
- chomp($_);
+ # Generate list of installed addon pak's
+ my @pak = `find /opt/pakfire/db/installed/meta-* 2>/dev/null | cut -d"-" -f2`;
+ foreach (@pak){
+ chomp($_);
- # Check which of the paks are services
- my @svc = `find /etc/init.d/$_ 2>/dev/null | cut -d"/" -f4`;
- foreach (@svc)
- {
- # blacklist some packages
- #
- # alsa has trouble with the volume saving and was not really stopped
- #
- chomp($_);
- if ($_ ne "alsa")
- {
- $lines++;
- if ($lines % 2)
- {
- print "";
+ # Check which of the paks are services
+ my @svc = `find /etc/init.d/$_ 2>/dev/null | cut -d"/" -f4`;
+ foreach (@svc){
+ # blacklist some packages
+ #
+ # alsa has trouble with the volume saving and was not really stopped
+ #
+ chomp($_);
+ if ($_ ne "alsa"){
+ $lines++;
+ if ($lines % 2){
+ print " ";
+ }else{
+ print " ";
+ }
+ print "$_ ";
+ my $status = isautorun($_);
+ print "$status ";
+ print " ";
+ print " ";
+ my $status = &isrunningaddon($_);
+ $status =~ s/\\[[0-1]\;[0-9]+m//g;
+
+ chomp($status);
+ print "$status";
+ print " ";
+ }
}
- else
- {
- print "";
- }
- print "$_ ";
- my $status = isautorun($_);
- print "$status ";
- print " ";
- print " ";
- my $status = &isrunningaddon($_);
- $status =~ s/\\[[0-1]\;[0-9]+m//g;
-
- chomp($status);
- print "$status";
- print " ";
- }
}
+
+ print "
\n";
+ &Header::closebox();
+
+ &Header::openbox('100%', 'center', "$Lang::tr{'processes'} $Lang::tr{'graph'}");
+ &Graphs::makegraphbox("services.cgi","processescpu","day");
+ &Header::closebox();
+
+ &Header::openbox('100%', 'center', "$Lang::tr{'processes'} $Lang::tr{'memory'} $Lang::tr{'graph'}");
+ &Graphs::makegraphbox("services.cgi","processesmemory","day");
+ &Header::closebox();
+
+ &Header::closebigbox();
+ &Header::closepage();
}
-print "\n";
-
-&Header::closebox();
-
-&Header::openbox('100%', 'center', "$Lang::tr{'processes'} $Lang::tr{'graph'}");
-if (-e "$Header::graphdir/processes-day.png") {
- my $ftime = localtime((stat("$Header::graphdir/processes-day.png"))[9]);
- print "$Lang::tr{'the statistics were last updated at'}: $ftime \n";
- print "";
- print " ";
- print " ";
-} else {
- print $Lang::tr{'no information available'};
-}
-print " \n";
-&Header::closebox();
-
-&Header::openbox('100%', 'center', "$Lang::tr{'processes'} $Lang::tr{'memory'} $Lang::tr{'graph'}");
-if (-e "$Header::graphdir/processesmem-day.png") {
- my $ftime = localtime((stat("$Header::graphdir/processesmem-day.png"))[9]);
- print "$Lang::tr{'the statistics were last updated at'}: $ftime \n";
- print "";
- print " ";
- print " ";
-} else {
- print $Lang::tr{'no information available'};
-}
-print " \n";
-&Header::closebox();
-&Header::closebigbox();
-&Header::closepage();
-
-sub isautorun
-{
+sub isautorun{
my $cmd = $_[0];
my $status = " ";
my $init = `find /etc/rc.d/rc3.d/S??${cmd} 2>/dev/null`;
chomp ($init);
- if ($init ne '') {
- $status = " ";
+ if ($init ne ''){
+ $status = " ";
}
$init = `find /etc/rc.d/rc3.d/off/S??${cmd} 2>/dev/null`;
chomp ($init);
- if ($init ne '') {
- $status = " ";
+ if ($init ne ''){
+ $status = " ";
}
-return $status;
+ return $status;
}
-sub isrunning
-{
+sub isrunning{
my $cmd = $_[0];
my $status = "$Lang::tr{'stopped'} ";
my $pid = '';
@@ -247,7 +227,9 @@ sub isrunning
close FILE;
if (open(FILE, "/proc/${pid}/status")){
while (){
- if (/^Name:\W+(.*)/) {$testcmd = $1; }
+ if (/^Name:\W+(.*)/) {
+ $testcmd = $1;
+ }
}
close FILE;
}
@@ -256,13 +238,14 @@ sub isrunning
@memory = split(/ /,$temp);
}
close FILE;
- if ($testcmd =~ /$exename/){$status = "$Lang::tr{'running'} $pid $memory[0] KB ";}
+ if ($testcmd =~ /$exename/){
+ $status = "$Lang::tr{'running'} $pid $memory[0] KB ";
}
-return $status;
+ }
+ return $status;
}
-sub isrunningaddon
-{
+sub isrunningaddon{
my $cmd = $_[0];
my $status = "$Lang::tr{'stopped'} ";
my $pid = '';
@@ -273,24 +256,29 @@ sub isrunningaddon
my $testcmd = `/usr/local/bin/addonctrl $_ status`;
if ( $testcmd =~ /is\ running/ && $testcmd !~ /is\ not\ running/){
- $status = "$Lang::tr{'running'} ";
- $testcmd =~ s/[a-z_]//gi; $testcmd =~ s/\[[0-1]\;[0-9]+//gi; $testcmd =~ s/[\(\)\.]//gi; $testcmd =~ s/ //gi; $testcmd =~ s///gi;
+ $status = "$Lang::tr{'running'} ";
+ $testcmd =~ s/[a-z_]//gi;
+ $testcmd =~ s/\[[0-1]\;[0-9]+//gi;
+ $testcmd =~ s/[\(\)\.]//gi;
+ $testcmd =~ s/ //gi;
+ $testcmd =~ s///gi;
- my @pid = split(/\s/,$testcmd);
- $status .="$pid[0] ";
+ my @pid = split(/\s/,$testcmd);
+ $status .="$pid[0] ";
- my $memory = 0;
+ my $memory = 0;
- foreach (@pid){
- chomp($_);
- if (open(FILE, "/proc/$_/statm")){
+ foreach (@pid){
+ chomp($_);
+ if (open(FILE, "/proc/$_/statm")){
my $temp = ;
- @memory = split(/ /,$temp);
+ @memory = split(/ /,$temp);
+ }
+ $memory+=$memory[0];
}
- $memory+=$memory[0];
+ $status .="$memory KB ";
+ }else{
+ $status = "$Lang::tr{'stopped'} ";
}
- $status .="$memory KB ";
- }
- else {$status = "$Lang::tr{'stopped'} ";}
-return $status;
+ return $status;
}
diff --git a/html/cgi-bin/system.cgi b/html/cgi-bin/system.cgi
index 5d852176b..171bdbd4b 100644
--- a/html/cgi-bin/system.cgi
+++ b/html/cgi-bin/system.cgi
@@ -2,7 +2,7 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
-# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
+# Copyright (C) 2008 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 #
@@ -35,53 +35,31 @@ my %mainsettings = ();
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
-my %cgiparams=();
+my @querry = split(/\?/,$ENV{'QUERY_STRING'});
+$querry[0] = '' unless defined $querry[0];
+$querry[1] = 'hour' unless defined $querry[1];
-# Generate Graphs from rrd Data
-&Graphs::updatecpugraph ("day");
-&Graphs::updatecpufreqgraph ("day");
-&Graphs::updateloadgraph ("day");
+if ( $querry[0] =~ "cpu"){
+ print "Content-type: image/png\n\n";
+ binmode(STDOUT);
+ &Graphs::updatecpugraph($querry[1]);
+}elsif ( $querry[0] =~ "load"){
+ print "Content-type: image/png\n\n";
+ binmode(STDOUT);
+ &Graphs::updateloadgraph($querry[1]);
+}else{
+ &Header::showhttpheaders();
+ &Header::openpage($Lang::tr{'status information'}, 1, '');
+ &Header::openbigbox('100%', 'left');
-&Header::showhttpheaders();
-&Header::getcgihash(\%cgiparams);
-&Header::openpage($Lang::tr{'status information'}, 1, '');
-&Header::openbigbox('100%', 'left');
+ &Header::openbox('100%', 'center', "CPU $Lang::tr{'graph'}");
+ &Graphs::makegraphbox("system.cgi","cpu","day","315");
+ &Header::closebox();
-&Header::openbox('100%', 'center', "CPU $Lang::tr{'graph'}");
-if (-e "$Header::graphdir/cpu-day.png") {
- my $ftime = localtime((stat("$Header::graphdir/cpu-day.png"))[9]);
- print "$Lang::tr{'the statistics were last updated at'}: $ftime \n";
- print "";
- print " ";
- print " ";
-} else {
- print $Lang::tr{'no information available'};
+ &Header::openbox('100%', 'center', "Load $Lang::tr{'graph'}");
+ &Graphs::makegraphbox("system.cgi","load","day");
+ &Header::closebox();
+
+ &Header::closebigbox();
+ &Header::closepage();
}
-print " \n";
-&Header::closebox();
-
-if (-e "$Header::graphdir/cpufreq-day.png") {
- &Header::openbox('100%', 'center', "CPU Frequency $Lang::tr{'graph'}");
- my $ftime = localtime((stat("$Header::graphdir/cpufreq-day.png"))[9]);
- print "$Lang::tr{'the statistics were last updated at'}: $ftime \n";
- print "";
- print " ";
- print " ";
- print " \n";
- &Header::closebox();
-}
-
-&Header::openbox('100%', 'center', "Load $Lang::tr{'graph'}");
-if (-e "$Header::graphdir/load-day.png") {
- my $ftime = localtime((stat("$Header::graphdir/load-day.png"))[9]);
- print "$Lang::tr{'the statistics were last updated at'}: $ftime \n";
- print "";
- print " ";
- print " ";
-} else {
- print $Lang::tr{'no information available'};
-}
-print " \n";
-&Header::closebox();
-&Header::closebigbox();
-&Header::closepage();
diff --git a/html/cgi-bin/traffics.cgi b/html/cgi-bin/traffics.cgi
deleted file mode 100644
index af9115089..000000000
--- a/html/cgi-bin/traffics.cgi
+++ /dev/null
@@ -1,373 +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 . #
-# #
-###############################################################################
-
-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}/net-traffic/net-traffic-admin.pl";
-require "${General::swroot}/net-traffic/net-traffic-lib.pl";
-
-my %color = ();
-my %mainsettings = ();
-&General::readhash("${General::swroot}/main/settings", \%mainsettings);
-&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
-
-my %cgiparams;
-my %netsettings;
-
-&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
-
-my @days = ( 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 );
-
-my @now = localtime(time);
-
-$now[5] = $now[5]+1900;
-
-$cgiparams{'STARTDAY'} = 10;
-$cgiparams{'STOPDAY'} = 11;
-$cgiparams{'STARTYEAR'} = $now[5];
-$cgiparams{'STOPYEAR'} = $now[5];
-
-if($NETTRAFF::settings{'MONTHLY_VOLUME_ON'} eq 'on')
-{
- $cgiparams{'STARTDAY'} = $NETTRAFF::settings{'STARTDAY'};
- $cgiparams{'STOPDAY'} = $NETTRAFF::settings{'STARTDAY'};
-}
-
-# this periode started last month
-if ($now[3] < $cgiparams{'STARTDAY'}) {
- $cgiparams{'STARTMONTH'} = $now[4]-1;
- $cgiparams{'STOPMONTH'} = $now[4];
- # when current month is january we start in last year december
- if ($cgiparams{'STOPMONTH'} == 0) {
- $cgiparams{'STARTYEAR'} = $now[5]-1;
- $cgiparams{'STARTMONTH'} = 11;
- }
-}
-else {
- $cgiparams{'STARTMONTH'} = $now[4];
- $cgiparams{'STOPMONTH'} = $now[4]+1;
- # when we are in december, this periode ends next year january
- if ($cgiparams{'STARTMONTH'} == 11) {
- $cgiparams{'STOPYEAR'} = $now[5]+1;
- $cgiparams{'STOPMONTH'} = 0;
- }
-}
-
-&Header::getcgihash(\%cgiparams);
-&Header::showhttpheaders();
-&Header::openpage($Lang::tr{'sstraffic'}, 1, '');
-&Header::openbigbox('100%', 'left');
-&Header::openbox('100%', 'left', "");
-
-print <
-
-
-
-
-
-
-
-
-
-END
-
-&Header::closebox();
-
-&Header::openbox('100%', 'left', "$Lang::tr{'traffics'}");
-
-my $dateWidth = '20%';
-my $netWidth = '34%';
-my $inOutWidth = '17%';
-
-# 4 networks
-if ($netsettings{'CONFIG_TYPE'} =~ /^(4)$/) {
- $dateWidth = '12%';
- $netWidth = '22%';
- $inOutWidth = '11%';
-}
-# 3 networks
-if ($netsettings{'CONFIG_TYPE'} =~ /^(2|3)$/) {
- $dateWidth = '16%';
- $netWidth = '28%';
- $inOutWidth = '14%';
-}
-
-print <
-
-
- $Lang::tr{'trafficgreen'}
-END
-
-if ($netsettings{'CONFIG_TYPE'} =~ /^(3|4)$/) {
- print "$Lang::tr{'trafficblue'} ";
-}
-
-if ($netsettings{'CONFIG_TYPE'} =~ /^(2|4)$/) {
- print "$Lang::tr{'trafficorange'} ";
-}
-
-if ($netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/)
-{
-print "$Lang::tr{'trafficred'} ";
-}
-print <
-
-
-
- $Lang::tr{'trafficdate'}
- $Lang::tr{'trafficin'}
- $Lang::tr{'trafficout'}
-END
-
-if ($netsettings{'CONFIG_TYPE'} =~ /^(3|4)$/)
-{
- print "$Lang::tr{'trafficin'} ";
- print "$Lang::tr{'trafficout'} ";
-}
-
-if ($netsettings{'CONFIG_TYPE'} =~ /^(2|4)$/)
-{
- print "$Lang::tr{'trafficin'} ";
- print "$Lang::tr{'trafficout'} ";
-}
-if ($netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/)
-{
-print "$Lang::tr{'trafficin'} ";
-print "$Lang::tr{'trafficout'} ";
-}
-print " ";
-
-my $total_blue_in=0;
-my $total_blue_out=0;
-my $total_green_in=0;
-my $total_green_out=0;
-my $total_orange_in=0;
-my $total_orange_out=0;
-my $total_red_in=0;
-my $total_red_out=0;
-my $lines=0;
-
-
-my $startyear = $cgiparams{'STARTYEAR'};
-my $stopyear = $cgiparams{'STOPYEAR'};
-
-my $startMonth = $cgiparams{'STARTMONTH'}+1;
-$startMonth = $startMonth < 10 ? $startMonth = "0".$startMonth : $startMonth;
-
-my $endMonth = $cgiparams{'STOPMONTH'}+1;
-$endMonth = $endMonth < 10 ? $endMonth = "0".$endMonth : $endMonth;
-
-my $startDay = $cgiparams{'STARTDAY'};
-$startDay = $startDay < 10 ? $startDay = "0".$startDay : $startDay;
-
-my $endDay = $cgiparams{'STOPDAY'}+1;
-$endDay = $endDay < 10 ? $endDay = "0".$endDay : $endDay;
-
-my $displayMode = "daily_multi";
-my $start = $startyear.$startMonth.$startDay;
-my $end = $stopyear.$endMonth.$endDay;
-
-my %allDaysBytes = ();
-my @allDays = &Traffic::calcTraffic(\%allDaysBytes,$start,$end, $displayMode);
-
-
-foreach (@allDays) {
- $total_green_in += $allDaysBytes{$_}{${Traffic::green_in}};
- $total_green_out += $allDaysBytes{$_}{${Traffic::green_out}};
-
- if ($netsettings{'CONFIG_TYPE'} =~ /^(3|4)$/)
- {
- $total_blue_in += $allDaysBytes{$_}{${Traffic::blue_in}};
- $total_blue_out += $allDaysBytes{$_}{${Traffic::blue_out}};
- }
-
- if ($netsettings{'CONFIG_TYPE'} =~ /^(2|4)$/)
- {
- $total_orange_in += $allDaysBytes{$_}{${Traffic::orange_in}};
- $total_orange_out += $allDaysBytes{$_}{${Traffic::orange_out}};
- }
-
- if ($netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/)
- {
- $total_red_in += $allDaysBytes{$_}{${Traffic::red_in}};
- $total_red_out += $allDaysBytes{$_}{${Traffic::red_out}};
- }
-
- if ($lines % 2) {
- print ""; }
- else {
- print " "; }
-
- printf "%s \n", $allDaysBytes{$_}{'Day'};
- printf "%.3f \n", ($allDaysBytes{$_}{${Traffic::green_in}}/1048576);
- printf "%.3f \n", ($allDaysBytes{$_}{${Traffic::green_out}}/1048576);
-
- if ($netsettings{'CONFIG_TYPE'} =~ /^(3|4)$/)
- {
- printf "%.3f \n", ($allDaysBytes{$_}{${Traffic::blue_in}}/1048576);
- printf "%.3f \n", ($allDaysBytes{$_}{${Traffic::blue_out}}/1048576);
- }
- if ($netsettings{'CONFIG_TYPE'} =~ /^(2|4)$/)
- {
- printf "%.3f \n", ($allDaysBytes{$_}{${Traffic::orange_in}}/1048576);
- printf "%.3f \n", ($allDaysBytes{$_}{${Traffic::orange_out}}/1048576);
- }
- if ($netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/)
- {
- printf "%.3f \n", ($allDaysBytes{$_}{${Traffic::red_in}}/1048576);
- printf "%.3f \n", ($allDaysBytes{$_}{${Traffic::red_out}}/1048576);
- }
- $lines++;
-}
-
-$total_green_in=sprintf("%.2f", ($total_green_in/1048576));
-$total_green_out=sprintf("%.2f", ($total_green_out/1048576));
-$total_blue_in=sprintf("%.2f", ($total_blue_in/1048576));
-$total_blue_out=sprintf("%.2f", ($total_blue_out/1048576));
-$total_orange_in=sprintf("%.2f", ($total_orange_in/1048576));
-$total_orange_out=sprintf("%.2f", ($total_orange_out/1048576));
-$total_red_in=sprintf("%.2f", ($total_red_in/1048576));
-$total_red_out=sprintf("%.2f", ($total_red_out/1048576));
-
-if ($lines % 2) {print ""; }
-else {print " "; }
-
-print <$Lang::tr{'trafficsum'}
- $total_green_in MB
- $total_green_out MB
-END
-
-if ($netsettings{'CONFIG_TYPE'} =~ /^(3|4)$/)
-{
- print "$total_blue_in MB ";
- print "$total_blue_out MB ";
-}
-
-if ($netsettings{'CONFIG_TYPE'} =~ /^(2|4)$/)
-{
- print "$total_orange_in MB ";
- print "$total_orange_out MB ";
-}
-
-if ($netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/)
-{
-print "$total_red_in MB ";
-print "$total_red_out MB ";
-}
-print "
";
-
-&Header::closebox();
-&Header::closebigbox();
-&Header::closepage();