add percentil dinamic ticket: 4262

This commit is contained in:
daniel 2016-12-23 09:36:44 +01:00
parent 0c656edcf8
commit e9fc39b53b
9 changed files with 26 additions and 22 deletions

View File

@ -91,7 +91,7 @@ $inventory_modules = array();
$date = null;
// Only avg is selected by default for the simple graphs
$only_avg = true;
$percentil_95 = false;
$percentil = false;
$time_compare_overlapped = false;
//Added for events items
@ -198,7 +198,7 @@ switch ($action) {
case 'simple_graph':
$only_avg = isset($style['only_avg']) ? (bool) $style['only_avg'] : true;
$percentil_95 = isset($style['percentil_95']) ? $style['percentil_95'] : 0;
$percentil = isset($style['percentil']) ? $config['percentil'] : 0;
// The break hasn't be forgotten.
case 'simple_baseline_graph':
case 'projection_graph':
@ -1261,8 +1261,8 @@ You can of course remove the warnings, that's why we include the source and do n
<td><?php html_print_checkbox('only_avg', 1, $only_avg);?></td>
</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>
<td style="font-weight:bold;"><?php echo __('Percentil');?></td>
<td><?php html_print_checkbox('percentil', 1, $percentil);?></td>
</tr>
<tr id="row_exception_condition_value" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Value'); ?></td>
@ -2531,7 +2531,7 @@ function chooseType() {
case 'simple_graph':
$("#row_time_compare_overlapped").show();
$("#row_only_avg").show();
if ($("#checkbox-percentil_95").prop("checked"))
if ($("#checkbox-percentil").prop("checked"))
$("#row_percentil").show();
// The break hasn't be forgotten, this element
// only should be shown on the simple graphs.

View File

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

View File

@ -464,6 +464,11 @@ $table_chars->data[$row][1] .= __('No').'&nbsp;' .
html_print_radio_button ('only_average', 0, '', $config["only_average"], true);
$row++;
$table_chars->data[$row][0] = __('Percentil');
$table_chars->data[$row][0] .= ui_print_help_tip(__('Allows only show the average in graphs'), true);
$table_chars->data[$row][1] = html_print_input_text ('percentil', $config['percentil'], '', 20, 20, true);
$row++;
echo "<fieldset>";
echo "<legend>" . __('Charts configuration') . "</legend>";
html_print_table ($table_chars);

View File

@ -1596,8 +1596,6 @@ function get_snmpwalk($ip_target, $snmp_version, $snmp_community = '',
break;
}
//html_debug_print($command_str);
exec($command_str, $output, $rc);
// Parse the output of snmpwalk

View File

@ -532,6 +532,8 @@ function config_update_config () {
if (!config_update_value ('click_display', (bool) get_parameter('click_display', false)))
$error_update[] = __('Display lateral menus with left click');
//Daniel maya 02/06/2016 Display menu with click --END
if (!config_update_value ('percentil', (int) get_parameter('percentil', 0)))
$error_update[] = __('Default percentil');
//--------------------------------------------------

View File

@ -484,7 +484,7 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i
$avg = array_map(function($item) { return $item['sum'];}, $chart);
$percentil_result = get_percentile($percentil, $avg);
//Fill the data of chart
array_walk($chart, function(&$item) use ($percentil_result, $series_suffix) {
$item['percentil' . $series_suffix] = $percentil_result; });
@ -766,9 +766,8 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
/*if ($baseline) {
$legend['baseline'.$series_suffix] = __('Baseline');
}*/
$legend['no_data'.$series_suffix] = __('No data').$series_suffix_str;
$chart_extra_data['legend_no_data'] = $legend['no_data'.$series_suffix_str];
//$legend['no_data'.$series_suffix] = __('No data').$series_suffix_str;
//$chart_extra_data['legend_no_data'] = $legend['no_data'.$series_suffix_str];
if ($show_unknown) {
$legend['unknown'.$series_suffix] = __('Unknown').$series_suffix_str;

View File

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

View File

@ -144,7 +144,7 @@ $interface_traffic_modules = array(
$start_date = (string) get_parameter("start_date", date("Y-m-d"));
$zoom = (int) get_parameter ("zoom", 1);
$baseline = get_parameter ("baseline", 0);
$show_percentil_95 = get_parameter ("show_percentil_95", 0);
$show_percentil = get_parameter ("show_percentil", 0);
if ($zoom > 1) {
$height = $height * ($zoom / 2.1);
@ -187,7 +187,7 @@ $interface_traffic_modules = array(
1,
false,
false,
(($show_percentil_95)? 95 : null),
(($show_percentil)? $config['percentil'] : null),
true);
echo '</div>';
@ -236,8 +236,8 @@ $interface_traffic_modules = array(
$table->rowclass[] = '';
$data = array();
$data[0] = __('Show percentil 95º');
$data[1] = html_print_checkbox ("show_percentil_95", 1, (bool) $show_percentil_95, true);
$data[0] = __('Show percentil');
$data[1] = html_print_checkbox ("show_percentil", 1, (bool) $show_percentil, true);
$table->data[] = $data;
$table->rowclass[] ='';

View File

@ -159,7 +159,7 @@ $id = get_parameter('id');
$zoom = get_parameter ("zoom", 1);
$baseline = get_parameter ("baseline", 0);
$show_events_graph = get_parameter ("show_events_graph", 0);
$show_percentil_95 = get_parameter ("show_percentil_95", 0);
$show_percentil = get_parameter ("show_percentil", 0);
$time_compare_separated = get_parameter ("time_compare_separated", 0);
$time_compare_overlapped = get_parameter ("time_compare_overlapped", 0);
$unknown_graph = get_parameter_checkbox ("unknown_graph", 1);
@ -221,7 +221,7 @@ $id = get_parameter('id');
false, $urlImage, 1, false,
'adapter_' . $graph_type, $time_compare,
$unknown_graph, true, 'white',
(($show_percentil_95)? 95 : null));
(($show_percentil)? $config['percentil'] : null));
echo '<br>';
if ($show_events_graph)
echo graphic_module_events($id, $width, $height,
@ -369,8 +369,8 @@ $id = get_parameter('id');
case 'boolean':
case 'sparse':
$data = array();
$data[0] = __('Show percentil 95º');
$data[1] = html_print_checkbox ("show_percentil_95", 1, (bool) $show_percentil_95, true);
$data[0] = __('Show percentil');
$data[1] = html_print_checkbox ("show_percentil", 1, (bool) $show_percentil, true);
$table->data[] = $data;
$table->rowclass[] ='';