". $agent_data['nombre']."\n"; $content_report .= " ". $agent_data['comentarios']."\n"; $content_report .= " ".$agent_data['direccion']."\n"; $content_report .= " ".$agent_data['id_grupo']."\n"; $content_report .= " ". $agent_data['intervalo']."\n"; $sql = "SELECT t1.description, t2.name FROM tagent_custom_data t1, tagent_custom_fields t2 WHERE t1.id_agent=".$agent_data['id_agente']." AND t1.id_field=t2.id_field"; $custom_fields = db_get_all_rows_sql($sql); if ($custom_fields !== false) { foreach ($custom_fields as $field) { $field['name'] = io_safe_output($field['name']); //remove blank $field['name'] = preg_replace('/\s/', '_', $field['name']); $content_report .= " <".$field['name'].">".$field['description']."\n"; } } $content_report .= " ".$agent_data['id_os']."\n"; $content_report .= " ". agents_get_name ($agent_data['id_parent'])."\n"; $content_report .= " ".$agent_data['id_extra']."\n"; $content_report .= " ".$agent_data['disabled']."\n"; $result = fwrite($file, $content_report); $position++; fclose($file); return $position; } //xml con los datos de módulos de un agente function xml_file_agent_conf ($modules = array(), $file_temp, $position = 0, $id_agent) { $file = fopen($file_temp, 'a+'); foreach ($modules as $module) { $content_report = " \n"; $content_report .= " ".$module['nombre']."\n"; $content_report .= " ".$module['id_agente_modulo']."\n"; $content_report .= " ".$module['id_tipo_modulo']."\n"; $content_report .= " ".$module['descripcion']."\n"; $content_report .= " ". $module['extended_info']."\n"; $content_report .= " ". $module['unit']."\n"; $content_report .= " ". $module['max']."\n"; $content_report .= " ".$module['min']."\n"; $content_report .= " ". $module['module_interval']."\n"; $content_report .= " ". $module['module_ff_interval']."\n"; $content_report .= " ". $module['tcp_port']."\n"; $content_report .= " ". $module['tcp_send']."\n"; $content_report .= " ". $module['tcp_rcv']."\n"; $content_report .= " ". $module['snmp_community']."\n"; $content_report .= " ".$module['snmp_oid']."\n"; $content_report .= " ". $module['ip_target']."\n"; $content_report .= " ".$module['id_module_group']."\n"; $content_report .= " ". $module['disabled']."\n"; $content_report .= " ".$module['id_plugin']."\n"; $content_report .= " ". $module['post_process']."\n"; $content_report .= " ". $module['min_warning']."\n"; $content_report .= " ". $module['max_warning']."\n"; $content_report .= " ". $module['str_warning']."\n"; $content_report .= " ". $module['min_critical']."\n"; $content_report .= " ".$module['max_critical']."\n"; $content_report .= " ". $module['str_critical']."\n"; $content_report .= " ". $module['id_policy_module']."\n"; $content_report .= " ".$module['wizard_level']."\n"; $content_report .= " ". $module['critical_instructions']."\n"; $content_report .= " ". $module['warning_instructions']."\n"; $content_report .= " ".$module['unknown_instructions']."\n"; $content_report .= " \n"; $result = fwrite($file, $content_report); $position++; } fclose($file); return $position; } // xml eventos function xml_file_event ($events = array(), $file_temp, $position = 0, $id_agent) { $file = fopen($file_temp, 'a+'); foreach ($events as $event) { $content_report = " \n"; $content_report .= " " . io_safe_output($event['evento']) . "\n"; $content_report .= " " . $event['event_type'] . "\n"; $content_report .= " " . get_priority_name($event['criticity']) . "\n"; $content_report .= " " . $event['count_rep'] . "\n"; $content_report .= " " . $event['time2'] . "\n"; $content_report .= " " . io_safe_output(modules_get_agentmodule_name ($event['id_agentmodule'])) . "\n"; $content_report .= " " . io_safe_output(agents_get_name ($id_agent)) . "\n"; if ($event['estado'] == 0) $status = __('New'); else if ($event['estado'] == 1) $status = __('Validated'); else if ($event['estado'] == 2) $status = __('In process'); else $status = ""; $content_report .= " ".$status."\n"; $content_report .= " ".$event['user_comment']."\n"; $content_report .= " ".$event['tags']."\n"; $content_report .= " ".$event['source']."\n"; $content_report .= " ".$event['id_extra']."\n"; $content_report .= " ".$event['owner_user']."\n"; $content_report .= " \n"; $result = fwrite($file, $content_report); $position++; } fclose($file); return $position; } //xml graph function xml_file_graph ($data_module = array(), $file_temp, $position = 0) { $file = fopen($file_temp, 'a+'); foreach ($data_module as $data_m) { $content_report = " \n"; $content_report .= " ".date ('Y-m-d H:i:s', $data_m['utimestamp'])."\n"; $content_report .= " ".$data_m['utimestamp']."\n"; $content_report .= " ".$data_m['datos']."\n"; $content_report .= " \n"; $result = fwrite($file, $content_report); $position++; } fclose($file); return $position; } ?>