avoid div by 0 error while scanning networks with no hosts

This commit is contained in:
fbsanchez 2020-05-13 12:37:08 +02:00
parent 4815dce8aa
commit 694d82e522

View File

@ -1502,6 +1502,7 @@ sub PandoraFMS::Recon::Base::apply_monitoring($) {
my @hosts = keys %{$self->{'agents_found'}}; my @hosts = keys %{$self->{'agents_found'}};
if (scalar @hosts > 0) {
$self->{'step'} = STEP_MONITORING; $self->{'step'} = STEP_MONITORING;
# From 80% to 90%. # From 80% to 90%.
my ($progress, $step) = (80, 10.0 / scalar(@hosts)); my ($progress, $step) = (80, 10.0 / scalar(@hosts));
@ -1526,6 +1527,8 @@ sub PandoraFMS::Recon::Base::apply_monitoring($) {
} }
}
$self->{'c_network_percent'} = 100; $self->{'c_network_percent'} = 100;
$self->call('update_progress', $progress); $self->call('update_progress', $progress);
} }