2009-12-23 Ramon Novoa <rnovoa@artica.es>

* lib/PandoraFMS/Core.pm,
          lib/PandoraFMS/ReconServer.pm,
          lib/PandoraFMS/DataServer.pm: Use agent provided interval for agent
          auto creation. The default interval was being used instead.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2237 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Ramon Novoa 2009-12-23 16:18:33 +00:00
parent 4e152c38c7
commit beaa525096
4 changed files with 12 additions and 5 deletions

@ -1,3 +1,10 @@
2009-12-23 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Core.pm,
lib/PandoraFMS/ReconServer.pm,
lib/PandoraFMS/DataServer.pm: Use agent provided interval for agent
auto creation. The default interval was being used instead.
2009-12-23 Sancho Lerena <slerena@artica.es>
* lib/PandoraFMS/Core.pm: Fixed some typos in planned downtime subroutine.

@ -802,17 +802,17 @@ sub pandora_create_module ($$$$$$$$$$) {
##########################################################################
# Create a new entry in tagente.
##########################################################################
sub pandora_create_agent ($$$$$$$$$$) {
sub pandora_create_agent ($$$$$$$$$$$) {
my ($pa_config, $server_name, $agent_name, $address,
$address_id, $group_id, $parent_id, $os_id,
$description, $dbh) = @_;
$description, $interval, $dbh) = @_;
logger ($pa_config, "Server '$server_name' creating agent '$agent_name' address '$address'.", 10);
$description = "Created by $server_name" unless ($description ne '');
my $agent_id = db_insert ($dbh, 'INSERT INTO tagente (`nombre`, `direccion`, `comentarios`, `id_grupo`, `id_os`, `server_name`, `intervalo`, `id_parent`, `modo`)
VALUES (?, ?, ?, ?, ?, ?, 300, ?, 1)', $agent_name, $address, $description, $group_id, $os_id, $server_name, $parent_id);
VALUES (?, ?, ?, ?, ?, ?, ?, ?, 1)', $agent_name, $address, $description, $group_id, $os_id, $server_name, $interval, $parent_id);
pandora_event ($pa_config, "Agent '$agent_name' created by $server_name", $pa_config->{'autocreate_group'}, $agent_id, 2, 0, 0, 'new_agent', $dbh);
return $agent_id;

@ -191,7 +191,7 @@ sub process_xml_data ($$$$$) {
$description = $data->{'description'} if (defined ($data->{'description'}));
# Create the agent
$agent_id = pandora_create_agent ($pa_config, $pa_config->{'servername'}, $agent_name, '', 0, $group_id, 0, $os, $description, $dbh);
$agent_id = pandora_create_agent ($pa_config, $pa_config->{'servername'}, $agent_name, '', 0, $group_id, 0, $os, $description, $interval, $dbh);
if (! defined ($agent_id)) {
$AgentSem->up ();
return;

@ -167,7 +167,7 @@ sub data_consumer ($$) {
# Crate a new agent
my $agent_id = pandora_create_agent ($pa_config, $pa_config->{'servername'},
$host_name, $addr, $addr_id,
$task->{'id_group'}, $parent_id, $id_os, '', $dbh);
$task->{'id_group'}, $parent_id, $id_os, '', 300, $dbh);
# Assign the new address to the agent
db_insert ($dbh, 'INSERT INTO taddress_agent (`id_a`, `id_agent`)
VALUES (?, ?)', $addr_id, $agent_id);