From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leo-Andres Hofmann To: development@lists.ipfire.org Subject: [PATCH v2 2/2] rrd graphs: Fix indentation after removing graph output Date: Fri, 16 Jul 2021 10:39:38 +0200 Message-ID: <20210716083938.1429-2-hofmann@leo-andres.de> In-Reply-To: <20210716083938.1429-1-hofmann@leo-andres.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8927000566993749703==" List-Id: --===============8927000566993749703== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Signed-off-by: Leo-Andres Hofmann --- html/cgi-bin/entropy.cgi | 76 ++++++------- html/cgi-bin/hardwaregraphs.cgi | 110 +++++++++---------- html/cgi-bin/media.cgi | 158 +++++++++++++-------------- html/cgi-bin/memory.cgi | 122 ++++++++++----------- html/cgi-bin/netexternal.cgi | 184 ++++++++++++++++---------------- html/cgi-bin/netinternal.cgi | 46 ++++---- html/cgi-bin/netother.cgi | 76 ++++++------- html/cgi-bin/netovpnrw.cgi | 38 +++---- html/cgi-bin/netovpnsrv.cgi | 48 ++++----- html/cgi-bin/qos.cgi | 18 ++-- html/cgi-bin/system.cgi | 32 +++--- 11 files changed, 454 insertions(+), 454 deletions(-) diff --git a/html/cgi-bin/entropy.cgi b/html/cgi-bin/entropy.cgi index 6cfcadd1c..0a27d2329 100644 --- a/html/cgi-bin/entropy.cgi +++ b/html/cgi-bin/entropy.cgi @@ -30,52 +30,52 @@ require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; require "${General::swroot}/graphs.pl"; =20 - &Header::showhttpheaders(); - &Header::openpage($Lang::tr{'entropy'}, 1, ''); - &Header::openbigbox('100%', 'left'); +&Header::showhttpheaders(); +&Header::openpage($Lang::tr{'entropy'}, 1, ''); +&Header::openbigbox('100%', 'left'); =20 - &Header::openbox('100%', 'center', $Lang::tr{'entropy'}); - &Graphs::makegraphbox("entropy.cgi", "entropy", "day"); - &Header::closebox(); +&Header::openbox('100%', 'center', $Lang::tr{'entropy'}); +&Graphs::makegraphbox("entropy.cgi", "entropy", "day"); +&Header::closebox(); =20 - # Check for hardware support. - my $message; - my $message_colour =3D $Header::colourred; - if (&has_rdrand()) { - $message =3D $Lang::tr{'system has rdrand'}; - $message_colour =3D $Header::colourgreen; - } +# Check for hardware support. +my $message; +my $message_colour =3D $Header::colourred; +if (&has_rdrand()) { + $message =3D $Lang::tr{'system has rdrand'}; + $message_colour =3D $Header::colourgreen; +} =20 - my $rngd_status =3D "= $Lang::tr{'stopped'}"; - if (&rngd_is_running()) { - $rngd_status =3D "= $Lang::tr{'running'}"; - } +my $rngd_status =3D "<= font color=3D'white'>$Lang::tr{'stopped'}"; +if (&rngd_is_running()) { + $rngd_status =3D "<= font color=3D'white'>$Lang::tr{'running'}"; +} =20 - &Header::openbox('100%', 'center', $Lang::tr{'hardware support'}); - if ($message) { - print <$message

