fixed to make sure that a maximum of 9 values is accepted in the 'graph_0' and 'graph_1' options of 'squid.pm'; warn user otherwise. #235

This commit is contained in:
Jordi Sanfeliu 2019-04-17 09:49:01 +02:00
parent cf0b766b36
commit 5ff7f1bda4
2 changed files with 21 additions and 5 deletions

View File

@ -4,11 +4,13 @@
- Added a warning if a process vanished during the accouting in 'process.pm'
- Fixed the copyright year in 'monitorix.cgi'.
- Fixed in 'mail.pm to use the option 'mail_log' instead the hard coded path I
forgot to remove when adding the Exim support.
forgot to remove when adding the Exim support.
(thanks to Jean-Marc Didelot, jm.didelot AT teraneo.fr for pointing this out)
- Fixed to support to show the usage and disk I/O on filesystem names that
contain spaces. [#234]
- Fixed to ensure that the 'L' option in port.pm is optional.
- Fixed to make sure that a maximum of 9 values is accepted in the 'graph_0'
and 'graph_1' options of 'squid.pm'; warn user otherwise. [#235]
3.11.0 - 14-Mar-2019

View File

@ -228,16 +228,30 @@ sub squid_update {
}
}
close(IN);
foreach my $code (my @sl = split(',', $squid->{graph_0})) {
$code = trim($code);
my @sl = split(',', $squid->{graph_0});
if(scalar(@sl) > 9) {
logger("$myself: WARNING: a maximum of 9 values is allowed in 'graph_0' option.");
}
for($n = 0; $n < 9 && $sl[$n]; $n++) {
my $code = trim($sl[$n]);
$rrdata .= ":";
$rrdata .= defined($g12{$code}) ? int($g12{$code}) : 0;
}
foreach my $code (my @sl = split(',', $squid->{graph_1})) {
$code = trim($code);
for(; $n < 9; $n++) {
$rrdata .= ":0";
}
@sl = split(',', $squid->{graph_0});
if(scalar(@sl) > 9) {
logger("$myself: WARNING: a maximum of 9 values is allowed in 'graph_1' option.");
}
for($n = 0; $n < 9 && $sl[$n]; $n++) {
my $code = trim($sl[$n]);
$rrdata .= ":";
$rrdata .= defined($g12{$code}) ? int($g12{$code}) : 0;
}
for(; $n < 9; $n++) {
$rrdata .= ":0";
}
$config->{squid_hist}->{'seek_pos'} = $logsize;
open(IN, "$squid->{cmd} mgr:counters |");