2013-05-23 Miguel de Dios <miguel.dedios@artica.es>

* godmode/reporting/reporting_builder.item_editor.php,
	include/functions_reporting.php: change the title of "avg" for
	the real "rate".
	
	Fixes: #2223




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8197 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-05-23 14:25:57 +00:00
parent b8c07fda76
commit 4310835323
3 changed files with 74 additions and 32 deletions

View File

@ -1,11 +1,19 @@
2013-05-23 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_reporting.php: change the title of "avg" for
the real "rate".
Fixes: #2223
2013-05-23 Miguel de Dios <miguel.dedios@artica.es> 2013-05-23 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/reporting_builder.item_editor.php: fixed ACL for * godmode/reporting/reporting_builder.item_editor.php: fixed ACL for
the custom graphs. the custom graphs.
Fixes: #2233 Fixes: #2233
MERGED FROM THE BRANCH 4 MERGED FROM THE BRANCH 4
2013-05-23 Miguel de Dios <miguel.dedios@artica.es> 2013-05-23 Miguel de Dios <miguel.dedios@artica.es>

View File

@ -1309,7 +1309,13 @@ function print_General_list($width, $action, $idItem = null) {
?> ?>
</td> </td>
<td><select id="id_agent_module_general" name="id_agente_modulo_general" disabled="disabled" style="max-width: 180px"><option value="0"><?php echo __('Select an Agent first'); ?></option></select></td> <td><select id="id_agent_module_general" name="id_agente_modulo_general" disabled="disabled" style="max-width: 180px"><option value="0"><?php echo __('Select an Agent first'); ?></option></select></td>
<?php $operation = array ('avg'=>'avg','max'=>'max','min'=>'min','sum'=>'sum'); ?> <?php
$operation = array(
'avg' => __('rate'),
'max' => __('max'),
'min' => __('min'),
'sum' => __('sum'));
?>
<td><?php html_print_select ($operation, 'id_operation_module_general', 0, false, '', '', false, false, true, 'width: 200px', false); ?></td> <td><?php html_print_select ($operation, 'id_operation_module_general', 0, false, '', '', false, false, true, 'width: 200px', false); ?></td>
<td style="text-align: center;"><a href="javascript: addGeneralRow();"><?php html_print_image("images/disk.png", false); ?></a></td> <td style="text-align: center;"><a href="javascript: addGeneralRow();"><?php html_print_image("images/disk.png", false); ?></a></td>
</tr> </tr>

View File

@ -4483,17 +4483,25 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
switch ($row['operation']) { switch ($row['operation']) {
case 'sum': case 'sum':
$data_res[$key] = reporting_get_agentmodule_data_sum ($row['id_agent_module'], $content['period'], $report["datetime"]); $data_res[$key] =
break; reporting_get_agentmodule_data_sum(
$row['id_agent_module'], $content['period'], $report["datetime"]);
break;
case 'max': case 'max':
$data_res[$key] = reporting_get_agentmodule_data_max ($row['id_agent_module'], $content['period']); $data_res[$key] =
break; reporting_get_agentmodule_data_max(
$row['id_agent_module'], $content['period']);
break;
case 'min': case 'min':
$data_res[$key] = reporting_get_agentmodule_data_min ($row['id_agent_module'], $content['period']); $data_res[$key] =
break; reporting_get_agentmodule_data_min(
$row['id_agent_module'], $content['period']);
break;
case 'avg': case 'avg':
default: default:
$data_res[$key] = reporting_get_agentmodule_data_average ($row['id_agent_module'], $content['period']); $data_res[$key] =
reporting_get_agentmodule_data_average(
$row['id_agent_module'], $content['period']);
break; break;
} }
@ -4535,7 +4543,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
} }
$i=0; $i = 0;
foreach ($data_res as $d) { foreach ($data_res as $d) {
$data = array(); $data = array();
$data[0] = $agent_name[$i]; $data[0] = $agent_name[$i];
@ -4553,7 +4561,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
break; break;
case 'avg': case 'avg':
default: default:
$op = __('Average'); $op = __('Rate');
break; break;
} }
$data[2] = $op; $data[2] = $op;
@ -5201,34 +5209,47 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$table->style[1] = 'text-align: right'; $table->style[1] = 'text-align: right';
$title_exeption = __('Exception');
switch ($exception_condition) { switch ($exception_condition) {
case REPORT_EXCEPTION_CONDITION_EVERYTHING: case REPORT_EXCEPTION_CONDITION_EVERYTHING:
$title_exeption .= ' - '.__('Everything'); $title_exeption = __('Exception - Everything');
break; break;
case REPORT_EXCEPTION_CONDITION_GE: case REPORT_EXCEPTION_CONDITION_GE:
$title_exeption .= ' - '.__('Modules over or equal to').' '.$exception_condition_value; $title_exeption =
sprintf(__('Exception - Modules over or equal to %s'),
$exception_condition_value);
break; break;
case REPORT_EXCEPTION_CONDITION_LE: case REPORT_EXCEPTION_CONDITION_LE:
$title_exeption .= ' - '.__('Modules under or equal to').' '.$exception_condition_value; $title_exeption =
sprintf(__('Exception - Modules under or equal to %s'),
$exception_condition_value);
break; break;
case REPORT_EXCEPTION_CONDITION_L: case REPORT_EXCEPTION_CONDITION_L:
$title_exeption .= ' - '.__('Modules under').' '.$exception_condition_value; $title_exeption =
sprintf(__('Exception - Modules under %s'),
$exception_condition_value);
break; break;
case REPORT_EXCEPTION_CONDITION_G: case REPORT_EXCEPTION_CONDITION_G:
$title_exeption .= ' - '.__('Modules over').' '.$exception_condition_value; $title_exeption =
sprintf(__('Exception - Modules over %s'),
$exception_condition_value);
break; break;
case REPORT_EXCEPTION_CONDITION_E: case REPORT_EXCEPTION_CONDITION_E:
$title_exeption .= ' - '.__('Equal to').' '.$exception_condition_value; $title_exeption =
sprintf(__('Exception - Equal to'),
$exception_condition_value);
break; break;
case REPORT_EXCEPTION_CONDITION_NE: case REPORT_EXCEPTION_CONDITION_NE:
$title_exeption .= ' - '.__('Not equal to').' '.$exception_condition_value; $title_exeption =
sprintf(__('Exception - Not equal to %s'),
$exception_condition_value);
break; break;
case REPORT_EXCEPTION_CONDITION_OK: case REPORT_EXCEPTION_CONDITION_OK:
$title_exeption .= ' - '.__('Modules at normal status'); $title_exeption =
__('Exception - Modules at normal status');
break; break;
case REPORT_EXCEPTION_CONDITION_NOT_OK: case REPORT_EXCEPTION_CONDITION_NOT_OK:
$title_exeption .= ' - '.__('Modules at critical or warning status'); $title_exeption =
__('Exception - Modules at critical or warning status');
break; break;
} }
@ -5242,7 +5263,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
array_push ($table->data, $data_desc); array_push ($table->data, $data_desc);
} }
//Get all the related data //Get all the related data
$sql = sprintf("SELECT id_agent_module, server_name, operation $sql = sprintf("
SELECT id_agent_module, server_name, operation
FROM treport_content_item FROM treport_content_item
WHERE id_report_content = %d", $content['id_rc']); WHERE id_report_content = %d", $content['id_rc']);
@ -5284,13 +5306,13 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
switch ($exceptions[$i]['operation']) { switch ($exceptions[$i]['operation']) {
case 'avg': case 'avg':
$min = reporting_get_agentmodule_data_average ($exceptions[$i]['id_agent_module'], $content['period']); $min = reporting_get_agentmodule_data_average($exceptions[$i]['id_agent_module'], $content['period']);
break; break;
case 'max': case 'max':
$min = reporting_get_agentmodule_data_max ($exceptions[$i]['id_agent_module'], $content['period']); $min = reporting_get_agentmodule_data_max($exceptions[$i]['id_agent_module'], $content['period']);
break; break;
case 'min': case 'min':
$min = reporting_get_agentmodule_data_min ($exceptions[$i]['id_agent_module'], $content['period']); $min = reporting_get_agentmodule_data_min($exceptions[$i]['id_agent_module'], $content['period']);
break; break;
} }
$i++; $i++;
@ -5318,7 +5340,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$ag_name = modules_get_agentmodule_agent_name ($exc ['id_agent_module']); $ag_name = modules_get_agentmodule_agent_name ($exc ['id_agent_module']);
$mod_name = modules_get_agentmodule_name ($exc ['id_agent_module']); $mod_name = modules_get_agentmodule_name ($exc ['id_agent_module']);
$unit = db_get_value('unit', 'tagente_modulo', 'id_agente_modulo', $exc ['id_agent_module']); $unit = db_get_value('unit', 'tagente_modulo',
'id_agente_modulo', $exc['id_agent_module']);
switch ($exc['operation']) { switch ($exc['operation']) {
case 'avg': case 'avg':
@ -5389,7 +5412,12 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$agent_name[] = $ag_name; $agent_name[] = $ag_name;
$module_name[] = $mod_name; $module_name[] = $mod_name;
$units[] = $unit; $units[] = $unit;
$operation[] = $exc['operation']; if ($exc['operation'] == 'avg') {
$operation[] = "rate";
}
else {
$operation[] = $exc['operation'];
}
} }
//Restore dbconnection //Restore dbconnection
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) { if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
@ -5458,7 +5486,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
} }
if ($order_uptodown == 1 || $order_uptodown == 2) { if ($order_uptodown == 1 || $order_uptodown == 2) {
$j=0; $j = 0;
$data_pie_graph = array(); $data_pie_graph = array();
$data_hbar = array(); $data_hbar = array();
foreach ($data_exceptions as $dex) { foreach ($data_exceptions as $dex) {
@ -5476,13 +5504,13 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
} }
} }
else if ($order_uptodown == 0 || $order_uptodown == 3) { else if ($order_uptodown == 0 || $order_uptodown == 3) {
$j=0; $j = 0;
$data_pie_graph = array(); $data_pie_graph = array();
$data_hbar = array(); $data_hbar = array();
foreach ($agent_name as $an) { foreach ($agent_name as $an) {
$data_hbar[$an]['g'] = $data_exceptions[$j]; $data_hbar[$an]['g'] = $data_exceptions[$j];
$data_pie_graph[$an] = $data_exceptions[$j]; $data_pie_graph[$an] = $data_exceptions[$j];
if ($show_graph == 0 || $show_graph == 1) { if ($show_graph == 0 || $show_graph == 1) {
$data = array(); $data = array();
$data[0] = $an; $data[0] = $an;
$data[1] = $module_name[$j]; $data[1] = $module_name[$j];
@ -5512,7 +5540,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
array_push ($table->data, $data); array_push ($table->data, $data);
//Display bars graph //Display bars graph
$table->colspan[4][0] = 3; $table->colspan[4][0] = 3;
$height = count($data_pie_graph)*20+35; $height = count($data_pie_graph) * 20 + 35;
$data = array(); $data = array();
$data[0] = hbar_graph(false, $data_hbar, 600, $height, array(), array(), "", "", true, ui_get_full_url(false) . '/', $config['homedir'] . "/images/logo_vertical_water.png", '', '', true, 1, true); $data[0] = hbar_graph(false, $data_hbar, 600, $height, array(), array(), "", "", true, ui_get_full_url(false) . '/', $config['homedir'] . "/images/logo_vertical_water.png", '', '', true, 1, true);