2010-04-27 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_reporting.php: cleaned source code of
	"render_report_html_item" function for new types of report items.

	* include/functions.php: cleaned source code of "get_report_types" function
	and added new types of report items.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2614 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2010-04-27 10:51:17 +00:00
parent b44e7fb935
commit 4d4b3088b5
3 changed files with 402 additions and 385 deletions

View File

@ -1,9 +1,17 @@
2010-04-27 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_reporting.php: cleaned source code of
"render_report_html_item" function for new types of report items.
* include/functions.php: cleaned source code of "get_report_types" function
and added new types of report items.
2010-04-27 Sergio Martin <sergio.martin@artica.es> 2010-04-27 Sergio Martin <sergio.martin@artica.es>
* pandoradb_data.sql: Changed the group All values * pandoradb_data.sql: Changed the group All values
on tables with default group form 1 to 0 on tables with default group form 1 to 0
2010-04-26 Miguel de Dios <miguel.dedios@artica.es> 2010-04-27 Miguel de Dios <miguel.dedios@artica.es>
* operation/agentes/ver_agente.php: removed hack for translate "any" text. * operation/agentes/ver_agente.php: removed hack for translate "any" text.

View File

@ -619,11 +619,6 @@ function get_report_types () {
$types['min_value'] = __('Min. Value'); $types['min_value'] = __('Min. Value');
$types['sumatory'] = __('Sumatory'); $types['sumatory'] = __('Sumatory');
$types['agent_detailed'] = __('Agent detailed view'); $types['agent_detailed'] = __('Agent detailed view');
// $types['agent_detailed_event'] = __('Agent detailed event');
// $types['list_events_module'] = __('List events of module');
// $types['list_events_agent'] = __('List events of agent');
// $types['list_alerts_agent'] = __('List alerts of agent');
// $types['list_alerts_module'] = __('List alerts of module');
$types['text'] = __('Text'); $types['text'] = __('Text');
$types['sql'] = __('SQL query'); $types['sql'] = __('SQL query');
$types['url'] = __('Import text from URL'); $types['url'] = __('Import text from URL');
@ -632,15 +627,20 @@ function get_report_types () {
$types['TTO'] = __('TTO'); $types['TTO'] = __('TTO');
$types['MTBF'] = __('MTBF'); $types['MTBF'] = __('MTBF');
$types['MTTR'] = __('MTTR'); $types['MTTR'] = __('MTTR');
$types['alert_report_module'] = __('Alert report module');
$types['alert_report_agent'] = __('Alert report agent');
$types['event_report_agent'] = __('Event report agent');
$types['event_report_module'] = __('Event report module');
// $types['agent_detailed_event'] = __('Agent detailed event');
// $types['list_events_module'] = __('List events of module');
// $types['list_events_agent'] = __('List events of agent');
// $types['list_alerts_agent'] = __('List alerts of agent');
// $types['list_alerts_module'] = __('List alerts of module');
// $types['agent_detailed_event_pie_char'] = __('Agent detailed pie chart events'); // $types['agent_detailed_event_pie_char'] = __('Agent detailed pie chart events');
// $types['agent_detailed_event_last_hours'] = __('Agent detailed event in last hours'); // $types['agent_detailed_event_last_hours'] = __('Agent detailed event in last hours');
// $types['agent_detailed_alert_last_hours'] = __('Agent detailed alerts in last hours'); // $types['agent_detailed_alert_last_hours'] = __('Agent detailed alerts in last hours');
// $types['agent_detailed_num_modules'] = __('Agent detailed num modules'); // $types['agent_detailed_num_modules'] = __('Agent detailed num modules');
// $types['agent_detailed_num_alerts'] = __('Agent detailed num alerts'); // $types['agent_detailed_num_alerts'] = __('Agent detailed num alerts');
$types['alert_report_module'] = __('Alert report module');
$types['alert_report_agent'] = __('Alert report agent');
$types['event_report_agent'] = __('Event report agent');
$types['event_report_module'] = __('Event report module');
return $types; return $types;
} }

View File

