Add percentil 95 a simple graph in reports.

This commit is contained in:
m-lopez-f 2016-10-06 08:58:53 +02:00
parent 0fd78ee4a0
commit c98a4be8fa
4 changed files with 59 additions and 10 deletions

View File

@ -91,6 +91,7 @@ $inventory_modules = array();
$date = null; $date = null;
// Only avg is selected by default for the simple graphs // Only avg is selected by default for the simple graphs
$only_avg = true; $only_avg = true;
$percentil_95 = false;
$time_compare_overlapped = false; $time_compare_overlapped = false;
//Added for events items //Added for events items
@ -191,6 +192,7 @@ switch ($action) {
case 'simple_graph': case 'simple_graph':
$only_avg = isset($style['only_avg']) ? (bool) $style['only_avg'] : true; $only_avg = isset($style['only_avg']) ? (bool) $style['only_avg'] : true;
$percentil_95 = isset($style['percentil_95']) ? $style['percentil_95'] : 0;
// The break hasn't be forgotten. // The break hasn't be forgotten.
case 'simple_baseline_graph': case 'simple_baseline_graph':
case 'projection_graph': case 'projection_graph':
@ -909,7 +911,7 @@ $class = 'databox filters';
$params['javascript_is_function_select'] = true; $params['javascript_is_function_select'] = true;
$params['selectbox_id'] = 'id_agent_module'; $params['selectbox_id'] = 'id_agent_module';
$params['add_none_module'] = false; $params['add_none_module'] = true;
$params['use_hidden_input_idagent'] = true; $params['use_hidden_input_idagent'] = true;
$params['hidden_input_idagent_id'] = 'hidden-id_agent'; $params['hidden_input_idagent_id'] = 'hidden-id_agent';
if ($meta) { if ($meta) {
@ -1201,6 +1203,10 @@ $class = 'databox filters';
<td style="font-weight:bold;"><?php echo __('Only average');?></td> <td style="font-weight:bold;"><?php echo __('Only average');?></td>
<td><?php html_print_checkbox('only_avg', 1, $only_avg);?></td> <td><?php html_print_checkbox('only_avg', 1, $only_avg);?></td>
</tr> </tr>
<tr id="row_percentil" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Percentil 95');?></td>
<td><?php html_print_checkbox('percentil_95', 1, $percentil_95);?></td>
</tr>
<tr id="row_exception_condition_value" style="" class="datos"> <tr id="row_exception_condition_value" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Value'); ?></td> <td style="font-weight:bold;"><?php echo __('Value'); ?></td>
<td style=""> <td style="">
@ -1772,6 +1778,7 @@ function print_General_list($width, $action, $idItem = null, $type = 'general')
ui_require_javascript_file ('pandora_inventory', ENTERPRISE_DIR.'/include/javascript/'); ui_require_javascript_file ('pandora_inventory', ENTERPRISE_DIR.'/include/javascript/');
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready (function () { $(document).ready (function () {
chooseType(); chooseType();
@ -1788,6 +1795,37 @@ $(document).ready (function () {
currentText: '<?php echo __('Now');?>', currentText: '<?php echo __('Now');?>',
closeText: '<?php echo __('Close');?>' closeText: '<?php echo __('Close');?>'
}); });
$('#id_agent_module').change(function(){
var idModule = $(this).val();
var params = [];
params.push("get_type=1");
params.push("id_module=" + idModule);
params.push("page=include/ajax/module");
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action= <?php echo '"' . ui_get_full_url(false, false, false, false) . '"'; ?> + "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
console.log(data);
switch (data) {
case 'boolean':
case 'sparse':
$("#row_percentil").show();
break;
default:
$("#row_percentil").hide();
break;
}
}
});
});
}); });
function create_custom_graph() { function create_custom_graph() {
@ -2283,6 +2321,7 @@ function chooseType() {
$("#row_resolution").hide(); $("#row_resolution").hide();
$("#row_last_value").hide(); $("#row_last_value").hide();
$("#row_filter_search").hide(); $("#row_filter_search").hide();
$("#row_percentil").hide();
// SLA list default state // SLA list default state
$("#sla_list").hide(); $("#sla_list").hide();
@ -2318,6 +2357,8 @@ function chooseType() {
case 'simple_graph': case 'simple_graph':
$("#row_time_compare_overlapped").show(); $("#row_time_compare_overlapped").show();
$("#row_only_avg").show(); $("#row_only_avg").show();
if ($("#checkbox-percentil_95").prop("checked"))
$("#row_percentil").show();
// The break hasn't be forgotten, this element // The break hasn't be forgotten, this element
// only should be shown on the simple graphs. // only should be shown on the simple graphs.
case 'simple_baseline_graph': case 'simple_baseline_graph':
@ -2802,7 +2843,7 @@ function chooseType() {
$("#row_label").show(); $("#row_label").show();
break; break;
default: default:
break;
} }
} }

View File

@ -1149,6 +1149,7 @@ switch ($action) {
// Warning. We are using this column to hold this value to avoid // Warning. We are using this column to hold this value to avoid
// the modification of the database for compatibility reasons. // the modification of the database for compatibility reasons.
$style['only_avg'] = (int) get_parameter('only_avg'); $style['only_avg'] = (int) get_parameter('only_avg');
$style['percentil_95'] = (int) get_parameter('percentil_95');
if ($label != '') if ($label != '')
$style['label'] = $label; $style['label'] = $label;
else else
@ -1466,6 +1467,7 @@ switch ($action) {
// Warning. We are using this column to hold this value to avoid // Warning. We are using this column to hold this value to avoid
// the modification of the database for compatibility reasons. // the modification of the database for compatibility reasons.
$style['only_avg'] = (int) get_parameter('only_avg'); $style['only_avg'] = (int) get_parameter('only_avg');
$style['percentil_95'] = (int) get_parameter('percentil_95');
if ($label != '') if ($label != '')
$style['label'] = $label; $style['label'] = $label;
else else

View File

@ -30,6 +30,7 @@ $add_module_relation = (bool) get_parameter('add_module_relation');
$remove_module_relation = (bool) get_parameter('remove_module_relation'); $remove_module_relation = (bool) get_parameter('remove_module_relation');
$change_module_relation_updates = (bool) get_parameter('change_module_relation_updates'); $change_module_relation_updates = (bool) get_parameter('change_module_relation_updates');
$get_id_tag = (bool) get_parameter('get_id_tag', 0); $get_id_tag = (bool) get_parameter('get_id_tag', 0);
$get_type = (bool) get_parameter('get_type', 0);
$list_modules = (bool) get_parameter('list_modules', 0); $list_modules = (bool) get_parameter('list_modules', 0);
@ -50,7 +51,6 @@ if ($get_plugin_macros) {
return; return;
} }
if ($search_modules) { if ($search_modules) {
if ( https_is_running() ) { if ( https_is_running() ) {
header('Content-type: application/json'); header('Content-type: application/json');
@ -72,7 +72,6 @@ if ($search_modules) {
return; return;
} }
if ($get_module_detail) { if ($get_module_detail) {
// This script is included manually to be included after jquery and avoid error // This script is included manually to be included after jquery and avoid error
ui_include_time_picker(); ui_include_time_picker();
@ -317,7 +316,6 @@ if ($get_module_detail) {
return; return;
} }
if ($get_module_autocomplete_input) { if ($get_module_autocomplete_input) {
$id_agent = (int) get_parameter("id_agent"); $id_agent = (int) get_parameter("id_agent");
@ -330,7 +328,6 @@ if ($get_module_autocomplete_input) {
return; return;
} }
if ($add_module_relation) { if ($add_module_relation) {
$result = false; $result = false;
$id_module_a = (int) get_parameter("id_module_a"); $id_module_a = (int) get_parameter("id_module_a");
@ -364,7 +361,6 @@ if ($add_module_relation) {
return; return;
} }
if ($remove_module_relation) { if ($remove_module_relation) {
$id_relation = (int) get_parameter("id_relation"); $id_relation = (int) get_parameter("id_relation");
if ($id_relation > 0) { if ($id_relation > 0) {
@ -375,7 +371,6 @@ if ($remove_module_relation) {
return; return;
} }
if ($change_module_relation_updates) { if ($change_module_relation_updates) {
$id_relation = (int) get_parameter("id_relation"); $id_relation = (int) get_parameter("id_relation");
if ($id_relation > 0) { if ($id_relation > 0) {
@ -386,7 +381,6 @@ if ($change_module_relation_updates) {
return; return;
} }
if ($get_id_tag) { if ($get_id_tag) {
$tag_name = get_parameter('tag_name'); $tag_name = get_parameter('tag_name');
@ -1054,4 +1048,13 @@ if ($list_modules) {
} }
if ($get_type) {
$id_module = (int) get_parameter("id_module");
$module = modules_get_agentmodule($id_module);
$graph_type = return_graphtype ($module["id_tipo_modulo"]);
echo $graph_type;
return;
}
?> ?>

View File

@ -4535,7 +4535,10 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
false, false,
'', '',
$time_compare_overlapped, $time_compare_overlapped,
true); true,
true,
'white',
($content['style']['percentil_95'] == 1) ? 95 : null);
} }
break; break;
case 'data': case 'data':