10067-Alerts triggered filter tree view

This commit is contained in:
Pablo Aragon 2023-04-05 09:14:01 +02:00
parent cc2709c42c
commit 73d7345844
3 changed files with 30 additions and 10 deletions

View File

@ -219,6 +219,10 @@ class Tree
$agent_status_filter = ' AND (ta.critical_count > 0 $agent_status_filter = ' AND (ta.critical_count > 0
OR ta.warning_count > 0) '; OR ta.warning_count > 0) ';
break; break;
case AGENT_STATUS_ALERT_FIRED:
$agent_status_filter = ' AND ta.fired_count > 0 ';
break;
} }
return $agent_status_filter; return $agent_status_filter;
@ -294,6 +298,10 @@ class Tree
return ' AND (ta.warning_count > 0 OR ta.critical_count > 0)'; return ' AND (ta.warning_count > 0 OR ta.critical_count > 0)';
} }
if ($this->filter['statusModule'] === 'fired') {
return ' AND ta.fired_count > 0';
}
$field_filter = modules_get_counter_by_states($this->filter['statusModule']); $field_filter = modules_get_counter_by_states($this->filter['statusModule']);
if ($field_filter === false) { if ($field_filter === false) {
return ' AND 1=0'; return ' AND 1=0';

View File

@ -239,6 +239,10 @@ class TreeViewWidget extends Widget
$values['agentStatus'] = AGENT_STATUS_UNKNOWN; $values['agentStatus'] = AGENT_STATUS_UNKNOWN;
break; break;
case 4:
$values['agentStatus'] = AGENT_STATUS_ALERT_FIRED;
break;
case 5: case 5:
$values['agentStatus'] = AGENT_STATUS_NOT_INIT; $values['agentStatus'] = AGENT_STATUS_NOT_INIT;
break; break;
@ -292,6 +296,10 @@ class TreeViewWidget extends Widget
$values['moduleStatus'] = AGENT_MODULE_STATUS_NOT_NORMAL; $values['moduleStatus'] = AGENT_MODULE_STATUS_NOT_NORMAL;
break; break;
case 'fired':
$values['moduleStatus'] = 'fired';
break;
default: default:
case -1: case -1:
$values['moduleStatus'] = -1; $values['moduleStatus'] = -1;
@ -396,6 +404,7 @@ class TreeViewWidget extends Widget
AGENT_STATUS_UNKNOWN => __('Unknown'), AGENT_STATUS_UNKNOWN => __('Unknown'),
AGENT_STATUS_NOT_INIT => __('Not init'), AGENT_STATUS_NOT_INIT => __('Not init'),
AGENT_STATUS_NOT_NORMAL => __('Not normal'), AGENT_STATUS_NOT_NORMAL => __('Not normal'),
AGENT_STATUS_ALERT_FIRED => __('Fired alerts'),
]; ];
$inputs[] = [ $inputs[] = [
@ -430,6 +439,7 @@ class TreeViewWidget extends Widget
AGENT_MODULE_STATUS_UNKNOWN => __('Unknown'), AGENT_MODULE_STATUS_UNKNOWN => __('Unknown'),
AGENT_MODULE_STATUS_NOT_INIT => __('Not init'), AGENT_MODULE_STATUS_NOT_INIT => __('Not init'),
AGENT_MODULE_STATUS_NOT_NORMAL => __('Not normal'), AGENT_MODULE_STATUS_NOT_NORMAL => __('Not normal'),
'fired' => __('Fired alerts'),
]; ];
if (is_metaconsole() === false) { if (is_metaconsole() === false) {

View File

@ -210,6 +210,7 @@ $agent_status_arr[AGENT_STATUS_WARNING] = __('Warning');
$agent_status_arr[AGENT_STATUS_CRITICAL] = __('Critical'); $agent_status_arr[AGENT_STATUS_CRITICAL] = __('Critical');
$agent_status_arr[AGENT_STATUS_UNKNOWN] = __('Unknown'); $agent_status_arr[AGENT_STATUS_UNKNOWN] = __('Unknown');
$agent_status_arr[AGENT_STATUS_NOT_INIT] = __('Not init'); $agent_status_arr[AGENT_STATUS_NOT_INIT] = __('Not init');
$agent_status_arr[AGENT_STATUS_ALERT_FIRED] = __('Fired alerts');
$table->data['group_row'][] = html_print_label_input_block( $table->data['group_row'][] = html_print_label_input_block(
__('Search group'), __('Search group'),
@ -271,7 +272,7 @@ $table->data['agent_row'][] = html_print_label_input_block(
0, 0,
true, true,
false, false,
true, false,
'', '',
false, false,
'width:100%' 'width:100%'
@ -300,6 +301,7 @@ if (is_metaconsole() === false) {
$module_status_arr[AGENT_MODULE_STATUS_CRITICAL_BAD] = __('Critical'); $module_status_arr[AGENT_MODULE_STATUS_CRITICAL_BAD] = __('Critical');
$module_status_arr[AGENT_MODULE_STATUS_UNKNOWN] = __('Unknown'); $module_status_arr[AGENT_MODULE_STATUS_UNKNOWN] = __('Unknown');
$module_status_arr[AGENT_MODULE_STATUS_NOT_INIT] = __('Not init'); $module_status_arr[AGENT_MODULE_STATUS_NOT_INIT] = __('Not init');
$module_status_arr['fired'] = __('Fired alerts');
$table->data['last_row'][] = html_print_label_input_block( $table->data['last_row'][] = html_print_label_input_block(
__('Search module'), __('Search module'),
@ -322,7 +324,7 @@ if (is_metaconsole() === false) {
0, 0,
true, true,
false, false,
true, false,
'', '',
false, false,
'width:100%' 'width:100%'
@ -380,7 +382,7 @@ html_print_div(
] ]
); );
$infoHeadTitle = 'Sombra oscura'; $infoHeadTitle = '';
?> ?>
<?php if (is_metaconsole() === false) { ?> <?php if (is_metaconsole() === false) { ?>