+&Header::openbox('100%', 'center', $Lang::tr{'hardware support'}); +if ($message) { + print <$message

EOF - } +} =20 - print < - - $Lang::tr{'service'} - $Lang::tr{'status'} - - - - $Lang::tr{'random number generator daemon'} - - $rngd_status - - +print < + + $Lang::tr{'service'} + $Lang::tr{'status'} + + + + $Lang::tr{'random number generator daemon'} + + $rngd_status + + EOF - &Header::closebox(); +&Header::closebox(); =20 - &Header::closebigbox(); - &Header::closepage(); +&Header::closebigbox(); +&Header::closepage(); =20 sub has_rdrand() { open(FILE, "/proc/cpuinfo") or return 0; diff --git a/html/cgi-bin/hardwaregraphs.cgi b/html/cgi-bin/hardwaregraphs.cgi index be45a8c99..9e3fe60d5 100644 --- a/html/cgi-bin/hardwaregraphs.cgi +++ b/html/cgi-bin/hardwaregraphs.cgi @@ -90,70 +90,70 @@ if (@thermal_zone_sensors) { } } =20 - &Header::showhttpheaders(); - &Header::openpage($Lang::tr{'hardware graphs'}, 1, ''); - &Header::openbigbox('100%', 'left'); - - &Header::getcgihash(\%sensorsettings); - - if ( $sensorsettings{'ACTION'} eq $Lang::tr{'save'} ) { - foreach(@sensorsgraphs){ - chomp($_); - $_ =3D~ /\/(.*)sensors-(.*)\/(.*)\.rrd/; - my $label =3D $2.$3;$label=3D~ s/-//g; - if ( $sensorsettings{'LINE-'.$label} ne "on" ){ - $sensorsettings{'LINE-'.$label} =3D 'off'; - } elsif ($sensorsettings{'LINE-'.$label} eq "on" ){ - $sensorsettings{'LINE-'.$label} =3D 'checked'; - } - $sensorsettings{'LABEL-'.$label} =3D~ s/\W//g; - } - &General::writehash("${General::swroot}/sensors/settings", \%sensorsetting= s); +&Header::showhttpheaders(); +&Header::openpage($Lang::tr{'hardware graphs'}, 1, ''); +&Header::openbigbox('100%', 'left'); + +&Header::getcgihash(\%sensorsettings); + +if ( $sensorsettings{'ACTION'} eq $Lang::tr{'save'} ) { + foreach(@sensorsgraphs){ + chomp($_); + $_ =3D~ /\/(.*)sensors-(.*)\/(.*)\.rrd/; + my $label =3D $2.$3;$label=3D~ s/-//g; + if ( $sensorsettings{'LINE-'.$label} ne "on" ){ + $sensorsettings{'LINE-'.$label} =3D 'off'; + } elsif ($sensorsettings{'LINE-'.$label} eq "on" ){ + $sensorsettings{'LINE-'.$label} =3D 'checked'; + } + $sensorsettings{'LABEL-'.$label} =3D~ s/\W//g; } + &General::writehash("${General::swroot}/sensors/settings", \%sensorsettings= ); +} =20 - # This should be save, because no user given content will be processed. - #my @disks =3D `ls -1 /sys/block | grep -E '^sd|^nvme' | sort | uniq`; - my @disks =3D &get_disks(); +# This should be save, because no user given content will be processed. +#my @disks =3D `ls -1 /sys/block | grep -E '^sd|^nvme' | sort | uniq`; +my @disks =3D &get_disks(); =20 - foreach (@disks){ - my $disk =3D $_; - chomp $disk; - my @array =3D split(/\//,$disk); +foreach (@disks){ + my $disk =3D $_; + chomp $disk; + my @array =3D split(/\//,$disk); =20 - &Header::openbox('100%', 'center', "$array[$#array] $Lang::tr{'graph'}"); - &Graphs::makegraphbox("hardwaregraphs.cgi",$array[$#array],"day"); - &Header::closebox(); - } + &Header::openbox('100%', 'center', "$array[$#array] $Lang::tr{'graph'}"); + &Graphs::makegraphbox("hardwaregraphs.cgi",$array[$#array],"day"); + &Header::closebox(); +} =20 - if ( grep(/thermal-thermal_zone/, @sensorsgraphs) ) { - &Header::openbox('100%', 'center', "ACPI Thermal-Zone Temp $Lang::tr{'grap= h'}"); - &Graphs::makegraphbox("hardwaregraphs.cgi","thermaltemp","day"); - &Header::closebox(); - } +if ( grep(/thermal-thermal_zone/, @sensorsgraphs) ) { + &Header::openbox('100%', 'center', "ACPI Thermal-Zone Temp $Lang::tr{'graph= '}"); + &Graphs::makegraphbox("hardwaregraphs.cgi","thermaltemp","day"); + &Header::closebox(); +} =20 - if ( grep(/temperature-/, @sensorsgraphs) ) { - &Header::openbox('100%', 'center', "hwtemp $Lang::tr{'graph'}"); - &Graphs::makegraphbox("hardwaregraphs.cgi","hwtemp","day"); - Header::closebox(); - } +if ( grep(/temperature-/, @sensorsgraphs) ) { + &Header::openbox('100%', 'center', "hwtemp $Lang::tr{'graph'}"); + &Graphs::makegraphbox("hardwaregraphs.cgi","hwtemp","day"); + Header::closebox(); +} =20 - if ( grep(/fanspeed-/, @sensorsgraphs) ) { - &Header::openbox('100%', 'center', "hwfan $Lang::tr{'graph'}"); - &Graphs::makegraphbox("hardwaregraphs.cgi","hwfan","day"); - &Header::closebox(); - } +if ( grep(/fanspeed-/, @sensorsgraphs) ) { + &Header::openbox('100%', 'center', "hwfan $Lang::tr{'graph'}"); + &Graphs::makegraphbox("hardwaregraphs.cgi","hwfan","day"); + &Header::closebox(); +} =20 - if ( grep(/voltage-/, @sensorsgraphs) ) { - &Header::openbox('100%', 'center', "hwvolt $Lang::tr{'graph'}"); - &Graphs::makegraphbox("hardwaregraphs.cgi","hwvolt","day"); - &Header::closebox(); - } +if ( grep(/voltage-/, @sensorsgraphs) ) { + &Header::openbox('100%', 'center', "hwvolt $Lang::tr{'graph'}"); + &Graphs::makegraphbox("hardwaregraphs.cgi","hwvolt","day"); + &Header::closebox(); +} =20 - if ( @sensorsgraphs ) { - sensorsbox(); - } - &Header::closebigbox(); - &Header::closepage(); +if ( @sensorsgraphs ) { + sensorsbox(); +} +&Header::closebigbox(); +&Header::closepage(); =20 sub sensorsbox { &Header::openbox('100%', 'center', "$Lang::tr{'mbmon settings'}"); diff --git a/html/cgi-bin/media.cgi b/html/cgi-bin/media.cgi index 835565811..cc8f84d0a 100644 --- a/html/cgi-bin/media.cgi +++ b/html/cgi-bin/media.cgi @@ -43,115 +43,115 @@ my %cgiparams=3D(); =20 my @devices =3D `ls -1 /sys/block | grep -E '^sd|^mmcblk|^nvme|^xvd|^vd|^md'= | sort | uniq`; =20 - &Header::showhttpheaders(); - &Header::openpage($Lang::tr{'media information'}, 1, ''); - &Header::openbigbox('100%', 'left'); - - foreach (@devices) { - my $device =3D $_; - chomp($device); - my @array =3D split(/\//,$device); - &Header::openbox('100%', 'center', "$array[$#array] $Lang::tr{'graph'}"); - diskbox($array[$#array]); - &Graphs::makegraphbox("media.cgi",$array[$#array],"day"); - &Header::closebox(); - } +&Header::showhttpheaders(); +&Header::openpage($Lang::tr{'media information'}, 1, ''); +&Header::openbigbox('100%', 'left'); + +foreach (@devices) { + my $device =3D $_; + chomp($device); + my @array =3D split(/\//,$device); + &Header::openbox('100%', 'center', "$array[$#array] $Lang::tr{'graph'}"); + diskbox($array[$#array]); + &Graphs::makegraphbox("media.cgi",$array[$#array],"day"); + &Header::closebox(); +} + =20 -=09 - &Header::openbox('100%', 'center', $Lang::tr{'disk usage'}); - print "\n"; - open(DF,'/bin/df -P -B M -x rootfs|'); - while(){ - if ($_ =3D~ m/^Filesystem/ ){ - print <\n"; +open(DF,'/bin/df -P -B M -x rootfs|'); +while(){ + if ($_ =3D~ m/^Filesystem/ ){ + print < - - - - - - + + + + + + END ; - }else{ - my ($device,$size,$used,$free,$percent,$mount) =3D split; - print < - - - - - - + + + + + + END ; - } } - close DF; - print " - - - - - + + + + + + END ; - }else{ - my ($device,$size,$used,$free,$percent,$mount) =3D split; - print < - - - - - + + + + + END ; - } } - close DF; - my @iostat1 =3D qx(/usr/bin/iostat -dm -p | grep -v "Linux" | awk '{print \= $1}'); - my @iostat2 =3D qx(/usr/bin/iostat -dm -p | grep -v "Linux" | awk '{print \= $5}'); - my @iostat3 =3D qx(/usr/bin/iostat -dm -p | grep -v "Linux" | awk '{print \= $6}'); - print ""; - my $i=3D0; - - for(my $i =3D 1; $i <=3D $#iostat1; $i++){ - if ( $i eq '1' ){ - print ""; - }else{ - print ""; - } +} +close DF; +my @iostat1 =3D qx(/usr/bin/iostat -dm -p | grep -v "Linux" | awk '{print \$= 1}'); +my @iostat2 =3D qx(/usr/bin/iostat -dm -p | grep -v "Linux" | awk '{print \$= 5}'); +my @iostat3 =3D qx(/usr/bin/iostat -dm -p | grep -v "Linux" | awk '{print \$= 6}'); +print ""; +my $i=3D0; + +for(my $i =3D 1; $i <=3D $#iostat1; $i++){ + if ( $i eq '1' ){ + print ""; + }else{ + print ""; } - print "
$Lang::tr{'device'}$Lang::tr{'mounted on'}$Lang::tr{'size'}$Lang::tr{'used'}$Lang::tr{'free'}$Lang::tr{'percentage= '}$Lang::tr{'device'}$Lang::tr{'mounted on'}$Lang::tr{'size'}$Lang::tr{'used'}$Lang::tr{'free'}$Lang::tr{'percentag= e'}
$device$mount$size$used$free + $device$mount$size$used$free END ; - &percentbar($percent); - print < -$percent$percent
 \n

Inodes

\= n"; +} +close DF; +print "
 \n

Inodes

\n= "; =20 - open(DF,'/bin/df -P -i -x rootfs|'); - while(){ - if ($_ =3D~ m/^Filesystem/ ){ - print <){ + if ($_ =3D~ m/^Filesystem/ ){ + print < -
$Lang::tr{'device'}$Lang::tr{'mounted on'}$Lang::tr{'size'}$Lang::tr{'used'}$Lang::tr{'free'}$Lang::tr{'percentage= '}$Lang::tr{'device'}$Lang::tr{'mounted on'}$Lang::tr{'size'}$Lang::tr{'used'}$Lang::tr{'free'}$Lang::tr{'percentag= e'}
$device$mount$size$used$free$device$mount$size$used$free END ; - &percentbar($percent); - print < $percent
 \n

transfers

$Lang::tr{'device'}= $Lang::tr{'MB read'}<= /td>$Lang::tr{'MB written'}
$iostat1[$i]$io= stat2[$i]$iostat3[$i]
 \n

transfers

$Lang::tr{'device'}<= /b>$Lang::tr{'MB read'}$Lang::tr{'MB written'}
$iostat1[$i]$ios= tat2[$i]$iostat3[$i]
\n"; - &Header::closebox(); +} +print "\n"; +&Header::closebox(); =20 - &Header::closebigbox(); - &Header::closepage(); +&Header::closebigbox(); +&Header::closepage(); =20 sub percentbar { diff --git a/html/cgi-bin/memory.cgi b/html/cgi-bin/memory.cgi index 037d5800b..814063dfb 100644 --- a/html/cgi-bin/memory.cgi +++ b/html/cgi-bin/memory.cgi @@ -35,85 +35,85 @@ my %mainsettings =3D (); &General::readhash("${General::swroot}/main/settings", \%mainsettings); &General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", = \%color); =20 - &Header::showhttpheaders(); - &Header::openpage($Lang::tr{'memory information'}, 1, ''); - &Header::openbigbox('100%', 'left'); +&Header::showhttpheaders(); +&Header::openpage($Lang::tr{'memory information'}, 1, ''); +&Header::openbigbox('100%', 'left'); =20 - &Header::openbox('100%', 'center', "Memory $Lang::tr{'graph'}"); - &Graphs::makegraphbox("memory.cgi","memory","day"); +&Header::openbox('100%', 'center', "Memory $Lang::tr{'graph'}"); +&Graphs::makegraphbox("memory.cgi","memory","day"); +&Header::closebox(); + +if (-f "$mainsettings{'RRDLOG'}/collectd/localhost/swap") { + &Header::openbox('100%', 'center', "Swap $Lang::tr{'graph'}"); + &Graphs::makegraphbox("memory.cgi","swap","day"); &Header::closebox(); +} =20 - if (-f "$mainsettings{'RRDLOG'}/collectd/localhost/swap") { - &Header::openbox('100%', 'center', "Swap $Lang::tr{'graph'}"); - &Graphs::makegraphbox("memory.cgi","swap","day"); - &Header::closebox(); - } -=09 - &Header::openbox('100%', 'center', $Lang::tr{'memory'}); - print ""; - my $size=3D0; - my $used=3D0; - my $free=3D0; - my $percent=3D0; - my $shared=3D0; - my $buffers=3D0; - my $cached=3D0; - my $available=3D0; +&Header::openbox('100%', 'center', $Lang::tr{'memory'}); +print "
"; +my $size=3D0; +my $used=3D0; +my $free=3D0; +my $percent=3D0; +my $shared=3D0; +my $buffers=3D0; +my $cached=3D0; +my $available=3D0; =20 - # output format: kibibytes, wide mode (buffers and cache in two columns) - open(my $cmd_fh, "-|", '/usr/bin/free -k -w') or die $!; - while(<$cmd_fh>){ - if ($_ =3D~ m/^\s+total\s+used\s+free\s+shared\s+buffers\s+cache\s+availab= le$/ ){ - print <){ + if ($_ =3D~ m/^\s+total\s+used\s+free\s+shared\s+buffers\s+cache\s+availabl= e$/ ){ + print < - - - - - + + + + + END ; - }else{ - if ($_ =3D~ m/^Mem:\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d= +)$/){ - ($size,$used,$free,$shared,$buffers,$cached,$available) =3D ($1,$2,$3,$4= ,$5,$6,$7); - ($percent =3D ($used/$size)*100) =3D~ s/^(\d+)(\.\d+)?$/$1%/; - print < - + END ; - }elsif($_ =3D~ m/^Swap:\s+(\d+)\s+(\d+)\s+(\d+)$/){ - ($size,$used,$free) =3D ($1,$2,$3); - if ($size !=3D 0){ - ($percent =3D ($used/$size)*100) =3D~ s/^(\d+)(\.\d+)?$/$1%/; - }else{ - ($percent =3D ''); - } - print < - + END ; - } - print <$size KiB - - - + + + + END ; - } } - close($cmd_fh); - print < @@ -122,10 +122,10 @@ END
 $Lang::tr{'size'}$Lang::tr{'used'}$Lang::tr{'free'}$Lang::tr{'percentage= '} $Lang::tr{'size'}$Lang::tr{'used'}$Lang::tr{'free'}$Lang::tr{'percentag= e'}
$Lang::tr{'ram'}$Lang::tr{'ram'}$Lang::tr{'swap'}$Lang::tr{'swap'}$used KiB$free KiB + } + print <$size KiB$used KiB$free KiB END ; - &percentbar($percent); - print < -$percent$percent

