mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
avoid div by 0 error while scanning networks with no hosts
This commit is contained in:
parent
4815dce8aa
commit
694d82e522
@ -1502,27 +1502,30 @@ sub PandoraFMS::Recon::Base::apply_monitoring($) {
|
|||||||
|
|
||||||
my @hosts = keys %{$self->{'agents_found'}};
|
my @hosts = keys %{$self->{'agents_found'}};
|
||||||
|
|
||||||
$self->{'step'} = STEP_MONITORING;
|
if (scalar @hosts > 0) {
|
||||||
# From 80% to 90%.
|
$self->{'step'} = STEP_MONITORING;
|
||||||
my ($progress, $step) = (80, 10.0 / scalar(@hosts));
|
# From 80% to 90%.
|
||||||
my ($partial, $sub_step) = (0, 100 / scalar(@hosts));
|
my ($progress, $step) = (80, 10.0 / scalar(@hosts));
|
||||||
|
my ($partial, $sub_step) = (0, 100 / scalar(@hosts));
|
||||||
|
|
||||||
foreach my $label (keys %{$self->{'agents_found'}}) {
|
foreach my $label (keys %{$self->{'agents_found'}}) {
|
||||||
$self->{'c_network_percent'} = $partial;
|
$self->{'c_network_percent'} = $partial;
|
||||||
$self->{'c_network_name'} = $label;
|
$self->{'c_network_name'} = $label;
|
||||||
$self->call('update_progress', $progress);
|
$self->call('update_progress', $progress);
|
||||||
$progress += $step;
|
$progress += $step;
|
||||||
$partial += $sub_step;
|
$partial += $sub_step;
|
||||||
$self->call('message', "Checking modules for $label", 5);
|
$self->call('message', "Checking modules for $label", 5);
|
||||||
|
|
||||||
# Monitorization selected.
|
# Monitorization selected.
|
||||||
$self->call('create_network_profile_modules', $label);
|
$self->call('create_network_profile_modules', $label);
|
||||||
|
|
||||||
# Monitorization - interfaces
|
# Monitorization - interfaces
|
||||||
$self->call('create_interface_modules', $label);
|
$self->call('create_interface_modules', $label);
|
||||||
|
|
||||||
# Monitorization - WMI modules.
|
# Monitorization - WMI modules.
|
||||||
$self->call('create_wmi_modules', $label);
|
$self->call('create_wmi_modules', $label);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user