2010-10-15 Ramon Novoa <rnovoa@artica.es>

* lib/PandoraFMS/ReconServer.pm: Added support for recon scripts.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3411 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Ramon Novoa 2010-10-15 13:00:25 +00:00
parent 2344ed4214
commit e91c287446
2 changed files with 25 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2010-10-15 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/ReconServer.pm: Added support for recon scripts.
2010-10-14 Sancho Lerena <slerena@artica.es>
* PandoraFMS/Core.pm: Fixed bug #3085249 about empty extra_macros hash.

View File

@ -111,6 +111,12 @@ sub data_consumer ($$) {
my $task = get_db_single_row ($dbh, 'SELECT * FROM trecon_task WHERE id_rt = ?', $task_id);
return -1 unless defined ($task);
# Is it a recon script?
if (defined ($task->{'id_recon_script'})) {
exec_recon_script ($pa_config, $dbh, $task);
return;
}
# Get a NetAddr::IP object for the target network
my $net_addr = new NetAddr::IP ($task->{'subnet'});
if (! defined ($net_addr)) {
@ -436,5 +442,20 @@ sub get_host_parent ($$){
return 0;
}
##########################################################################
# Executes recon scripts
##########################################################################
sub exec_recon_script ($$$) {
my ($pa_config, $dbh, $task) = @_;
# Get recon plugin data
my $script = get_db_single_row ($dbh, 'SELECT * FROM trecon_script WHERE id_recon_script = ?', $task->{'id_recon_script'});
return -1 unless defined ($script);
logger($pa_config, 'Executing recon script ' . $script->{'name'}, 10);
`$script->{'script'} $task->{'field1'} $task->{'field2'} $task->{'field3'} $task->{'field4'}`;
return 0;
}
1;
__END__