diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 12874d6134..a9c1453876 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2012-10-30 Vanessa Gil + + * include/functions_reporting.php: Changed format of agent + and group configuration reports. + *operation/reporting/reporting_xml.php: Added custom field + to xml report. + 2012-10-30 Hirofumi Kosaka * include/functions_api.php: added 'description' parameter to diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 56b637d7c8..6f2a86597d 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -4500,7 +4500,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $modules = agents_get_modules ($content['id_agent']); $data= array (); - $table->colspan[0][1] = 9; + $table->colspan[0][1] = 10; //Agent's data $data[0] = ''.__('Agent name').''; @@ -4509,11 +4509,11 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $data[3] = ''.__('IP').''; $data[4] = ''.__('Description').''; $data[5] = ''.__('Status').''; - - $table->colspan[1][1] = 2; - $table->colspan[1][2] = 2; - $table->colspan[1][4] = 3; - + + $table->colspan[1][3] = 2; + $table->colspan[1][4] = 4; + $table->colspan[1][5] = 2; + $table->colspan[1][5] = 2; array_push ($table->data, $data); unset($data); @@ -4530,17 +4530,17 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $data[5] = __('Enabled'); else $data[5] = __('Disabled'); - - $table->colspan[2][1] = 2; - $table->colspan[2][2] = 2; - $table->colspan[2][4] = 3; + + $table->colspan[2][3] = 2; + $table->colspan[2][4] = 4; + $table->colspan[2][5] = 2; array_push ($table->data, $data); unset($data); //Agent's modules - $data[0] = ''.agents_get_name ($content['id_agent'], 'upper').__(' MODULES').''; - $data[1] = ''; - $table->colspan[3][1] = 9; + $data[0] = ''; + $data[1] = ''.agents_get_name ($content['id_agent'], 'upper').__(' MODULES').''; + $table->colspan[3][1] = 10; array_push ($table->data, $data); unset($data); @@ -4548,27 +4548,29 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f if ($modules == null) { $modules = array(); } else { - $data[0] = ''.__('Name').''; - $data[1] = ''.__('Type').''; - $data[2] = ''.__('Warning/Critical').''; - $data[3] = ''.__('Threshold').''; - $data[4] = ''.__('Group').''; - $data[5] = ''.__('Description').''; - $data[6] = ''.__('Interval').''; - $data[7] = ''.__('Unit').''; - $data[8] = ''.__('Status').''; - $data[9] = ''.__('Tags').''; + $data[0] = ''; + $data[1] = ''.__('Name').''; + $data[2] = ''.__('Type').''; + $data[3] = ''.__('Warning').'/'.'
'.__('Critical').'
'; + $data[4] = ''.__('Threshold').''; + $data[5] = ''.__('Group').''; + $data[6] = ''.__('Description').''; + $data[7] = ''.__('Interval').''; + $data[8] = ''.__('Unit').''; + $data[9] = ''.__('Status').''; + $data[10] = ''.__('Tags').''; - $table->style[0] = 'text-align: left'; - $table->style[1] = 'text-align: center'; + $table->style[0] = 'width:10px'; + $table->style[1] = 'text-align: left'; $table->style[2] = 'text-align: center'; $table->style[3] = 'text-align: center'; $table->style[4] = 'text-align: center'; - $table->style[5] = 'text-align: left'; - $table->style[6] = 'text-align: center'; + $table->style[5] = 'text-align: center'; + $table->style[6] = 'text-align: left'; $table->style[7] = 'text-align: center'; - $table->style[8] = 'text-align: left'; + $table->style[8] = 'text-align: center'; $table->style[9] = 'text-align: left'; + $table->style[10] = 'text-align: left'; array_push ($table->data, $data); } @@ -4579,28 +4581,30 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $data = array(); + $data[0] = ''; + if ($data_module['disabled'] == 0) $disabled = ''; else $disabled = ' (Disabled)'; - $data[0] = $data_module['nombre'].$disabled; - $data[1] = ui_print_moduletype_icon ($data_module['id_tipo_modulo'], true); - $data[2] = $data_module['max_warning'].'/'.$data_module['min_warning'].' - '.$data_module['max_critical'].'/'.$data_module['min_critical']; - $data[3] = $data_module['module_ff_interval']; - $data[4] = groups_get_name ($content['id_group'], true); - $data[5] = $data_module['descripcion']; + $data[1] = $data_module['nombre'].$disabled; + $data[2] = ui_print_moduletype_icon ($data_module['id_tipo_modulo'], true); + $data[3] = $data_module['max_warning'].'/'.$data_module['min_warning'].'
'.$data_module['max_critical'].'/'.$data_module['min_critical']; + $data[4] = $data_module['module_ff_interval']; + $data[5] = groups_get_name ($content['id_group'], true); + $data[6] = $data_module['descripcion']; if (($data_module['module_interval'] == 0) || ($data_module['module_interval'] == '')) - $data[6] = db_get_value('intervalo', 'tagente', 'id_agente', $content['id_agent']); + $data[7] = db_get_value('intervalo', 'tagente', 'id_agente', $content['id_agent']); else - $data[6] = $data_module['module_interval']; + $data[7] = $data_module['module_interval']; - $data[7] = $data_module['unit']; + $data[8] = $data_module['unit']; $module_status = db_get_row('tagente_estado', 'id_agente_modulo', $id_agent_module); modules_get_status($id_agent_module, $module_status['estado'], $module_status['datos'], $status, $title); - $data[8] = ui_print_status_image($status, $title, true); + $data[9] = ui_print_status_image($status, $title, true); $sql_tag = "SELECT name FROM ttag WHERE id_tag IN ( SELECT id_tag FROM ttag_module @@ -4611,7 +4615,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f else $tags = implode (",", $tags); - $data[9] = $tags; + $data[10] = $tags; array_push ($table->data, $data); } @@ -4625,15 +4629,17 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f if ($agents_list === false) $agents_list = array(); - $table->colspan[0][1] = 9; + $table->colspan[0][1] = 10; $i = 1; foreach ($agents_list as $agent) { $data= array (); - $table->colspan[$i][1] = 2; - $table->colspan[$i][2] = 2; - $table->colspan[$i][4] = 3; + $table->colspan[$i][3] = 2; + $table->colspan[$i][4] = 4; + $table->colspan[$i][5] = 2; + $table->colspan[$i][5] = 2; + $i++; //Agent's data @@ -4661,9 +4667,11 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f else $data[5] = __('Disabled'); - $table->colspan[$i][1] = 2; - $table->colspan[$i][2] = 2; - $table->colspan[$i][4] = 3; + $table->colspan[$i][3] = 2; + $table->colspan[$i][4] = 4; + $table->colspan[$i][5] = 2; + $table->colspan[$i][5] = 2; + $i++; array_push ($table->data, $data); @@ -4678,36 +4686,38 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f } else { //Agent's modules - $data[0] = ''.agents_get_name ($agent['id_agente'], 'upper').__(' MODULES').''; - $data[1] = ''; - $table->colspan[$i][1] = 9; + $data[0] = ''; + $data[1] = ''.agents_get_name ($agent['id_agente'], 'upper').__(' MODULES').''; + $table->colspan[$i][1] = 10; $i++; array_push ($table->data, $data); unset($data); - $data[0] = ''.__('Name').''; - $data[1] = ''.__('Type').''; - $data[2] = ''.__('Warning/Critical').''; - $data[3] = ''.__('Threshold').''; - $data[4] = ''.__('Group').''; - $data[5] = ''.__('Description').''; - $data[6] = ''.__('Interval').''; - $data[7] = ''.__('Unit').''; - $data[8] = ''.__('Status').''; - $data[9] = ''.__('Tags').''; + $data[0] = ''; + $data[1] = ''.__('Name').''; + $data[2] = ''.__('Type').''; + $data[3] = ''.__('Warning').'/'.'
'.__('Critical').'
'; + $data[4] = ''.__('Threshold').''; + $data[5] = ''.__('Group').''; + $data[6] = ''.__('Description').''; + $data[7] = ''.__('Interval').''; + $data[8] = ''.__('Unit').''; + $data[9] = ''.__('Status').''; + $data[10] = ''.__('Tags').''; - $table->style[0] = 'text-align: left'; - $table->style[1] = 'text-align: center'; + $table->style[0] = 'width:10px'; + $table->style[1] = 'text-align: left'; $table->style[2] = 'text-align: center'; $table->style[3] = 'text-align: center'; $table->style[4] = 'text-align: center'; - $table->style[5] = 'text-align: left'; - $table->style[6] = 'text-align: center'; + $table->style[5] = 'text-align: center'; + $table->style[6] = 'text-align: left'; $table->style[7] = 'text-align: center'; - $table->style[8] = 'text-align: left'; + $table->style[8] = 'text-align: center'; $table->style[9] = 'text-align: left'; + $table->style[10] = 'text-align: left'; array_push ($table->data, $data); @@ -4720,28 +4730,30 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $data = array(); + $data[0] = ''; + if ($data_module['disabled'] == 0) $disabled = ''; else $disabled = ' (Disabled)'; - $data[0] = $data_module['nombre'].$disabled; - $data[1] = ui_print_moduletype_icon ($data_module['id_tipo_modulo'], true); - $data[2] = $data_module['max_warning'].'/'.$data_module['min_warning'].' - '.$data_module['max_critical'].'/'.$data_module['min_critical']; - $data[3] = $data_module['module_ff_interval']; - $data[4] = groups_get_name ($content['id_group'], true); - $data[5] = $data_module['descripcion']; + $data[1] = $data_module['nombre'].$disabled; + $data[2] = ui_print_moduletype_icon ($data_module['id_tipo_modulo'], true); + $data[3] = $data_module['max_warning'].'/'.$data_module['min_warning'].'
'.$data_module['max_critical'].'/'.$data_module['min_critical']; + $data[4] = $data_module['module_ff_interval']; + $data[5] = groups_get_name ($content['id_group'], true); + $data[6] = $data_module['descripcion']; if (($data_module['module_interval'] == 0) || ($data_module['module_interval'] == '')) - $data[6] = db_get_value('intervalo', 'tagente', 'id_agente', $content['id_agent']); + $data[7] = db_get_value('intervalo', 'tagente', 'id_agente', $content['id_agent']); else - $data[6] = $data_module['module_interval']; + $data[7] = $data_module['module_interval']; - $data[7] = $data_module['unit']; + $data[8] = $data_module['unit']; $module_status = db_get_row('tagente_estado', 'id_agente_modulo', $id_agent_module); modules_get_status($id_agent_module, $module_status['estado'], $module_status['datos'], $status, $title); - $data[8] = ui_print_status_image($status, $title, true); + $data[9] = ui_print_status_image($status, $title, true); $sql_tag = "SELECT name FROM ttag WHERE id_tag IN ( SELECT id_tag FROM ttag_module @@ -4752,7 +4764,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f else $tags = implode (",", $tags); - $data[9] = $tags; + $data[10] = $tags; array_push ($table->data, $data); $i++; diff --git a/pandora_console/operation/reporting/reporting_xml.php b/pandora_console/operation/reporting/reporting_xml.php index 48865411ec..3cdfbde608 100644 --- a/pandora_console/operation/reporting/reporting_xml.php +++ b/pandora_console/operation/reporting/reporting_xml.php @@ -65,6 +65,18 @@ function write_xml_file_agent_data ($agent_data = array(), $file_temp) { $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) { + $content_report .= " <".$field['name'].">".$field['description']."<".$field['name'].">\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";