diff --git a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm index c97a393422..eef7fa85f0 100644 --- a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm +++ b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm @@ -459,8 +459,8 @@ sub PandoraFMS::Recon::Base::create_agents($$) { $agent_id = pandora_create_agent( $pa_config, $pa_config->{'servername'}, $agent->{'agent_name'}, $agent->{'address'}, $agent->{'id_group'}, $parent_id, - $agent->{'os'}, $agent->{'description'}, $agent->{'interval'}, - $dbh, $agent->{'timezone_offset'} + get_os_id($dbh, $agent->{'os'}), $agent->{'description'}, + $agent->{'interval'}, $dbh, $agent->{'timezone_offset'} ); $current_agent = $parent_id = PandoraFMS::Core::locate_agent( diff --git a/pandora_server/lib/PandoraFMS/Recon/Base.pm b/pandora_server/lib/PandoraFMS/Recon/Base.pm index 2b04dab950..df00c10951 100644 --- a/pandora_server/lib/PandoraFMS/Recon/Base.pm +++ b/pandora_server/lib/PandoraFMS/Recon/Base.pm @@ -1475,6 +1475,8 @@ sub db_scan($) { }; } else { + my $dbObjCfg = $dbObj->get_config(); + $self->{'summary'}->{'discovered'} += 1; $self->{'summary'}->{'alive'} += 1; @@ -1499,10 +1501,26 @@ sub db_scan($) { push @modules, $dbObj->get_statistics(); $self->call('update_progress', 50); - # Custom queries. push @modules, $dbObj->execute_custom_queries(); $self->call('update_progress', 90); + + if (defined($dbObjCfg->{'scan_databases'}) + && $dbObjCfg->{'scan_databases'} == 1) { + my $__data = $dbObj->scan_databases(); + + if (ref($__data) eq "ARRAY") { + if (defined($dbObjCfg->{'agent_per_database'}) + && $dbObjCfg->{'agent_per_database'} == 1) { + # Agent per database detected. + push @data, @{$__data}; + } else { + # Merge modules into engine agent. + my @_modules = map { $_->{'module_data'} } @{$__data}; + push @modules, @_modules; + } + } + } } # Put engine agent at the beginning of the list.