diff --git a/pandora_server/lib/PandoraFMS/DataServer.pm b/pandora_server/lib/PandoraFMS/DataServer.pm index 6019f0dbae..7d483b61af 100644 --- a/pandora_server/lib/PandoraFMS/DataServer.pm +++ b/pandora_server/lib/PandoraFMS/DataServer.pm @@ -374,8 +374,7 @@ sub process_xml_data ($$$$$) { my $description = ''; $description = $data->{'description'} if (defined ($data->{'description'})); - my $alias = ''; - $alias = $data->{'agent_alias'} if (defined ($data->{'agent_alias'})); + my $alias = (defined ($data->{'agent_alias'}) && $data->{'agent_alias'} ne '') ? $data->{'agent_alias'} : $data->{'agent_name'}; $agent_id = pandora_create_agent($pa_config, $pa_config->{'servername'}, $agent_name, $address, $group_id, $parent_id, $os, $description, $interval, $dbh, $timezone_offset, undef, undef, undef, undef, $custom_id, $url_address, $agent_mode, $alias); diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 4c3aba55e7..c13eb50e17 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -936,6 +936,12 @@ sub pandora_checkdb_consistency { log_message ('CHECKDB', "Deleting non-existing module $id_agente_modulo in state table."); } + + #------------------------------------------------------------------- + # 3. Update empty aliases. + #------------------------------------------------------------------- + log_message ('CHECKDB', "Updating empty aliases."); + db_do ($dbh, "UPDATE tagente SET alias=nombre WHERE alias=''"); } ##############################################################################