Merge branch 'ent-7379-macro-de-direcciones-en-network-y-pluginserver' into 'develop'
Rename the _address_n_ macro and add it to more servers. Closes pandora_enterprise#7379 See merge request artica/pandorafms!4462
This commit is contained in:
commit
a940396b0d
|
@ -1329,7 +1329,7 @@ sub pandora_execute_action ($$$$$$$$$;$) {
|
|||
_phone_tag_ => undef,
|
||||
_name_tag_ => undef,
|
||||
_all_address_ => undef,
|
||||
'_address_\d+_' => undef,
|
||||
'_addressn_\d+_' => undef,
|
||||
_secondarygroups_ => undef,
|
||||
);
|
||||
|
||||
|
@ -4505,16 +4505,12 @@ sub on_demand_macro($$$$$$;$) {
|
|||
}
|
||||
$field_value .= "</pre>";
|
||||
return(defined($field_value)) ? $field_value : '';
|
||||
} elsif ($macro =~ /_address_(\d+)_/) {
|
||||
} elsif ($macro =~ /_addressn_(\d+)_/) {
|
||||
return '' unless defined ($module);
|
||||
my $field_number = $1 - 1;
|
||||
my @rows = get_db_rows ($dbh, 'SELECT ip FROM taddress_agent taag, taddress ta WHERE ta.id_a = taag.id_a AND id_agent = ?', $module->{'id_agente'});
|
||||
my @rows = get_db_rows ($dbh, 'SELECT ip FROM taddress_agent taag, taddress ta WHERE ta.id_a = taag.id_a AND id_agent = ? ORDER BY ip ASC', $module->{'id_agente'});
|
||||
|
||||
my $field_value = $rows[$field_number]->{'ip'};
|
||||
if($field_value == ''){
|
||||
$field_value = 'Ip not defined';
|
||||
}
|
||||
|
||||
return(defined($field_value)) ? $field_value : '';
|
||||
} elsif ($macro =~ /_moduledata_(\S+)_/) {
|
||||
my $field_number = $1;
|
||||
|
|
|
@ -347,6 +347,8 @@ sub pandora_query_snmp ($$$$) {
|
|||
# Initialize macros.
|
||||
my %macros = (
|
||||
'_agentcustomfield_\d+_' => undef,
|
||||
'_addressn_\d+_' => undef,
|
||||
'_address_' => undef,
|
||||
);
|
||||
|
||||
|
||||
|
@ -479,8 +481,17 @@ sub exec_network_module ($$$$) {
|
|||
$target_os = $agent_row->{'id_os'};
|
||||
}
|
||||
|
||||
# Initialize macros.
|
||||
my %macros = (
|
||||
'_agentcustomfield_\d+_' => undef,
|
||||
'_addressn_\d+_' => undef,
|
||||
'_address_' => undef,
|
||||
);
|
||||
|
||||
$ip_target = safe_output(subst_column_macros($ip_target, \%macros, $pa_config, $dbh, $agent_row, $module));
|
||||
|
||||
# Use the agent address by default
|
||||
if (! defined($ip_target) || $ip_target eq '' || $ip_target eq 'auto'|| $ip_target eq '_address_') {
|
||||
if (! defined($ip_target) || $ip_target eq '' || $ip_target eq 'auto') {
|
||||
$ip_target = $agent_row->{'direccion'};
|
||||
}
|
||||
|
||||
|
|
|
@ -242,6 +242,7 @@ sub data_consumer ($$) {
|
|||
_phone_tag_ => undef,
|
||||
_name_tag_ => undef,
|
||||
'_agentcustomfield_\d+_' => undef,
|
||||
'_addressn_\d+_' => undef,
|
||||
);
|
||||
$parameters = subst_alert_macros ($parameters, \%macros, $pa_config, $dbh, $agent, $module);
|
||||
|
||||
|
|
Loading…
Reference in New Issue