diff --git a/pandora_console/include/help/en/help_alert_config.php b/pandora_console/include/help/en/help_alert_config.php index 05e93abac0..6fcd868841 100644 --- a/pandora_console/include/help/en/help_alert_config.php +++ b/pandora_console/include/help/en/help_alert_config.php @@ -33,6 +33,8 @@ Apart from the defined module macros, the following macros are also available:
  • _agentstatus_ : Current status of the agent.
  • _agentos_: Agent's operative system.
  • _address_ : Address of the agent that fired the alert.
  • +
  • _all_address_ : All address of the agent that fired the alert.
  • +
  • _address_n_ : The address of the agent that corresponds to the position indicated in "n" e.g: address_1_ , address_2_
  • _timestamp_ : Time when the alert was fired (yy-mm-dd hh:mm:ss).
  • _timezone_ : Timezone name that _timestamp_ represents in.
  • _data_ : Module data that caused the alert to fire.
  • diff --git a/pandora_console/include/help/es/help_alert_config.php b/pandora_console/include/help/es/help_alert_config.php index 4791dc716e..1353021b9e 100644 --- a/pandora_console/include/help/es/help_alert_config.php +++ b/pandora_console/include/help/es/help_alert_config.php @@ -34,6 +34,8 @@ Además de las macros de módulo definidas, las siguientes macros están disponi
  • _agentgroup_ : Nombre del grupo del agente.
  • _agentstatus_ : Estado actual del agente.
  • _address_: Dirección del agente que disparó la alerta.
  • +
  • _all_address_ : Todas las direcciones del agente que disparo la alerta.
  • +
  • _address_n_ : La dirección del agente que corresponde a la posicion indicada en "n" ejemplo: address_1_ , address_2_
  • _agentos_: Sistema operativo del agente.
  • _timestamp_: Hora y fecha en que se disparó la alerta.
  • _timezone_: Area Nombre _timestamp_ que representa en.
  • diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 543ae4e264..03ff320add 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -1018,6 +1018,8 @@ sub pandora_execute_action ($$$$$$$$$;$) { _email_tag_ => undef, _phone_tag_ => undef, _name_tag_ => undef, + _all_address_ => undef, + '_address_\d+_' => undef, ); if ((defined ($extra_macros)) && (ref($extra_macros) eq "HASH")) { @@ -3613,6 +3615,29 @@ sub on_demand_macro($$$$$$) { else{ my $field_value = get_db_value($dbh, 'SELECT datos FROM tagente_datos where id_agente_modulo = ? order by utimestamp desc limit 1 offset 1', $module->{'id_agente_modulo'}); } + }elsif ($macro eq '_all_address_') { + return '' unless defined ($module); + 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 $field_value = "
    ";
    +		my $count=1;
    +		foreach my $element (@rows) {
    +			$field_value .= $count.": " . $element->{'ip'} . "\n";
    +			$count++;
    +		}
    +		$field_value .= "
    "; + return(defined($field_value)) ? $field_value : ''; + } elsif ($macro =~ /_address_(\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 $field_value = $rows[$field_number]->{'ip'}; + if($field_value == ''){ + $field_value = 'Ip not defined'; + } + + return(defined($field_value)) ? $field_value : ''; } }