Make sure the alias is always set.

This commit is contained in:
Ramon Novoa 2017-02-21 14:24:06 +01:00
parent 0daaa9651e
commit e3205226e1
2 changed files with 7 additions and 2 deletions

View File

@ -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);

View File

@ -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=''");
}
##############################################################################