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
OR ta.warning_count > 0) ';
break;
case AGENT_STATUS_ALERT_FIRED:
$agent_status_filter = ' AND ta.fired_count > 0 ';
break;
}
return $agent_status_filter;
@ -294,6 +298,10 @@ class Tree
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']);
if ($field_filter === false) {
return ' AND 1=0';

View File

@ -239,6 +239,10 @@ class TreeViewWidget extends Widget
$values['agentStatus'] = AGENT_STATUS_UNKNOWN;
break;
case 4:
$values['agentStatus'] = AGENT_STATUS_ALERT_FIRED;
break;
case 5:
$values['agentStatus'] = AGENT_STATUS_NOT_INIT;
break;
@ -292,6 +296,10 @@ class TreeViewWidget extends Widget
$values['moduleStatus'] = AGENT_MODULE_STATUS_NOT_NORMAL;
break;
case 'fired':
$values['moduleStatus'] = 'fired';
break;
default:
case -1:
$values['moduleStatus'] = -1;
@ -389,13 +397,14 @@ class TreeViewWidget extends Widget
// Agents status.
$fields = [
AGENT_STATUS_ALL => __('All'),
AGENT_STATUS_NORMAL => __('Normal'),
AGENT_STATUS_WARNING => __('Warning'),
AGENT_STATUS_CRITICAL => __('Critical'),
AGENT_STATUS_UNKNOWN => __('Unknown'),
AGENT_STATUS_NOT_INIT => __('Not init'),
AGENT_STATUS_NOT_NORMAL => __('Not normal'),
AGENT_STATUS_ALL => __('All'),
AGENT_STATUS_NORMAL => __('Normal'),
AGENT_STATUS_WARNING => __('Warning'),
AGENT_STATUS_CRITICAL => __('Critical'),
AGENT_STATUS_UNKNOWN => __('Unknown'),
AGENT_STATUS_NOT_INIT => __('Not init'),
AGENT_STATUS_NOT_NORMAL => __('Not normal'),
AGENT_STATUS_ALERT_FIRED => __('Fired alerts'),
];
$inputs[] = [
@ -430,6 +439,7 @@ class TreeViewWidget extends Widget
AGENT_MODULE_STATUS_UNKNOWN => __('Unknown'),
AGENT_MODULE_STATUS_NOT_INIT => __('Not init'),
AGENT_MODULE_STATUS_NOT_NORMAL => __('Not normal'),
'fired' => __('Fired alerts'),
];
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_UNKNOWN] = __('Unknown');
$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(
__('Search group'),
@ -271,7 +272,7 @@ $table->data['agent_row'][] = html_print_label_input_block(
0,
true,
false,
true,
false,
'',
false,
'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_UNKNOWN] = __('Unknown');
$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(
__('Search module'),
@ -322,7 +324,7 @@ if (is_metaconsole() === false) {
0,
true,
false,
true,
false,
'',
false,
'width:100%'
@ -380,7 +382,7 @@ html_print_div(
]
);
$infoHeadTitle = 'Sombra oscura';
$infoHeadTitle = '';
?>
<?php if (is_metaconsole() === false) { ?>