$Lang::tr{'shared'}$shared KiB
$Lang::tr{'buffers'}$buffers KiB
END ; - &Header::closebox(); +&Header::closebox(); =20 - &Header::closebigbox(); - &Header::closepage(); +&Header::closebigbox(); +&Header::closepage(); =20 sub percentbar{ my $percent =3D $_[0]; diff --git a/html/cgi-bin/netexternal.cgi b/html/cgi-bin/netexternal.cgi index 704cd8727..cc5667044 100644 --- a/html/cgi-bin/netexternal.cgi +++ b/html/cgi-bin/netexternal.cgi @@ -43,113 +43,113 @@ my %netsettings=3D(); my @graphs=3D(); my %dhcpinfo=3D(); =20 - &Header::showhttpheaders(); - &Header::openpage($Lang::tr{'network traffic graphs external'}, 1, ''); - &Header::openbigbox('100%', 'left'); +&Header::showhttpheaders(); +&Header::openpage($Lang::tr{'network traffic graphs external'}, 1, ''); +&Header::openbigbox('100%', 'left'); =20 - if ($netsettings{'RED_TYPE'} ne 'PPPOE'){ - if ($netsettings{'RED_DEV'} ne $netsettings{'GREEN_DEV'}){ - push (@graphs, ($netsettings{'RED_DEV'})); - } - }else{ - push (@graphs, "ppp0"); - } -=09 - 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{'RED_TYPE'} ne 'PPPOE'){ + if ($netsettings{'RED_DEV'} ne $netsettings{'GREEN_DEV'}){ + push (@graphs, ($netsettings{'RED_DEV'})); } - - if ( $netsettings{'CONFIG_TYPE'} =3D~ /^(1|2|3|4)$/ && $netsettings{'RED_T= YPE'} 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, $DNS2) =3D split(/ /, $dhcpinfo{'domain_name_servers'}); - - my $lsetme=3D0; - my $leasetime=3D""; - if ($dhcpinfo{'dhcp_lease_time'} ne "") { - $lsetme=3D$dhcpinfo{'dhcp_lease_time'}; - $lsetme=3D($lsetme/60); - =09 - if ($lsetme > 59) { - $lsetme=3D($lsetme/60); $leasetime=3D$lsetme." Hour"; - }else{ - $leasetime=3D$lsetme." Minute"; - } - =09 - if ($lsetme > 1) { - $leasetime=3D$leasetime."s"; - } +}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'} =3D~ /^(1|2|3|4)$/ && $netsettings{'RED_TY= PE'} 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, $DNS2) =3D split(/ /, $dhcpinfo{'domain_name_servers'}); + + my $lsetme=3D0; + my $leasetime=3D""; + if ($dhcpinfo{'dhcp_lease_time'} ne "") { + $lsetme=3D$dhcpinfo{'dhcp_lease_time'}; + $lsetme=3D($lsetme/60); + =09 + if ($lsetme > 59) { + $lsetme=3D($lsetme/60); $leasetime=3D$lsetme." Hour"; + }else{ + $leasetime=3D$lsetme." Minute"; } + =09 + if ($lsetme > 1) { + $leasetime=3D$leasetime."s"; + } + } =20 - my $rentme=3D0; - my $rnwltime=3D""; - - if ($dhcpinfo{'dhcp_renewal_time'} ne "") { - $rentme=3D$dhcpinfo{'dhcp_renewal_time'}; - $rentme=3D($rentme/60); - =09 - if ($rentme > 59){ - $rentme=3D($rentme/60); $rnwltime=3D$rentme." Hour"; - }else{ - $rnwltime=3D$rentme." Minute"; - } - =09 - if ($rentme > 1){ - $rnwltime=3D$rnwltime."s"; - } + my $rentme=3D0; + my $rnwltime=3D""; + + if ($dhcpinfo{'dhcp_renewal_time'} ne "") { + $rentme=3D$dhcpinfo{'dhcp_renewal_time'}; + $rentme=3D($rentme/60); + =09 + if ($rentme > 59){ + $rentme=3D($rentme/60); $rnwltime=3D$rentme." Hour"; + }else{ + $rnwltime=3D$rentme." Minute"; } + =09 + if ($rentme > 1){ + $rnwltime=3D$rnwltime."s"; + } + } =20 - my $maxtme=3D0; - my $maxtime=3D""; + my $maxtme=3D0; + my $maxtime=3D""; =20 - if ($dhcpinfo{'dhcp_rebinding_time'} ne "") { - $maxtme=3D$dhcpinfo{'dhcp_rebinding_time'}; - $maxtme=3D($maxtme/60); + if ($dhcpinfo{'dhcp_rebinding_time'} ne "") { + $maxtme=3D$dhcpinfo{'dhcp_rebinding_time'}; + $maxtme=3D($maxtme/60); =20 - if ($maxtme > 59){ - $maxtme=3D($maxtme/60); $maxtime=3D$maxtme." Hour"; - } else { - $maxtime=3D$maxtme." Minute"; - } + if ($maxtme > 59){ + $maxtme=3D($maxtme/60); $maxtime=3D$maxtme." Hour"; + } else { + $maxtime=3D$maxtme." Minute"; + } =20 - if ($maxtme > 1) { - $maxtime=3D$maxtime."s"; - } + if ($maxtme > 1) { + $maxtime=3D$maxtime."s"; } + } =20 =20 - print < -$Lang::tr{'domain'}$dhcpinfo{'domain_name'} -$Lang::tr{'gateway'}$dhcpinfo{'routers'} -$Lang::tr{'primary dns'}$DNS1 -$Lang::tr{'secondary dns'}$DNS2 -$Lang::tr{'dhcp server'}$dhcpinfo{'dhcp_server_identifier'}= -$Lang::tr{'def lease time'}$leasetime -$Lang::tr{'default renewal time'}$rnwltime -$Lang::tr{'max renewal time'}$maxtime + $Lang::tr{'domain'}$dhcpinfo{'domain_name'}<= /td> + $Lang::tr{'gateway'}$dhcpinfo{'routers'} + $Lang::tr{'primary dns'}$DNS1 + $Lang::tr{'secondary dns'}$DNS2 + $Lang::tr{'dhcp server'}$dhcpinfo{'dhcp_server_identifier'= } + $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(); + }else{ + print "$Lang::tr{'no dhcp lease'}"; } + &Header::closebox(); +} =20 - &Header::closebigbox(); - &Header::closepage(); +&Header::closebigbox(); +&Header::closepage(); diff --git a/html/cgi-bin/netinternal.cgi b/html/cgi-bin/netinternal.cgi index 8d7105e36..472f61efe 100644 --- a/html/cgi-bin/netinternal.cgi +++ b/html/cgi-bin/netinternal.cgi @@ -40,31 +40,31 @@ my %netsettings=3D(); my @graphs=3D(); my @wireless=3D(); =20 - &Header::showhttpheaders(); - &Header::openpage($Lang::tr{'network traffic graphs internal'}, 1, ''); - &Header::openbigbox('100%', 'left'); +&Header::showhttpheaders(); +&Header::openpage($Lang::tr{'network traffic graphs internal'}, 1, ''); +&Header::openbigbox('100%', 'left'); =20 - push (@graphs, ($netsettings{'GREEN_DEV'})); - if (&Header::blue_used() && $netsettings{'BLUE_DEV'}) {push (@graphs, ($net= settings{'BLUE_DEV'})); } - if (&Header::orange_used() && $netsettings{'ORANGE_DEV'}) {push (@graphs, (= $netsettings{'ORANGE_DEV'})); } +push (@graphs, ($netsettings{'GREEN_DEV'})); +if (&Header::blue_used() && $netsettings{'BLUE_DEV'}) {push (@graphs, ($nets= ettings{'BLUE_DEV'})); } +if (&Header::orange_used() && $netsettings{'ORANGE_DEV'}) {push (@graphs, ($= netsettings{'ORANGE_DEV'})); } =20 - my @wirelessgraphs =3D `ls -dA /var/log/rrd/collectd/localhost/wireless* 2>= /dev/null`; - foreach (@wirelessgraphs){ - $_ =3D~ /(.*)\/wireless-(.*)/; - push(@wireless,$2); - } +my @wirelessgraphs =3D `ls -dA /var/log/rrd/collectd/localhost/wireless* 2>/= dev/null`; +foreach (@wirelessgraphs){ + $_ =3D~ /(.*)\/wireless-(.*)/; + push(@wireless,$2); +} =20 - foreach (@graphs) { - &Header::openbox('100%', 'center', "$_ $Lang::tr{'graph'}"); - &Graphs::makegraphbox("netinternal.cgi",$_,"day"); - &Header::closebox(); - } +foreach (@graphs) { + &Header::openbox('100%', 'center', "$_ $Lang::tr{'graph'}"); + &Graphs::makegraphbox("netinternal.cgi",$_,"day"); + &Header::closebox(); +} =20 - foreach (@wireless) { - &Header::openbox('100%', 'center', "Wireless $_ $Lang::tr{'graph'}"); - &Graphs::makegraphbox("netinternal.cgi","wireless".$_,"day"); - &Header::closebox(); - } +foreach (@wireless) { + &Header::openbox('100%', 'center', "Wireless $_ $Lang::tr{'graph'}"); + &Graphs::makegraphbox("netinternal.cgi","wireless".$_,"day"); + &Header::closebox(); +} =20 - &Header::closebigbox(); - &Header::closepage(); +&Header::closebigbox(); +&Header::closepage(); diff --git a/html/cgi-bin/netother.cgi b/html/cgi-bin/netother.cgi index c1d6a64a0..667777153 100755 --- a/html/cgi-bin/netother.cgi +++ b/html/cgi-bin/netother.cgi @@ -37,51 +37,51 @@ my %mainsettings =3D (); =20 my @pings=3D(); =20 - &Header::showhttpheaders(); - &Header::openpage($Lang::tr{'network traffic graphs others'}, 1, ''); - &Header::openbigbox('100%', 'left'); -=09 - my @pinggraphs =3D `ls -dA /var/log/rrd/collectd/localhost/ping/ping-*`; - foreach (@pinggraphs){ - $_ =3D~ /(.*)\/ping\/ping-(.*)\.rrd/; - push(@pings,$2); - } +&Header::showhttpheaders(); +&Header::openpage($Lang::tr{'network traffic graphs others'}, 1, ''); +&Header::openbigbox('100%', 'left'); =20 - foreach (@pings) { - &Header::openbox('100%', 'center', "$_ $Lang::tr{'graph'}"); - &Graphs::makegraphbox("netother.cgi",$_,"day"); - &Header::closebox(); - } +my @pinggraphs =3D `ls -dA /var/log/rrd/collectd/localhost/ping/ping-*`; +foreach (@pinggraphs){ + $_ =3D~ /(.*)\/ping\/ping-(.*)\.rrd/; + push(@pings,$2); +} =20 - &Header::openbox('100%', 'center', "$Lang::tr{'connection tracking'}"); - &Graphs::makegraphbox("netother.cgi", "conntrack", "day"); +foreach (@pings) { + &Header::openbox('100%', 'center', "$_ $Lang::tr{'graph'}"); + &Graphs::makegraphbox("netother.cgi",$_,"day"); &Header::closebox(); +} =20 - &Header::openbox('100%', 'center', "$Lang::tr{'firewallhits'} $Lang::tr{'gr= aph'}"); - &Graphs::makegraphbox("netother.cgi","fwhits","day"); - &Header::closebox(); +&Header::openbox('100%', 'center', "$Lang::tr{'connection tracking'}"); +&Graphs::makegraphbox("netother.cgi", "conntrack", "day"); +&Header::closebox(); =20 - my $output =3D ''; -=09 - &Header::openbox('100%', 'left', $Lang::tr{'routing table entries'}); - $output =3D `/sbin/ip route show`; - $output =3D &Header::cleanhtml($output,"y"); - print "
$output
\n"; - &Header::closebox(); +&Header::openbox('100%', 'center', "$Lang::tr{'firewallhits'} $Lang::tr{'gra= ph'}"); +&Graphs::makegraphbox("netother.cgi","fwhits","day"); +&Header::closebox(); =20 - $output =3D `/sbin/ip route list table 220`; - if ( $output ) { - &Header::openbox('100%', 'left', $Lang::tr{'ipsec routing table entries'}); - $output =3D &Header::cleanhtml($output,"y"); - print "
$output
\n"; - &Header::closebox() - } +my $output =3D ''; =20 - &Header::openbox('100%', 'left', $Lang::tr{'arp table entries'}); - $output =3D `/sbin/ip neigh show`; +&Header::openbox('100%', 'left', $Lang::tr{'routing table entries'}); +$output =3D `/sbin/ip route show`; +$output =3D &Header::cleanhtml($output,"y"); +print "
$output
\n"; +&Header::closebox(); + +$output =3D `/sbin/ip route list table 220`; +if ( $output ) { + &Header::openbox('100%', 'left', $Lang::tr{'ipsec routing table entries'}); $output =3D &Header::cleanhtml($output,"y"); print "
$output
\n"; - &Header::closebox(); + &Header::closebox() +} + +&Header::openbox('100%', 'left', $Lang::tr{'arp table entries'}); +$output =3D `/sbin/ip neigh show`; +$output =3D &Header::cleanhtml($output,"y"); +print "
$output
\n"; +&Header::closebox(); =20 - &Header::closebigbox(); - &Header::closepage(); +&Header::closebigbox(); +&Header::closepage(); diff --git a/html/cgi-bin/netovpnrw.cgi b/html/cgi-bin/netovpnrw.cgi index fc2e43508..5014f9a55 100755 --- a/html/cgi-bin/netovpnrw.cgi +++ b/html/cgi-bin/netovpnrw.cgi @@ -37,26 +37,26 @@ my %mainsettings =3D (); =20 my @vpns=3D(); =20 - &Header::showhttpheaders(); - &Header::openpage($Lang::tr{'vpn statistic rw'}, 1, ''); - &Header::openbigbox('100%', 'left'); +&Header::showhttpheaders(); +&Header::openpage($Lang::tr{'vpn statistic rw'}, 1, ''); +&Header::openbigbox('100%', 'left'); =20 - my @vpngraphs =3D `find /var/log/rrd/collectd/localhost/openvpn-*/ -not -p= ath *openvpn-UNDEF* -not -path *openvpn-*n2n* -name *.rrd 2>/dev/null|sort`; - foreach (@vpngraphs){ - if($_ =3D~ /(.*)\/openvpn-(.*)\/if_octets_derive.rrd/){ - push(@vpns,$2); - } +my @vpngraphs =3D `find /var/log/rrd/collectd/localhost/openvpn-*/ -not -pa= th *openvpn-UNDEF* -not -path *openvpn-*n2n* -name *.rrd 2>/dev/null|sort`; +foreach (@vpngraphs){ + if($_ =3D~ /(.*)\/openvpn-(.*)\/if_octets_derive.rrd/){ + push(@vpns,$2); } - if(@vpns){ - foreach (@vpns) { - &Header::openbox('100%', 'center', "$_ $Lang::tr{'graph'}"); - &Graphs::makegraphbox("netovpnrw.cgi",$_, "day"); - &Header::closebox(); - } - }else{ - print "
".$Lang::tr{'no data'}."
"; +} +if(@vpns){ + foreach (@vpns) { + &Header::openbox('100%', 'center', "$_ $Lang::tr{'graph'}"); + &Graphs::makegraphbox("netovpnrw.cgi",$_, "day"); + &Header::closebox(); } - my $output =3D ''; +}else{ + print "
".$Lang::tr{'no data'}."
"; +} +my $output =3D ''; =20 - &Header::closebigbox(); - &Header::closepage(); +&Header::closebigbox(); +&Header::closepage(); diff --git a/html/cgi-bin/netovpnsrv.cgi b/html/cgi-bin/netovpnsrv.cgi index 6ff6e17fe..1fb66e7a4 100755 --- a/html/cgi-bin/netovpnsrv.cgi +++ b/html/cgi-bin/netovpnsrv.cgi @@ -49,32 +49,32 @@ foreach my $key (sort {$vpnsettings{$a}[1] <=3D> $vpnsett= ings{$b}[1]} keys %vpnset $ipsecgraphs{$vpnsettings{$key}[1]} =3D "${interface_mode}${key}"; } =20 - &Header::showhttpheaders(); - &Header::openpage($Lang::tr{'vpn statistic n2n'}, 1, ''); - &Header::openbigbox('100%', 'left'); +&Header::showhttpheaders(); +&Header::openpage($Lang::tr{'vpn statistic n2n'}, 1, ''); +&Header::openbigbox('100%', 'left'); =20 - my @vpngraphs =3D `find /var/log/rrd/collectd/localhost/openvpn-*-n2n/ -not= -path *openvpn-UNDEF* -name *traffic.rrd 2>/dev/null|sort`; - foreach (@vpngraphs){ - if($_ =3D~ /(.*)\/openvpn-(.*)\/if_octets_derive-traffic.rrd/){ - push(@vpns,$2); - } +my @vpngraphs =3D `find /var/log/rrd/collectd/localhost/openvpn-*-n2n/ -not = -path *openvpn-UNDEF* -name *traffic.rrd 2>/dev/null|sort`; +foreach (@vpngraphs){ + if($_ =3D~ /(.*)\/openvpn-(.*)\/if_octets_derive-traffic.rrd/){ + push(@vpns,$2); + } +} +if (@vpns || %ipsecgraphs) { + foreach my $name (sort keys %ipsecgraphs) { + &Header::openbox('100%', 'center', "$Lang::tr{'ipsec connection'}: $name"); + &Graphs::makegraphbox("netovpnsrv.cgi", "ipsec-$ipsecgraphs{$name}", "day"= ); + &Header::closebox(); } - if (@vpns || %ipsecgraphs) { - foreach my $name (sort keys %ipsecgraphs) { - &Header::openbox('100%', 'center', "$Lang::tr{'ipsec connection'}: $name"= ); - &Graphs::makegraphbox("netovpnsrv.cgi", "ipsec-$ipsecgraphs{$name}", "day= "); - &Header::closebox(); - } =20 - foreach (@vpns) { - &Header::openbox('100%', 'center', "$_ $Lang::tr{'graph'}"); - &Graphs::makegraphbox("netovpnsrv.cgi",$_, "day"); - &Header::closebox(); - } - }else{ - print "
".$Lang::tr{'no data'}."
"; + foreach (@vpns) { + &Header::openbox('100%', 'center', "$_ $Lang::tr{'graph'}"); + &Graphs::makegraphbox("netovpnsrv.cgi",$_, "day"); + &Header::closebox(); } - my $output =3D ''; +}else{ + print "
".$Lang::tr{'no data'}."
"; +} +my $output =3D ''; =20 - &Header::closebigbox(); - &Header::closepage(); +&Header::closebigbox(); +&Header::closepage(); diff --git a/html/cgi-bin/qos.cgi b/html/cgi-bin/qos.cgi index 3410c7353..1a0354ed0 100644 --- a/html/cgi-bin/qos.cgi +++ b/html/cgi-bin/qos.cgi @@ -111,10 +111,10 @@ my %mainsettings =3D (); &General::readhash("${General::swroot}/main/settings", \%mainsettings); &General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", = \%color); =20 - &Header::showhttpheaders(); +&Header::showhttpheaders(); =20 - &Header::openpage('QoS', 1, ''); - &Header::openbigbox('100%', 'left', '', $errormessage); +&Header::openpage('QoS', 1, ''); +&Header::openbigbox('100%', 'left', '', $errormessage); =20 ############################################################################= ################################################ ############################################################################= ################################################ @@ -699,12 +699,12 @@ if ( ($qossettings{'DEFCLASS_INC'} eq '') || ($qossetti= ngs{'DEFCLASS_OUT'} eq '' exit } =20 - &Header::openbox('100%', 'center', "$qossettings{'RED_DEV'} $Lang::tr{'grap= h'}, $Lang::tr{'uplink'}"); - &Graphs::makegraphbox("qos.cgi",$qossettings{'RED_DEV'},"hour"); - &Header::closebox(); - &Header::openbox('100%', 'center', "$qossettings{'IMQ_DEV'} $Lang::tr{'grap= h'}, $Lang::tr{'downlink'}"); - &Graphs::makegraphbox("qos.cgi",$qossettings{'IMQ_DEV'},"hour"); - &Header::closebox(); +&Header::openbox('100%', 'center', "$qossettings{'RED_DEV'} $Lang::tr{'graph= '}, $Lang::tr{'uplink'}"); +&Graphs::makegraphbox("qos.cgi",$qossettings{'RED_DEV'},"hour"); +&Header::closebox(); +&Header::openbox('100%', 'center', "$qossettings{'IMQ_DEV'} $Lang::tr{'graph= '}, $Lang::tr{'downlink'}"); +&Graphs::makegraphbox("qos.cgi",$qossettings{'IMQ_DEV'},"hour"); +&Header::closebox(); =20 &showclasses($qossettings{'RED_DEV'}); &showclasses($qossettings{'IMQ_DEV'}); diff --git a/html/cgi-bin/system.cgi b/html/cgi-bin/system.cgi index 595ca0eab..c1da5f536 100644 --- a/html/cgi-bin/system.cgi +++ b/html/cgi-bin/system.cgi @@ -35,23 +35,23 @@ my %mainsettings =3D (); &General::readhash("${General::swroot}/main/settings", \%mainsettings); &General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", = \%color); =20 - &Header::showhttpheaders(); - &Header::openpage($Lang::tr{'status information'}, 1, ''); - &Header::openbigbox('100%', 'left'); +&Header::showhttpheaders(); +&Header::openpage($Lang::tr{'status information'}, 1, ''); +&Header::openbigbox('100%', 'left'); =20 - &Header::openbox('100%', 'center', "CPU $Lang::tr{'graph'}"); - &Graphs::makegraphbox("system.cgi","cpu","day"); - &Header::closebox(); - - if ( -e "$mainsettings{'RRDLOG'}/collectd/localhost/cpufreq/cpufreq-0.rrd"){ - &Header::openbox('100%', 'center', "$Lang::tr{'cpu frequency'} $Lang::tr{'= graph'}"); - &Graphs::makegraphbox("system.cgi","cpufreq","day"); - &Header::closebox(); - } +&Header::openbox('100%', 'center', "CPU $Lang::tr{'graph'}"); +&Graphs::makegraphbox("system.cgi","cpu","day"); +&Header::closebox(); =20 - &Header::openbox('100%', 'center', "$Lang::tr{'uptime load average'} $Lang:= :tr{'graph'}"); - &Graphs::makegraphbox("system.cgi","load","day"); +if ( -e "$mainsettings{'RRDLOG'}/collectd/localhost/cpufreq/cpufreq-0.rrd"){ + &Header::openbox('100%', 'center', "$Lang::tr{'cpu frequency'} $Lang::tr{'g= raph'}"); + &Graphs::makegraphbox("system.cgi","cpufreq","day"); &Header::closebox(); +} + +&Header::openbox('100%', 'center', "$Lang::tr{'uptime load average'} $Lang::= tr{'graph'}"); +&Graphs::makegraphbox("system.cgi","load","day"); +&Header::closebox(); =20 - &Header::closebigbox(); - &Header::closepage(); +&Header::closebigbox(); +&Header::closepage(); --=20 2.27.0.windows.1 --===============8927000566993749703==--