mirror of https://github.com/mikaku/Monitorix.git
make function 'flush_accounting_rules' aware of this new option
This commit is contained in:
parent
cfabc3ce41
commit
86bcee0fc3
|
@ -334,7 +334,13 @@ sub flush_accounting_rules {
|
|||
my @rules;
|
||||
while(<IN>) {
|
||||
my ($rule, undef, undef, $name) = split(' ', $_);
|
||||
if($name =~ /monitorix_IN/ || /monitorix_OUT/ || /monitorix_nginx_IN/) {
|
||||
if(lc($config->{port}->{use_external_firewall} || "") eq "n") {
|
||||
if($name =~ /monitorix_IN/ || /monitorix_OUT/) {
|
||||
push(@rules, $rule);
|
||||
push(@names, $name);
|
||||
}
|
||||
}
|
||||
if($name =~ /monitorix_nginx_IN/) {
|
||||
push(@rules, $rule);
|
||||
push(@names, $name);
|
||||
}
|
||||
|
@ -350,7 +356,12 @@ sub flush_accounting_rules {
|
|||
my @rules;
|
||||
while(<IN>) {
|
||||
my ($rule, undef, undef, $name) = split(' ', $_);
|
||||
if($name =~ /monitorix_IN/ || /monitorix_OUT/ || /monitorix_nginx_IN/) {
|
||||
if(lc($config->{port}->{use_external_firewall} || "") eq "n") {
|
||||
if($name =~ /monitorix_IN/ || /monitorix_OUT/) {
|
||||
push(@rules, $rule);
|
||||
}
|
||||
}
|
||||
if($name =~ /monitorix_nginx_IN/) {
|
||||
push(@rules, $rule);
|
||||
}
|
||||
}
|
||||
|
@ -372,7 +383,13 @@ sub flush_accounting_rules {
|
|||
my @rules;
|
||||
while(<IN>) {
|
||||
my ($rule, undef, undef, $name) = split(' ', $_);
|
||||
if($name =~ /monitorix_IN/ || /monitorix_OUT/ || /monitorix_nginx_IN/) {
|
||||
if(lc($config->{port}->{use_external_firewall} || "") eq "n") {
|
||||
if($name =~ /monitorix_IN/ || /monitorix_OUT/) {
|
||||
push(@rules, $rule);
|
||||
push(@names, $name);
|
||||
}
|
||||
}
|
||||
if($name =~ /monitorix_nginx_IN/) {
|
||||
push(@rules, $rule);
|
||||
push(@names, $name);
|
||||
}
|
||||
|
@ -388,7 +405,12 @@ sub flush_accounting_rules {
|
|||
my @rules;
|
||||
while(<IN>) {
|
||||
my ($rule, undef, undef, $name) = split(' ', $_);
|
||||
if($name =~ /monitorix_IN/ || /monitorix_OUT/ || /monitorix_nginx_IN/) {
|
||||
if(lc($config->{port}->{use_external_firewall} || "") eq "n") {
|
||||
if($name =~ /monitorix_IN/ || /monitorix_OUT/) {
|
||||
push(@rules, $rule);
|
||||
}
|
||||
}
|
||||
if($name =~ /monitorix_nginx_IN/) {
|
||||
push(@rules, $rule);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,11 +129,6 @@ sub port_init {
|
|||
logger("$myself: WARNING: 'max' option indicates less ports than really defined in 'list'.");
|
||||
}
|
||||
|
||||
# initialize to 'n' (default) the option 'use_external_firewall'
|
||||
if(!$port->{use_external_firewall}) {
|
||||
$port->{use_external_firewall} = "n";
|
||||
}
|
||||
|
||||
if(lc($port->{use_external_firewall} || "") eq "n") {
|
||||
if($config->{os} eq "Linux") {
|
||||
my $num;
|
||||
|
|
|
@ -671,6 +671,9 @@ if(!$config{multihost}->{default_option_when_all}) {
|
|||
logger("WARNING: the 'default_option_when_all' option is not valid or doesn't exist. Please consider upgrading your configuration file.");
|
||||
$config{multihost}->{default_option_when_all} = "System load";
|
||||
}
|
||||
if(!$config{port}->{use_external_firewall}) { # initialize to 'n' by default
|
||||
$config{port}->{use_external_firewall} = "n";
|
||||
}
|
||||
|
||||
# make sure that there aren't residual Monitorix iptables rules
|
||||
flush_accounting_rules(\%config, $options{d});
|
||||
|
|
Loading…
Reference in New Issue