2012-10-30 Vanessa Gil <vanessa.gil@artica.es>

* include/functions_reporting.php: Changed format of agent 
	and group configuration reports.
	*operation/reporting/reporting_xml.php: Added custom field
	to xml report.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7112 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
vgilc 2012-10-30 10:31:03 +00:00
parent 9dc56e9f37
commit 183338dcf8
3 changed files with 106 additions and 75 deletions

View File

@ -1,3 +1,10 @@
2012-10-30 Vanessa Gil <vanessa.gil@artica.es>
* 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 <kosaka@rworks.jp>
* include/functions_api.php: added 'description' parameter to

View File

@ -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] = '<b>'.__('Agent name').'</b>';
@ -4509,11 +4509,11 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$data[3] = '<b>'.__('IP').'</b>';
$data[4] = '<b>'.__('Description').'</b>';
$data[5] = '<b>'.__('Status').'</b>';
$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] = '<b>'.agents_get_name ($content['id_agent'], 'upper').__(' MODULES').'</b>';
$data[1] = '';
$table->colspan[3][1] = 9;
$data[0] = '';
$data[1] = '<b>'.agents_get_name ($content['id_agent'], 'upper').__(' MODULES').'</b>';
$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] = '<b>'.__('Name').'</b>';
$data[1] = '<b>'.__('Type').'</b>';
$data[2] = '<b>'.__('Warning/Critical').'</b>';
$data[3] = '<b>'.__('Threshold').'</b>';
$data[4] = '<b>'.__('Group').'</b>';
$data[5] = '<b>'.__('Description').'</b>';
$data[6] = '<b>'.__('Interval').'</b>';
$data[7] = '<b>'.__('Unit').'</b>';
$data[8] = '<b>'.__('Status').'</b>';
$data[9] = '<b>'.__('Tags').'</b>';
$data[0] = '';
$data[1] = '<b>'.__('Name').'</b>';
$data[2] = '<b>'.__('Type').'</b>';
$data[3] = '<b>'.__('Warning').'/'.'<br>'.__('Critical').'</b>';
$data[4] = '<b>'.__('Threshold').'</b>';
$data[5] = '<b>'.__('Group').'</b>';
$data[6] = '<b>'.__('Description').'</b>';
$data[7] = '<b>'.__('Interval').'</b>';
$data[8] = '<b>'.__('Unit').'</b>';
$data[9] = '<b>'.__('Status').'</b>';
$data[10] = '<b>'.__('Tags').'</b>';
$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'].' <br> '.$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] = '<b>'.agents_get_name ($agent['id_agente'], 'upper').__(' MODULES').'</b>';
$data[1] = '';
$table->colspan[$i][1] = 9;
$data[0] = '';
$data[1] = '<b>'.agents_get_name ($agent['id_agente'], 'upper').__(' MODULES').'</b>';
$table->colspan[$i][1] = 10;
$i++;
array_push ($table->data, $data);
unset($data);
$data[0] = '<b>'.__('Name').'</b>';
$data[1] = '<b>'.__('Type').'</b>';
$data[2] = '<b>'.__('Warning/Critical').'</b>';
$data[3] = '<b>'.__('Threshold').'</b>';
$data[4] = '<b>'.__('Group').'</b>';
$data[5] = '<b>'.__('Description').'</b>';
$data[6] = '<b>'.__('Interval').'</b>';
$data[7] = '<b>'.__('Unit').'</b>';
$data[8] = '<b>'.__('Status').'</b>';
$data[9] = '<b>'.__('Tags').'</b>';
$data[0] = '';
$data[1] = '<b>'.__('Name').'</b>';
$data[2] = '<b>'.__('Type').'</b>';
$data[3] = '<b>'.__('Warning').'/'.'<br>'.__('Critical').'</b>';
$data[4] = '<b>'.__('Threshold').'</b>';
$data[5] = '<b>'.__('Group').'</b>';
$data[6] = '<b>'.__('Description').'</b>';
$data[7] = '<b>'.__('Interval').'</b>';
$data[8] = '<b>'.__('Unit').'</b>';
$data[9] = '<b>'.__('Status').'</b>';
$data[10] = '<b>'.__('Tags').'</b>';
$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'].' <br> '.$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++;

View File

@ -65,6 +65,18 @@ function write_xml_file_agent_data ($agent_data = array(), $file_temp) {
$content_report .= " <main_ipaddress>".$agent_data['direccion']."</main_ipaddress>\n";
$content_report .= " <group>".$agent_data['id_grupo']."</group>\n";
$content_report .= " <interval>". $agent_data['intervalo']."</interval>\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 .= " <os_type>".$agent_data['id_os']."</os_type>\n";
$content_report .= " <parent>". agents_get_name ($agent_data['id_parent'])."</parent>\n";
$content_report .= " <extra_id>".$agent_data['id_extra']."</extra_id>\n";