mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
WIP discovery F3 app db my multiserver
Former-commit-id: a85c048a6d4e755b76a7e042e04cfebdfe69b6f4
This commit is contained in:
parent
74303168ac
commit
654e0c28f6
@ -1446,55 +1446,70 @@ sub db_scan($) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Connect to target.
|
my @targets = split /,/, $self->{'task_data'}->{'subnet'};
|
||||||
my $dbObj = PandoraFMS::Recon::Util::enterprise_new(
|
|
||||||
'PandoraFMS::Recon::Applications::'.$type,
|
|
||||||
$self->{'task_data'}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!defined($dbObj)) {
|
my $i = 0;
|
||||||
call('message', 'Cannot connect to target ' .'', 3);
|
foreach my $target (@targets) {
|
||||||
$self->call('update_progress', -1);
|
call('message', 'Checking target ' . $target, 10);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
my @modules;
|
# Force target acquirement.
|
||||||
|
$self->{'task_data'}->{'dbhost'} = $target;
|
||||||
|
$self->{'task_data'}->{'target_index'} = $i++;
|
||||||
|
|
||||||
# Analyze.
|
# Connect to target.
|
||||||
$self->{'step'} = STEP_STATISTICS;
|
my $dbObj = PandoraFMS::Recon::Util::enterprise_new(
|
||||||
$self->{'c_network_name'} = $dbObj->get_host();
|
'PandoraFMS::Recon::Applications::'.$type,
|
||||||
$self->call('update_progress', 10);
|
$self->{'task_data'}
|
||||||
|
);
|
||||||
|
|
||||||
# Retrieve connection statistics.
|
if (!defined($dbObj)) {
|
||||||
# Retrieve uptime statistics
|
call('message', 'Cannot connect to target ' . $target, 3);
|
||||||
# Retrieve query stats
|
next;
|
||||||
# Retrieve connections
|
|
||||||
# Retrieve innodb
|
|
||||||
# Retrieve cache
|
|
||||||
push @modules, $dbObj->get_statistics();
|
|
||||||
$self->call('update_progress', 50);
|
|
||||||
|
|
||||||
|
|
||||||
# Custom queries.
|
|
||||||
push @modules, $dbObj->execute_custom_queries();
|
|
||||||
$self->call('update_progress', 90);
|
|
||||||
|
|
||||||
my $data = [
|
|
||||||
{
|
|
||||||
'agent_data' => {
|
|
||||||
'agent_name' => $dbObj->get_agent_name(),
|
|
||||||
'os' => $type,
|
|
||||||
'os_version' => 'Discovery',
|
|
||||||
'interval' => $self->{'task_data'}->{'interval_sweep'},
|
|
||||||
'id_group' => $self->{'task_data'}->{'id_group'},
|
|
||||||
'address' => $dbObj->get_host(),
|
|
||||||
'description' => '',
|
|
||||||
},
|
|
||||||
'module_data' => \@modules,
|
|
||||||
}
|
}
|
||||||
];
|
|
||||||
|
|
||||||
$self->call('create_agents', $data);
|
my @modules;
|
||||||
|
|
||||||
|
# Analyze.
|
||||||
|
$self->{'step'} = STEP_STATISTICS;
|
||||||
|
$self->{'c_network_name'} = $dbObj->get_host();
|
||||||
|
$self->call('update_progress', 10);
|
||||||
|
|
||||||
|
# Retrieve connection statistics.
|
||||||
|
# Retrieve uptime statistics
|
||||||
|
# Retrieve query stats
|
||||||
|
# Retrieve connections
|
||||||
|
# Retrieve innodb
|
||||||
|
# Retrieve cache
|
||||||
|
push @modules, $dbObj->get_statistics();
|
||||||
|
$self->call('update_progress', 50);
|
||||||
|
|
||||||
|
|
||||||
|
# Custom queries.
|
||||||
|
push @modules, $dbObj->execute_custom_queries();
|
||||||
|
$self->call('update_progress', 90);
|
||||||
|
|
||||||
|
my $data = [
|
||||||
|
{
|
||||||
|
'agent_data' => {
|
||||||
|
'agent_name' => $dbObj->get_agent_name(),
|
||||||
|
'os' => $type,
|
||||||
|
'os_version' => 'Discovery',
|
||||||
|
'interval' => $self->{'task_data'}->{'interval_sweep'},
|
||||||
|
'id_group' => $self->{'task_data'}->{'id_group'},
|
||||||
|
'address' => $dbObj->get_host(),
|
||||||
|
'description' => '',
|
||||||
|
},
|
||||||
|
'module_data' => \@modules,
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
use Data::Dumper;
|
||||||
|
print Dumper($data);
|
||||||
|
$self->call('create_agents', $data);
|
||||||
|
|
||||||
|
# Destroy item.
|
||||||
|
undef($dbObj);
|
||||||
|
}
|
||||||
|
|
||||||
# Update progress.
|
# Update progress.
|
||||||
# Done!
|
# Done!
|
||||||
|
Loading…
x
Reference in New Issue
Block a user