Merge branch '2078-ue-cmdb-integration' into 'develop'

2078 ue cmdb integration

See merge request 
This commit is contained in:
vgilc 2018-09-19 11:37:20 +02:00
commit daf48c3798

@ -158,7 +158,7 @@ require Exporter;
our @ISA = ("Exporter");
our %EXPORT_TAGS = ( 'all' => [ qw( ) ] );
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT = qw(
our @EXPORT = qw(
pandora_add_agent_address
pandora_audit
pandora_create_agent
@ -234,6 +234,7 @@ our @EXPORT = qw(
pandora_self_monitoring
pandora_process_policy_queue
subst_alert_macros
locate_agent
get_agent
get_agent_from_alias
get_agent_from_addr
@ -259,6 +260,32 @@ our $EventStormProtection :shared = 0;
# Current master server
my $Master :shared = 0;
##########################################################################
# Return the agent given the agent name or alias or address.
##########################################################################
sub locate_agent {
my ($pa_config, $dbh, $field) = @_;
if (is_metaconsole($pa_config)) {
# Locate agent first in tmetaconsole_agent
return undef if (! defined ($field) || $field eq '');
my $rs = enterprise_hook('get_metaconsole_agent_from_alias', [$dbh, $field]);
return $rs if defined($rs) && (ref($rs)); # defined and not a scalar
$rs = enterprise_hook('get_metaconsole_agent_from_addr', [$dbh, $field]);
return $rs if defined($rs) && (ref($rs)); # defined and not a scalar
$rs = enterprise_hook('get_metaconsole_agent_from_name', [$dbh, $field]);
return $rs if defined($rs) && (ref($rs)); # defined and not a scalar
} else {
return get_agent($dbh, $field);
}
return undef;
}
##########################################################################
# Return the agent given the agent name or alias or address.