wip discovery f34
Former-commit-id: bb08450d3304ff140c4bae37e77b20a2329c600b
This commit is contained in:
parent
9e83f139e1
commit
fcafe76943
|
@ -420,7 +420,7 @@ sub PandoraFMS::Recon::Base::connect_agents($$$$$) {
|
||||||
|
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# Create agents from db_scan.
|
# Create agents from db_scan. Uses DataServer methods.
|
||||||
# data = [
|
# data = [
|
||||||
# 'agent_data' => {},
|
# 'agent_data' => {},
|
||||||
# 'module_data' => []
|
# 'module_data' => []
|
||||||
|
@ -494,9 +494,10 @@ sub PandoraFMS::Recon::Base::create_agents($$) {
|
||||||
# Add modules.
|
# Add modules.
|
||||||
if (ref($modules) eq "ARRAY") {
|
if (ref($modules) eq "ARRAY") {
|
||||||
foreach my $module (@{$modules}) {
|
foreach my $module (@{$modules}) {
|
||||||
|
# Translate data structure to simulate XML parser return.
|
||||||
my %data_translated = map { $_ => [ $module->{$_} ] } keys %{$module};
|
my %data_translated = map { $_ => [ $module->{$_} ] } keys %{$module};
|
||||||
|
|
||||||
# Translate fields.
|
# Process modules.
|
||||||
PandoraFMS::DataServer::process_module_data (
|
PandoraFMS::DataServer::process_module_data (
|
||||||
$pa_config, \%data_translated,
|
$pa_config, \%data_translated,
|
||||||
$server_id, $current_agent,
|
$server_id, $current_agent,
|
||||||
|
|
|
@ -1450,6 +1450,8 @@ sub db_scan($) {
|
||||||
|
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
foreach my $target (@targets) {
|
foreach my $target (@targets) {
|
||||||
|
my @data;
|
||||||
|
my @modules;
|
||||||
call('message', 'Checking target ' . $target, 10);
|
call('message', 'Checking target ' . $target, 10);
|
||||||
|
|
||||||
# Force target acquirement.
|
# Force target acquirement.
|
||||||
|
@ -1462,15 +1464,26 @@ sub db_scan($) {
|
||||||
$self->{'task_data'}
|
$self->{'task_data'}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!defined($dbObj)) {
|
if (!$dbObj->is_connected()) {
|
||||||
call('message', 'Cannot connect to target ' . $target, 3);
|
call('message', 'Cannot connect to target ' . $target, 3);
|
||||||
$self->{'summary'}->{'not_alive'} += 1;
|
$self->{'summary'}->{'not_alive'} += 1;
|
||||||
next;
|
push @modules, {
|
||||||
}
|
name => 'mysql_connection',
|
||||||
|
type => 'generic_proc',
|
||||||
|
data => 0,
|
||||||
|
description => 'MySQL availability'
|
||||||
|
};
|
||||||
|
|
||||||
|
} else {
|
||||||
$self->{'summary'}->{'discovered'} += 1;
|
$self->{'summary'}->{'discovered'} += 1;
|
||||||
$self->{'summary'}->{'alive'} += 1;
|
$self->{'summary'}->{'alive'} += 1;
|
||||||
|
|
||||||
my @modules;
|
push @modules, {
|
||||||
|
name => 'mysql_connection',
|
||||||
|
type => 'generic_proc',
|
||||||
|
data => 1,
|
||||||
|
description => 'MySQL availability'
|
||||||
|
};
|
||||||
|
|
||||||
# Analyze.
|
# Analyze.
|
||||||
$self->{'step'} = STEP_STATISTICS;
|
$self->{'step'} = STEP_STATISTICS;
|
||||||
|
@ -1490,9 +1503,10 @@ sub db_scan($) {
|
||||||
# Custom queries.
|
# Custom queries.
|
||||||
push @modules, $dbObj->execute_custom_queries();
|
push @modules, $dbObj->execute_custom_queries();
|
||||||
$self->call('update_progress', 90);
|
$self->call('update_progress', 90);
|
||||||
|
}
|
||||||
|
|
||||||
my $data = [
|
# Put engine agent at the beginning of the list.
|
||||||
{
|
unshift @data,{
|
||||||
'agent_data' => {
|
'agent_data' => {
|
||||||
'agent_name' => $dbObj->get_agent_name(),
|
'agent_name' => $dbObj->get_agent_name(),
|
||||||
'os' => $type,
|
'os' => $type,
|
||||||
|
@ -1503,10 +1517,9 @@ sub db_scan($) {
|
||||||
'description' => '',
|
'description' => '',
|
||||||
},
|
},
|
||||||
'module_data' => \@modules,
|
'module_data' => \@modules,
|
||||||
}
|
};
|
||||||
];
|
|
||||||
|
|
||||||
$self->call('create_agents', $data);
|
$self->call('create_agents', \@data);
|
||||||
|
|
||||||
# Destroy item.
|
# Destroy item.
|
||||||
undef($dbObj);
|
undef($dbObj);
|
||||||
|
|
Loading…
Reference in New Issue