@ -1179,15 +1179,16 @@ function get_agent_module_info_with_filter ($id_agent,$filter = '') {
* *
*/ */
function render_report_html_item ($content, $table, $report){ function render_report_html_item ($content, $table, $report) {
global $config; global $config;
$module_name = get_db_value ('nombre', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module']); $module_name = get_db_value ('nombre', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module']); debugPrint($module_name);
$agent_name = get_agentmodule_agent_name ($content['id_agent_module']); $agent_name = get_agentmodule_agent_name ($content['id_agent_module']);
switch ($content["type"]) { switch ($content["type"]) {
case 1: case 1:
case 'simple_graph': case 'simple_graph':
//RUNNING
$table->colspan[1][0] = 4; $table->colspan[1][0] = 4;
$data = array (); $data = array ();
$data[0] = '<h4>'.__('Simple graph').'</h4>'; $data[0] = '<h4>'.__('Simple graph').'</h4>';
@ -1208,8 +1209,10 @@ function render_report_html_item ($content, $table, $report){
array_push ($table->data, $data); array_push ($table->data, $data);
break; break;
case 2: case 2:
case 'custom_graph': case 'custom_graph':
//RUNNING
$graph = get_db_row ("tgraph", "id_graph", $content['id_gs']); $graph = get_db_row ("tgraph", "id_graph", $content['id_gs']);
$data = array (); $data = array ();
$data[0] = '<h4>'.__('Custom graph').'</h4>'; $data[0] = '<h4>'.__('Custom graph').'</h4>';
@ -1248,7 +1251,7 @@ function render_report_html_item ($content, $table, $report){
break; break;
case 3: case 3:
case 'SLA': case 'SLA':
//RUNNING
$table->style[1] = 'text-align: right'; $table->style[1] = 'text-align: right';
$data = array (); $data = array ();
$data[0] = '<h4>'.__('S.L.A.').'</h4>'; $data[0] = '<h4>'.__('S.L.A.').'</h4>';
@ -1317,56 +1320,57 @@ function render_report_html_item ($content, $table, $report){
} }
break; break;
case 4: // case 4:
case 'event_report': // case 'event_report':
$id_agent = get_agent_id ($agent_name); // $id_agent = get_agent_id ($agent_name);
$data = array (); // $data = array ();
$data[0] = "<h4>".__('Event report')."</h4>"; // $data[0] = "<h4>".__('Event report')."</h4>";
$data[1] = "<h4>".human_time_description ($content['period'])."</h4>"; // $data[1] = "<h4>".human_time_description ($content['period'])."</h4>";
array_push ($table->data, $data); // array_push ($table->data, $data);
//
// Put description at the end of the module (if exists) // // Put description at the end of the module (if exists)
if ($content["description"] != ""){ // if ($content["description"] != ""){
$table->colspan[1][0] = 3; // $table->colspan[1][0] = 3;
$data_desc = array(); // $data_desc = array();
$data_desc[0] = $content["description"]; // $data_desc[0] = $content["description"];
array_push ($table->data, $data_desc); // array_push ($table->data, $data_desc);
} // }
//
$table->colspan[2][0] = 3; // $table->colspan[2][0] = 3;
$data = array (); // $data = array ();
$table_report = event_reporting ($report['id_group'], $content['period'], $report["datetime"], true); // $table_report = event_reporting ($report['id_group'], $content['period'], $report["datetime"], true);
//
$table_report->class = 'databox'; // $table_report->class = 'databox';
$table_report->width = '100%'; // $table_report->width = '100%';
$data[0] = print_table ($table_report, true); // $data[0] = print_table ($table_report, true);
array_push ($table->data, $data); // array_push ($table->data, $data);
//
break; // break;
case 5: // case 5:
case 'alert_report': // case 'alert_report':
$data = array (); // $data = array ();
$data[0] = "<h4>".__('Alert report')."</h4>"; // $data[0] = "<h4>".__('Alert report')."</h4>";
$data[1] = "<h4>".$report["group_name"]."</h4>"; // $data[1] = "<h4>".$report["group_name"]."</h4>";
$data[2] = "<h4>".human_time_description ($content['period'])."</h4>"; // $data[2] = "<h4>".human_time_description ($content['period'])."</h4>";
array_push ($table->data, $data); // array_push ($table->data, $data);
//
// Put description at the end of the module (if exists) // // Put description at the end of the module (if exists)
if ($content["description"] != ""){ // if ($content["description"] != ""){
$table->colspan[1][0] = 3; // $table->colspan[1][0] = 3;
$data_desc = array(); // $data_desc = array();
$data_desc[0] = $content["description"]; // $data_desc[0] = $content["description"];
array_push ($table->data, $data_desc); // array_push ($table->data, $data_desc);
} // }
//
$data = array (); // $data = array ();
$table->colspan[2][0] = 3; // $table->colspan[2][0] = 3;
$data[0] = alert_reporting ($report['id_group'], $content['period'], $report["datetime"], true); // $data[0] = alert_reporting ($report['id_group'], $content['period'], $report["datetime"], true);
array_push ($table->data, $data); // array_push ($table->data, $data);
//
break; // break;
case 6: case 6:
case 'monitor_report': case 'monitor_report':
//RUNNING
$data = array (); $data = array ();
$data[0] = "<h4>".__('Monitor report')."</h4>"; $data[0] = "<h4>".__('Monitor report')."</h4>";
$data[1] = "<h4>$agent_name - $module_name</h4>"; $data[1] = "<h4>$agent_name - $module_name</h4>";
@ -1393,6 +1397,7 @@ function render_report_html_item ($content, $table, $report){
break; break;
case 7: case 7:
case 'avg_value': case 'avg_value':
//RUNNING
$data = array (); $data = array ();
$data[0] = "<h4>".__('Avg. Value')."</h4>"; $data[0] = "<h4>".__('Avg. Value')."</h4>";
$data[1] = "<h4>$agent_name - $module_name</h4>"; $data[1] = "<h4>$agent_name - $module_name</h4>";
@ -1416,6 +1421,7 @@ function render_report_html_item ($content, $table, $report){
break; break;
case 8: case 8:
case 'max_value': case 'max_value':
//RUNNING
$data = array (); $data = array ();
$data[0] = "<h4>".__('Max. Value')."</h4>"; $data[0] = "<h4>".__('Max. Value')."</h4>";
$data[1] = "<h4>$agent_name - $module_name</h4>"; $data[1] = "<h4>$agent_name - $module_name</h4>";
@ -1439,6 +1445,7 @@ function render_report_html_item ($content, $table, $report){
break; break;
case 9: case 9:
case 'min_value': case 'min_value':
//RUNNING
$data = array (); $data = array ();
$data[0] = "<h4>".__('Min. Value')."</h4>"; $data[0] = "<h4>".__('Min. Value')."</h4>";
$data[1] = "<h4>$agent_name - $module_name</h4>"; $data[1] = "<h4>$agent_name - $module_name</h4>";
@ -1462,6 +1469,7 @@ function render_report_html_item ($content, $table, $report){
break; break;
case 10: case 10:
case 'sumatory': case 'sumatory':
//RUNNING
$data = array (); $data = array ();
$data[0] = "<h4>".__('Sumatory')."</h4>"; $data[0] = "<h4>".__('Sumatory')."</h4>";
$data[1] = "<h4>$agent_name - $module_name</h4>"; $data[1] = "<h4>$agent_name - $module_name</h4>";
@ -1483,72 +1491,73 @@ function render_report_html_item ($content, $table, $report){
array_push ($table->data, $data); array_push ($table->data, $data);
break; break;
case 11: // case 11:
case 'general_group_report': // case 'general_group_report':
$data = array (); // $data = array ();
$data[0] = "<h4>".__('Group')."</h4>"; // $data[0] = "<h4>".__('Group')."</h4>";
$data[1] = "<h4>".$report["group_name"]."</h4>"; // $data[1] = "<h4>".$report["group_name"]."</h4>";
array_push ($table->data, $data); // array_push ($table->data, $data);
//
// Put description at the end of the module (if exists) // // Put description at the end of the module (if exists)
if ($content["description"] != ""){ // if ($content["description"] != ""){
$table->colspan[0][0] = 2; // $table->colspan[0][0] = 2;
$data_desc = array(); // $data_desc = array();
$data_desc[0] = $content["description"]; // $data_desc[0] = $content["description"];
array_push ($table->data, $data_desc); // array_push ($table->data, $data_desc);
} // }
//
$data = array (); // $data = array ();
$table->colspan[1][0] = 2; // $table->colspan[1][0] = 2;
$data[0] = print_group_reporting ($report['id_group'], true); // $data[0] = print_group_reporting ($report['id_group'], true);
array_push ($table->data, $data); // array_push ($table->data, $data);
//
break; // break;
case 12: // case 12:
case 'monitor_health': // case 'monitor_health':
$data = array (); // $data = array ();
$data[0] = "<h4>".__('Monitor health')."</h4>"; // $data[0] = "<h4>".__('Monitor health')."</h4>";
$data[1] = "<h4>".$report["group_name"]."</h4>"; // $data[1] = "<h4>".$report["group_name"]."</h4>";
$data[2] = "<h4>".human_time_description ($content['period'])."</h4>"; // $data[2] = "<h4>".human_time_description ($content['period'])."</h4>";
array_push ($table->data, $data); // array_push ($table->data, $data);
//
// Put description at the end of the module (if exists) // // Put description at the end of the module (if exists)
if ($content["description"] != ""){ // if ($content["description"] != ""){
$table->colspan[0][0] = 4; // $table->colspan[0][0] = 4;
$data_desc = array(); // $data_desc = array();
$data_desc[0] = $content["description"]; // $data_desc[0] = $content["description"];
array_push ($table->data, $data_desc); // array_push ($table->data, $data_desc);
} // }
//
$data = array (); // $data = array ();
$table->colspan[1][0] = 4; // $table->colspan[1][0] = 4;
$data[0] = monitor_health_reporting ($report['id_group'], $content['period'], $report["datetime"], true); // $data[0] = monitor_health_reporting ($report['id_group'], $content['period'], $report["datetime"], true);
array_push ($table->data, $data); // array_push ($table->data, $data);
//
break; // break;
case 13: // case 13:
case 'agents_detailed': // case 'agents_detailed':
$data = array (); // $data = array ();
$data[0] = "<h4>".__('Agents detailed view')."</h4>"; // $data[0] = "<h4>".__('Agents detailed view')."</h4>";
$data[1] = "<h4>".$report["group_name"]."</h4>"; // $data[1] = "<h4>".$report["group_name"]."</h4>";
array_push ($table->data, $data); // array_push ($table->data, $data);
//
// Put description at the end of the module (if exists) // // Put description at the end of the module (if exists)
if ($content["description"] != ""){ // if ($content["description"] != ""){
$table->colspan[0][0] = 2; // $table->colspan[0][0] = 2;
$data_desc = array(); // $data_desc = array();
$data_desc[0] = $content["description"]; // $data_desc[0] = $content["description"];
array_push ($table->data, $data_desc); // array_push ($table->data, $data_desc);
} // }
//
$table->colspan[0][0] = 2; // $table->colspan[0][0] = 2;
$data = array (); // $data = array ();
$table->colspan[1][0] = 3; // $table->colspan[1][0] = 3;
$data[0] = get_group_agents_detailed_reporting ($report['id_group'], $content['period'], $report["datetime"], true); // $data[0] = get_group_agents_detailed_reporting ($report['id_group'], $content['period'], $report["datetime"], true);
array_push ($table->data, $data); // array_push ($table->data, $data);
break; // break;
case 'agent_detailed_event': case 'agent_detailed_event':
case 'event_report_agent':
//RUNNING
$data = array (); $data = array ();
$data[0] = "<h4>".__('Agent detailed event')."</h4>"; $data[0] = "<h4>".__('Agent detailed event')."</h4>";
$data[1] = "<h4>".get_agent_name($content['id_agent'])."</h4>"; $data[1] = "<h4>".get_agent_name($content['id_agent'])."</h4>";