mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 15:54:29 +02:00
2009-08-03 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Core.pm: Add id_agente to tagente_estado when creating a new module. * lib/PandoraFMS/DataServer.pm: Added support for inventory XML files. * lib/PandoraFMS/Tools.pm: Moved get_tag_value function from DataServer.pm to Tools.pm. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1826 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
18ffdc9360
commit
19c52db07b
@ -1,3 +1,13 @@
|
|||||||
|
2009-08-03 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
|
* lib/PandoraFMS/Core.pm: Add id_agente to tagente_estado when
|
||||||
|
creating a new module.
|
||||||
|
|
||||||
|
* lib/PandoraFMS/DataServer.pm: Added support for inventory XML files.
|
||||||
|
|
||||||
|
* lib/PandoraFMS/Tools.pm: Moved get_tag_value function from
|
||||||
|
DataServer.pm to Tools.pm.
|
||||||
|
|
||||||
2009-07-30 Manuel Arostegui <manuel@todo-linux.com>
|
2009-07-30 Manuel Arostegui <manuel@todo-linux.com>
|
||||||
|
|
||||||
* SLES10/pandora_wmi, pandora_plugin, pandora_prediction
|
* SLES10/pandora_wmi, pandora_plugin, pandora_prediction
|
||||||
|
@ -720,7 +720,7 @@ sub pandora_create_module ($$$$$$$$) {
|
|||||||
|
|
||||||
my $module_id = db_insert($dbh, 'INSERT INTO tagente_modulo (`id_agente`, `id_tipo_modulo`, `nombre`, `max`, `min`, `descripcion`, `module_interval`, `id_modulo`)
|
my $module_id = db_insert($dbh, 'INSERT INTO tagente_modulo (`id_agente`, `id_tipo_modulo`, `nombre`, `max`, `min`, `descripcion`, `module_interval`, `id_modulo`)
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?, 1)', $agent_id, $module_type_id, $module_name, $max, $min, $description, $interval);
|
VALUES (?, ?, ?, ?, ?, ?, ?, 1)', $agent_id, $module_type_id, $module_name, $max, $min, $description, $interval);
|
||||||
db_do ($dbh, 'INSERT INTO tagente_estado (`id_agente_modulo`, `last_try`) VALUES (?, \'0000-00-00 00:00:00\')', $module_id);
|
db_do ($dbh, 'INSERT INTO tagente_estado (`id_agente_modulo`, `id_agente`, `last_try`) VALUES (?, ?, \'0000-00-00 00:00:00\')', $module_id, $agent_id);
|
||||||
return $module_id;
|
return $module_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,9 @@ use PandoraFMS::DB;
|
|||||||
use PandoraFMS::Core;
|
use PandoraFMS::Core;
|
||||||
use PandoraFMS::ProducerConsumerServer;
|
use PandoraFMS::ProducerConsumerServer;
|
||||||
|
|
||||||
|
# Load enterprise module
|
||||||
|
enterprise_load ();
|
||||||
|
|
||||||
# Inherits from PandoraFMS::ProducerConsumerServer
|
# Inherits from PandoraFMS::ProducerConsumerServer
|
||||||
our @ISA = qw(PandoraFMS::ProducerConsumerServer);
|
our @ISA = qw(PandoraFMS::ProducerConsumerServer);
|
||||||
|
|
||||||
@ -214,6 +217,10 @@ sub process_xml_data ($$$$) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Process inventory modules
|
||||||
|
enterprise_hook('process_inventory_data', [$pa_config, $data, $server_id, $agent_name,
|
||||||
|
$interval, $timestamp, $dbh]);
|
||||||
}
|
}
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
@ -260,24 +267,5 @@ sub process_module_data ($$$$$$$$$) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
##########################################################################
|
|
||||||
# Returns the value of an XML tag from a hash returned by XMLin (one level
|
|
||||||
# depth).
|
|
||||||
##########################################################################
|
|
||||||
sub get_tag_value ($$$) {
|
|
||||||
my ($hash_ref, $tag, $def_value) = @_;
|
|
||||||
|
|
||||||
return $def_value unless defined ($hash_ref->{$tag}) and ref ($hash_ref->{$tag});
|
|
||||||
|
|
||||||
# Return the first found value
|
|
||||||
foreach my $value (@{$hash_ref->{$tag}}) {
|
|
||||||
|
|
||||||
# If the tag is defined but has no value a ref to an empty hash is returned by XML::Simple
|
|
||||||
return $value unless ref ($value);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $def_value;
|
|
||||||
}
|
|
||||||
|
|
||||||
1;
|
1;
|
||||||
__END__
|
__END__
|
||||||
|
@ -42,6 +42,7 @@ our @EXPORT = qw(
|
|||||||
enterprise_hook
|
enterprise_hook
|
||||||
enterprise_load
|
enterprise_load
|
||||||
print_message
|
print_message
|
||||||
|
get_tag_value
|
||||||
);
|
);
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
@ -362,6 +363,25 @@ sub print_message ($$$) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
##########################################################################
|
||||||
|
# Returns the value of an XML tag from a hash returned by XMLin (one level
|
||||||
|
# depth).
|
||||||
|
##########################################################################
|
||||||
|
sub get_tag_value ($$$) {
|
||||||
|
my ($hash_ref, $tag, $def_value) = @_;
|
||||||
|
|
||||||
|
return $def_value unless defined ($hash_ref->{$tag}) and ref ($hash_ref->{$tag});
|
||||||
|
|
||||||
|
# Return the first found value
|
||||||
|
foreach my $value (@{$hash_ref->{$tag}}) {
|
||||||
|
|
||||||
|
# If the tag is defined but has no value a ref to an empty hash is returned by XML::Simple
|
||||||
|
return $value unless ref ($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $def_value;
|
||||||
|
}
|
||||||
|
|
||||||
# End of function declaration
|
# End of function declaration
|
||||||
# End of defined Code
|
# End of defined Code
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user