diff --git a/pandora_server/lib/PandoraFMS/DataServer.pm b/pandora_server/lib/PandoraFMS/DataServer.pm index 8a72ef7605..9ca6812e54 100644 --- a/pandora_server/lib/PandoraFMS/DataServer.pm +++ b/pandora_server/lib/PandoraFMS/DataServer.pm @@ -653,11 +653,16 @@ sub process_xml_data ($$$$$) { # save the carriage return. $module_name =~ s/\r//g; $module_name =~ s/\n//g; - + # Unnamed module next if ($module_name eq ''); - my $module_type = get_tag_value ($module_data, 'type', 'generic_data'); + # Read module type from db when module exists within it (skip XML read). + my $module_type = get_db_value ($dbh, 'SELECT ttm.nombre FROM ttipo_modulo ttm INNER JOIN tagente_modulo tam ON tam.id_tipo_modulo = ttm.id_tipo WHERE tam.id_agente = ' . $agent_id . ' AND tam.nombre' . ' = '. $RDBMS_QUOTE_STRING . safe_input($module_name) . $RDBMS_QUOTE_STRING); + + if (!defined($module_type)) { + $module_type = get_tag_value ($module_data, 'type', 'generic_data'); + } # Apply timezone offset to module if timestamp is set. if (defined($module_data->{'timestamp'} && $module_data->{'timestamp'} ne '')) {