2013-03-08 Miguel de Dios <miguel.dedios@artica.es>
*include/constants.php, include/functions_reporting.php, godmode/reporting/reporting_builder.item_editor.php, godmode/reporting/reporting_builder.php: into the report element "exception" added more conditions and rewrote the code. Fixes: #3607172 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7816 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
76b115c4da
commit
3f13bf0705
|
@ -1,3 +1,12 @@
|
||||||
|
2013-03-08 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
*include/constants.php, include/functions_reporting.php,
|
||||||
|
godmode/reporting/reporting_builder.item_editor.php,
|
||||||
|
godmode/reporting/reporting_builder.php: into the report element
|
||||||
|
"exception" added more conditions and rewrote the code.
|
||||||
|
|
||||||
|
Fixes: #3607172
|
||||||
|
|
||||||
2013-03-08 Sergio Martin <sergio.martin@artica.es>
|
2013-03-08 Sergio Martin <sergio.martin@artica.es>
|
||||||
|
|
||||||
* include/ajax/events.php
|
* include/ajax/events.php
|
||||||
|
|
|
@ -58,7 +58,7 @@ $order_uptodown = 0;
|
||||||
$show_resume = 0;
|
$show_resume = 0;
|
||||||
$top_n = 0;
|
$top_n = 0;
|
||||||
$top_n_value = 10;
|
$top_n_value = 10;
|
||||||
$exception_condition = 0;
|
$exception_condition = REPORT_EXCEPTION_CONDITION_EVERYTHING;
|
||||||
$exception_condition_value = 10;
|
$exception_condition_value = 10;
|
||||||
$modulegroup = 0;
|
$modulegroup = 0;
|
||||||
$period = 86400;
|
$period = 86400;
|
||||||
|
@ -931,7 +931,20 @@ html_print_input_hidden('id_item', $idItem);
|
||||||
<tr id="row_exception_condition" style="" class="datos">
|
<tr id="row_exception_condition" style="" class="datos">
|
||||||
<td><?php echo __('Condition');?></td>
|
<td><?php echo __('Condition');?></td>
|
||||||
<td><?php
|
<td><?php
|
||||||
echo __('Everything');
|
$list_exception_condition = array(
|
||||||
|
REPORT_EXCEPTION_CONDITION_EVERYTHING => __('Everything'),
|
||||||
|
REPORT_EXCEPTION_CONDITION_GE => __('Greater or equal (>=)'),
|
||||||
|
REPORT_EXCEPTION_CONDITION_LE => __('Less or equal (<=)'),
|
||||||
|
REPORT_EXCEPTION_CONDITION_L => __('Less (<)'),
|
||||||
|
REPORT_EXCEPTION_CONDITION_G => __('Greater (>)'),
|
||||||
|
REPORT_EXCEPTION_CONDITION_E => __('Equal (=)'),
|
||||||
|
REPORT_EXCEPTION_CONDITION_NE => __('Not equal (!=)'),
|
||||||
|
REPORT_EXCEPTION_CONDITION_OK => __('OK'),
|
||||||
|
REPORT_EXCEPTION_CONDITION_NOT_OK => __('Not OK')
|
||||||
|
);
|
||||||
|
html_print_select($list_exception_condition, 'exception_condition', $exception_condition);
|
||||||
|
|
||||||
|
/*echo ;
|
||||||
html_print_radio_button ('radiobutton_exception_condition', 0, '', $exception_condition);
|
html_print_radio_button ('radiobutton_exception_condition', 0, '', $exception_condition);
|
||||||
echo __('>=');
|
echo __('>=');
|
||||||
html_print_radio_button ('radiobutton_exception_condition', 1, '', $exception_condition);
|
html_print_radio_button ('radiobutton_exception_condition', 1, '', $exception_condition);
|
||||||
|
@ -941,7 +954,7 @@ html_print_input_hidden('id_item', $idItem);
|
||||||
html_print_radio_button ('radiobutton_exception_condition', 3, '', $exception_condition);
|
html_print_radio_button ('radiobutton_exception_condition', 3, '', $exception_condition);
|
||||||
echo __('Not OK');
|
echo __('Not OK');
|
||||||
html_print_radio_button ('radiobutton_exception_condition', 4, '', $exception_condition);
|
html_print_radio_button ('radiobutton_exception_condition', 4, '', $exception_condition);
|
||||||
?></td>
|
*/?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="row_show_graph" style="" class="datos">
|
<tr id="row_show_graph" style="" class="datos">
|
||||||
<td><?php echo __('Show graph');?></td>
|
<td><?php echo __('Show graph');?></td>
|
||||||
|
|
|
@ -703,7 +703,7 @@ switch ($action) {
|
||||||
$values['group_by_agent'] = get_parameter ('checkbox_row_group_by_agent');
|
$values['group_by_agent'] = get_parameter ('checkbox_row_group_by_agent');
|
||||||
$values['show_resume'] = get_parameter ('checkbox_show_resume');
|
$values['show_resume'] = get_parameter ('checkbox_show_resume');
|
||||||
$values['order_uptodown'] = get_parameter ('radiobutton_order_uptodown');
|
$values['order_uptodown'] = get_parameter ('radiobutton_order_uptodown');
|
||||||
$values['exception_condition'] = get_parameter('radiobutton_exception_condition');
|
$values['exception_condition'] = get_parameter('exception_condition');
|
||||||
$values['exception_condition_value'] = get_parameter('exception_condition_value');
|
$values['exception_condition_value'] = get_parameter('exception_condition_value');
|
||||||
$values['show_graph'] = get_parameter('combo_graph_options');
|
$values['show_graph'] = get_parameter('combo_graph_options');
|
||||||
$values['id_module_group'] = get_parameter('combo_modulegroup');
|
$values['id_module_group'] = get_parameter('combo_modulegroup');
|
||||||
|
|
|
@ -268,4 +268,14 @@ define ('REPORT_TOP_N_AVG', 0);
|
||||||
define ('REPORT_TOP_N_ONLY_GRAPHS', 2);
|
define ('REPORT_TOP_N_ONLY_GRAPHS', 2);
|
||||||
define ('REPORT_TOP_N_SHOW_TABLE_GRAPS', 1);
|
define ('REPORT_TOP_N_SHOW_TABLE_GRAPS', 1);
|
||||||
define ('REPORT_TOP_N_ONLY_TABLE', 0);
|
define ('REPORT_TOP_N_ONLY_TABLE', 0);
|
||||||
|
|
||||||
|
define ('REPORT_EXCEPTION_CONDITION_EVERYTHING', 0);
|
||||||
|
define ('REPORT_EXCEPTION_CONDITION_GE', 1);
|
||||||
|
define ('REPORT_EXCEPTION_CONDITION_LE', 5);
|
||||||
|
define ('REPORT_EXCEPTION_CONDITION_L', 2);
|
||||||
|
define ('REPORT_EXCEPTION_CONDITION_G', 6);
|
||||||
|
define ('REPORT_EXCEPTION_CONDITION_E', 7);
|
||||||
|
define ('REPORT_EXCEPTION_CONDITION_NE', 8);
|
||||||
|
define ('REPORT_EXCEPTION_CONDITION_OK', 3);
|
||||||
|
define ('REPORT_EXCEPTION_CONDITION_NOT_OK', 4);
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -5121,22 +5121,35 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
|
|
||||||
$title_exeption = __('Exception');
|
$title_exeption = __('Exception');
|
||||||
switch ($exception_condition) {
|
switch ($exception_condition) {
|
||||||
case 0:
|
case REPORT_EXCEPTION_CONDITION_EVERYTHING:
|
||||||
$title_exeption .= ' - '.__('Everything');
|
$title_exeption .= ' - '.__('Everything');
|
||||||
break;
|
break;
|
||||||
case 1:
|
case REPORT_EXCEPTION_CONDITION_GE:
|
||||||
$title_exeption .= ' - '.__('Modules over or equal to').' '.$exception_condition_value;
|
$title_exeption .= ' - '.__('Modules over or equal to').' '.$exception_condition_value;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case REPORT_EXCEPTION_CONDITION_LE:
|
||||||
|
$title_exeption .= ' - '.__('Modules under or equal to').' '.$exception_condition_value;
|
||||||
|
break;
|
||||||
|
case REPORT_EXCEPTION_CONDITION_L:
|
||||||
$title_exeption .= ' - '.__('Modules under').' '.$exception_condition_value;
|
$title_exeption .= ' - '.__('Modules under').' '.$exception_condition_value;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case REPORT_EXCEPTION_CONDITION_G:
|
||||||
|
$title_exeption .= ' - '.__('Modules over').' '.$exception_condition_value;
|
||||||
|
break;
|
||||||
|
case REPORT_EXCEPTION_CONDITION_E:
|
||||||
|
$title_exeption .= ' - '.__('Equal to').' '.$exception_condition_value;
|
||||||
|
break;
|
||||||
|
case REPORT_EXCEPTION_CONDITION_NE:
|
||||||
|
$title_exeption .= ' - '.__('Not equal to').' '.$exception_condition_value;
|
||||||
|
break;
|
||||||
|
case REPORT_EXCEPTION_CONDITION_OK:
|
||||||
$title_exeption .= ' - '.__('Modules at normal status');
|
$title_exeption .= ' - '.__('Modules at normal status');
|
||||||
break;
|
break;
|
||||||
case 4:
|
case REPORT_EXCEPTION_CONDITION_NOT_OK:
|
||||||
$title_exeption .= ' - '.__('Modules at critical or warning status');
|
$title_exeption .= ' - '.__('Modules at critical or warning status');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
reporting_header_content($mini, $content, $report, $table, $title_exeption);
|
reporting_header_content($mini, $content, $report, $table, $title_exeption);
|
||||||
|
|
||||||
// Put description at the end of the module (if exists)
|
// Put description at the end of the module (if exists)
|
||||||
|
@ -5241,39 +5254,53 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
if ($value > $max) $max = $value;
|
if ($value > $max) $max = $value;
|
||||||
if ($value < $min) $min = $value;
|
if ($value < $min) $min = $value;
|
||||||
$avg += $value;
|
$avg += $value;
|
||||||
|
|
||||||
|
//Skips
|
||||||
switch ($exception_condition) {
|
switch ($exception_condition) {
|
||||||
//Display everything
|
case REPORT_EXCEPTION_CONDITION_EVERYTHING:
|
||||||
case 0:
|
|
||||||
break;
|
break;
|
||||||
//Display modules over or equal to certain value
|
case REPORT_EXCEPTION_CONDITION_GE:
|
||||||
case 1:
|
|
||||||
//Skip modules under 'value'
|
|
||||||
if ($value < $exception_condition_value) {
|
if ($value < $exception_condition_value) {
|
||||||
continue 2;
|
continue 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
//Display modules under a certain value
|
case REPORT_EXCEPTION_CONDITION_LE:
|
||||||
case 2:
|
if ($value > $exception_condition_value) {
|
||||||
//Skip modules over or equal to 'value'
|
|
||||||
if ($value >= $exception_condition_value) {
|
|
||||||
continue 2;
|
continue 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
//Display modules at Normal status
|
case REPORT_EXCEPTION_CONDITION_L:
|
||||||
case 3:
|
if ($value > $exception_condition_value) {
|
||||||
//Skip modules without normal status
|
continue 2;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case REPORT_EXCEPTION_CONDITION_G:
|
||||||
|
if ($value < $exception_condition_value) {
|
||||||
|
continue 2;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case REPORT_EXCEPTION_CONDITION_E:
|
||||||
|
if ($value != $exception_condition_value) {
|
||||||
|
continue 2;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case REPORT_EXCEPTION_CONDITION_NE:
|
||||||
|
if ($value == $exception_condition_value) {
|
||||||
|
continue 2;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case REPORT_EXCEPTION_CONDITION_OK:
|
||||||
if (modules_get_agentmodule_status($exc['id_agent_module']) != 0) {
|
if (modules_get_agentmodule_status($exc['id_agent_module']) != 0) {
|
||||||
continue 2;
|
continue 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
//Display modules at critical, warning or unknown status
|
case REPORT_EXCEPTION_CONDITION_NOT_OK:
|
||||||
case 4:
|
|
||||||
//Skip modules at normal status
|
|
||||||
if (modules_get_agentmodule_status($exc['id_agent_module']) == 0) {
|
if (modules_get_agentmodule_status($exc['id_agent_module']) == 0) {
|
||||||
continue 2;
|
continue 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
$data_exceptions[] = $value;
|
$data_exceptions[] = $value;
|
||||||
$id_agent_module[] = $exc['id_agent_module'];
|
$id_agent_module[] = $exc['id_agent_module'];
|
||||||
|
@ -5287,28 +5314,44 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
||||||
metaconsole_restore_db();
|
metaconsole_restore_db();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//$i <= 0 means that there are no rows on the table, therefore no modules under the conditions defined.
|
//$i <= 0 means that there are no rows on the table, therefore no modules under the conditions defined.
|
||||||
if ($i<=0) {
|
if ($i <= 0) {
|
||||||
$data = array ();
|
$data = array ();
|
||||||
$table->colspan[2][0] = 3;
|
$table->colspan[2][0] = 3;
|
||||||
$data[0] = __('There are no');
|
$data[0] = __('There are no');
|
||||||
|
|
||||||
switch ($exception_condition) {
|
switch ($exception_condition) {
|
||||||
case 1:
|
case REPORT_EXCEPTION_CONDITION_EVERYTHING:
|
||||||
$data[0] .= ' '.__('Modules over or equal to').' '.$exception_condition_value;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
$data[0] .= ' '.__('Modules under').' '.$exception_condition_value;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
$data[0] .= ' '.__('Modules at normal status');
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
$data[0] .= ' '.__('Modules at critial or warning status');
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$data[0] .= ' '.__('Modules under those conditions');
|
$data[0] .= ' '.__('Modules under those conditions');
|
||||||
break;
|
break;
|
||||||
|
case REPORT_EXCEPTION_CONDITION_GE:
|
||||||
|
$data[0] .= ' '.__('Modules over or equal to').' '.$exception_condition_value;
|
||||||
|
break;
|
||||||
|
case REPORT_EXCEPTION_CONDITION_LE:
|
||||||
|
$data[0] .= ' '.__('Modules less or equal to').' '.$exception_condition_value;
|
||||||
|
break;
|
||||||
|
case REPORT_EXCEPTION_CONDITION_L:
|
||||||
|
$data[0] .= ' '.__('Modules less').' '.$exception_condition_value;
|
||||||
|
break;
|
||||||
|
case REPORT_EXCEPTION_CONDITION_G:
|
||||||
|
$data[0] .= ' '.__('Modules over').' '.$exception_condition_value;
|
||||||
|
break;
|
||||||
|
case REPORT_EXCEPTION_CONDITION_E:
|
||||||
|
$data[0] .= ' '.__('Modules equal to').' '.$exception_condition_value;
|
||||||
|
break;
|
||||||
|
case REPORT_EXCEPTION_CONDITION_NE:
|
||||||
|
$data[0] .= ' '.__('Modules not equal to').' '.$exception_condition_value;
|
||||||
|
break;
|
||||||
|
case REPORT_EXCEPTION_CONDITION_OK:
|
||||||
|
$data[0] .= ' '.__('Modules normal status');
|
||||||
|
break;
|
||||||
|
case REPORT_EXCEPTION_CONDITION_NOT_OK:
|
||||||
|
$data[0] .= ' '.__('Modules at critial or warning status');
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue