mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 01:05:39 +02:00
Feature: Add new filter in aget/group events report. Ticket: #4243
This commit is contained in:
parent
70bb715516
commit
031ff4233a
@ -100,6 +100,8 @@ $filter_event_no_validated = false;
|
|||||||
$filter_event_critical = false;
|
$filter_event_critical = false;
|
||||||
$filter_event_warning = false;
|
$filter_event_warning = false;
|
||||||
|
|
||||||
|
$filter_event_type = false;
|
||||||
|
|
||||||
$event_graph_by_agent = false;
|
$event_graph_by_agent = false;
|
||||||
$event_graph_by_user_validator = false;
|
$event_graph_by_user_validator = false;
|
||||||
$event_graph_by_criticity = false;
|
$event_graph_by_criticity = false;
|
||||||
@ -415,6 +417,7 @@ switch ($action) {
|
|||||||
$filter_event_validated = $style['filter_event_validated'];
|
$filter_event_validated = $style['filter_event_validated'];
|
||||||
$filter_event_critical = $style['filter_event_critical'];
|
$filter_event_critical = $style['filter_event_critical'];
|
||||||
$filter_event_warning = $style['filter_event_warning'];
|
$filter_event_warning = $style['filter_event_warning'];
|
||||||
|
$filter_event_type = json_decode($style['filter_event_type'], true);
|
||||||
|
|
||||||
$event_graph_by_agent = $style['event_graph_by_agent'];
|
$event_graph_by_agent = $style['event_graph_by_agent'];
|
||||||
$event_graph_by_user_validator = $style['event_graph_by_user_validator'];
|
$event_graph_by_user_validator = $style['event_graph_by_user_validator'];
|
||||||
@ -431,6 +434,7 @@ switch ($action) {
|
|||||||
$filter_event_validated = $style['filter_event_validated'];
|
$filter_event_validated = $style['filter_event_validated'];
|
||||||
$filter_event_critical = $style['filter_event_critical'];
|
$filter_event_critical = $style['filter_event_critical'];
|
||||||
$filter_event_warning = $style['filter_event_warning'];
|
$filter_event_warning = $style['filter_event_warning'];
|
||||||
|
$filter_event_type = json_decode($style['filter_event_type'], true);
|
||||||
|
|
||||||
$event_graph_by_agent = $style['event_graph_by_agent'];
|
$event_graph_by_agent = $style['event_graph_by_agent'];
|
||||||
$event_graph_by_user_validator = $style['event_graph_by_user_validator'];
|
$event_graph_by_user_validator = $style['event_graph_by_user_validator'];
|
||||||
@ -1347,6 +1351,20 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr id="row_event_type" style="" class="datos">
|
||||||
|
<td style="font-weight:bold;"><?php echo __('Event type'); ?></td>
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
|
$event_types_select = get_event_types();
|
||||||
|
html_debug($filter_event_type);
|
||||||
|
html_print_select ($event_types_select, 'filter_event_type[]',
|
||||||
|
$filter_event_type, '', __('All'), 'all', false, true,
|
||||||
|
false, '', false, false, false, false, false, '');
|
||||||
|
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr id="row_event_graphs" style="" class="datos">
|
<tr id="row_event_graphs" style="" class="datos">
|
||||||
<td style="font-weight:bold;"><?php echo __('Event graphs'); ?></td>
|
<td style="font-weight:bold;"><?php echo __('Event graphs'); ?></td>
|
||||||
<td>
|
<td>
|
||||||
@ -1946,6 +1964,7 @@ $(document).ready (function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function create_custom_graph() {
|
function create_custom_graph() {
|
||||||
@ -2444,6 +2463,7 @@ function chooseType() {
|
|||||||
$("#row_percentil").hide();
|
$("#row_percentil").hide();
|
||||||
$("#agents_row").hide();
|
$("#agents_row").hide();
|
||||||
$("#modules_row").hide();
|
$("#modules_row").hide();
|
||||||
|
$("#row_event_type").hide();
|
||||||
|
|
||||||
// SLA list default state
|
// SLA list default state
|
||||||
$("#sla_list").hide();
|
$("#sla_list").hide();
|
||||||
@ -2472,6 +2492,7 @@ function chooseType() {
|
|||||||
$("#row_event_graph_by_user").show();
|
$("#row_event_graph_by_user").show();
|
||||||
$("#row_event_graph_by_criticity").show();
|
$("#row_event_graph_by_criticity").show();
|
||||||
$("#row_event_graph_by_validated").show();
|
$("#row_event_graph_by_validated").show();
|
||||||
|
$("#row_event_type").show();
|
||||||
|
|
||||||
$("#row_filter_search").show();
|
$("#row_filter_search").show();
|
||||||
break;
|
break;
|
||||||
@ -2734,6 +2755,7 @@ function chooseType() {
|
|||||||
$("#row_event_graph_by_user").show();
|
$("#row_event_graph_by_user").show();
|
||||||
$("#row_event_graph_by_criticity").show();
|
$("#row_event_graph_by_criticity").show();
|
||||||
$("#row_event_graph_by_validated").show();
|
$("#row_event_graph_by_validated").show();
|
||||||
|
$("#row_event_type").show();
|
||||||
|
|
||||||
$('#agent_autocomplete').hide();
|
$('#agent_autocomplete').hide();
|
||||||
$('#agent_autocomplete_events').show();
|
$('#agent_autocomplete_events').show();
|
||||||
|
@ -1062,6 +1062,7 @@ switch ($action) {
|
|||||||
$filter_event_no_validated = get_parameter('filter_event_no_validated', 0);
|
$filter_event_no_validated = get_parameter('filter_event_no_validated', 0);
|
||||||
$filter_event_critical = get_parameter('filter_event_critical', 0);
|
$filter_event_critical = get_parameter('filter_event_critical', 0);
|
||||||
$filter_event_warning = get_parameter('filter_event_warning', 0);
|
$filter_event_warning = get_parameter('filter_event_warning', 0);
|
||||||
|
$filter_event_type = get_parameter('filter_event_type', '');
|
||||||
|
|
||||||
$event_graph_by_agent = get_parameter('event_graph_by_agent', 0);
|
$event_graph_by_agent = get_parameter('event_graph_by_agent', 0);
|
||||||
$event_graph_by_user_validator = get_parameter('event_graph_by_user_validator', 0);
|
$event_graph_by_user_validator = get_parameter('event_graph_by_user_validator', 0);
|
||||||
@ -1132,7 +1133,7 @@ switch ($action) {
|
|||||||
$style['filter_event_validated'] = $filter_event_validated;
|
$style['filter_event_validated'] = $filter_event_validated;
|
||||||
$style['filter_event_critical'] = $filter_event_critical;
|
$style['filter_event_critical'] = $filter_event_critical;
|
||||||
$style['filter_event_warning'] = $filter_event_warning;
|
$style['filter_event_warning'] = $filter_event_warning;
|
||||||
|
$style['filter_event_type'] = json_encode($filter_event_type);
|
||||||
$style['event_graph_by_agent'] = $event_graph_by_agent;
|
$style['event_graph_by_agent'] = $event_graph_by_agent;
|
||||||
$style['event_graph_by_user_validator'] = $event_graph_by_user_validator;
|
$style['event_graph_by_user_validator'] = $event_graph_by_user_validator;
|
||||||
$style['event_graph_by_criticity'] = $event_graph_by_criticity;
|
$style['event_graph_by_criticity'] = $event_graph_by_criticity;
|
||||||
@ -1447,6 +1448,7 @@ switch ($action) {
|
|||||||
$event_graph_by_user_validator = get_parameter('event_graph_by_user_validator', 0);
|
$event_graph_by_user_validator = get_parameter('event_graph_by_user_validator', 0);
|
||||||
$event_graph_by_criticity = get_parameter('event_graph_by_criticity', 0);
|
$event_graph_by_criticity = get_parameter('event_graph_by_criticity', 0);
|
||||||
$event_graph_validated_vs_unvalidated = get_parameter('event_graph_validated_vs_unvalidated', 0);
|
$event_graph_validated_vs_unvalidated = get_parameter('event_graph_validated_vs_unvalidated', 0);
|
||||||
|
$filter_event_type = get_parameter('filter_event_type', '');
|
||||||
|
|
||||||
$event_filter_search = get_parameter('filter_search', '');
|
$event_filter_search = get_parameter('filter_search', '');
|
||||||
|
|
||||||
@ -1455,6 +1457,7 @@ switch ($action) {
|
|||||||
$style['filter_event_validated'] = $filter_event_validated;
|
$style['filter_event_validated'] = $filter_event_validated;
|
||||||
$style['filter_event_critical'] = $filter_event_critical;
|
$style['filter_event_critical'] = $filter_event_critical;
|
||||||
$style['filter_event_warning'] = $filter_event_warning;
|
$style['filter_event_warning'] = $filter_event_warning;
|
||||||
|
$style['filter_event_type'] = json_encode($filter_event_type);
|
||||||
|
|
||||||
$style['event_graph_by_agent'] = $event_graph_by_agent;
|
$style['event_graph_by_agent'] = $event_graph_by_agent;
|
||||||
$style['event_graph_by_user_validator'] = $event_graph_by_user_validator;
|
$style['event_graph_by_user_validator'] = $event_graph_by_user_validator;
|
||||||
|
@ -1187,7 +1187,8 @@ function events_print_type_description ($type, $return = false) {
|
|||||||
function events_get_group_events ($id_group, $period, $date,
|
function events_get_group_events ($id_group, $period, $date,
|
||||||
$filter_event_validated = false, $filter_event_critical = false,
|
$filter_event_validated = false, $filter_event_critical = false,
|
||||||
$filter_event_warning = false, $filter_event_no_validated = false,
|
$filter_event_warning = false, $filter_event_no_validated = false,
|
||||||
$filter_event_search = false, $meta = false, $history = false) {
|
$filter_event_search = false, $meta = false, $history = false,
|
||||||
|
$filter_event_type = false) {
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -1223,6 +1224,28 @@ function events_get_group_events ($id_group, $period, $date,
|
|||||||
' OR id_evento LIKE "%' . io_safe_input($filter_event_search) . '%")';
|
' OR id_evento LIKE "%' . io_safe_input($filter_event_search) . '%")';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($filter_event_type)) {
|
||||||
|
$sql_where .= ' AND (';
|
||||||
|
$type = array();
|
||||||
|
foreach ($filter_event_type as $event_type) {
|
||||||
|
if ($event_type != "") {
|
||||||
|
// If normal, warning, could be several (going_up_warning, going_down_warning... too complex
|
||||||
|
// for the user so for him is presented only "warning, critical and normal"
|
||||||
|
if ($event_type == "warning" || $event_type == "critical" || $event_type == "normal") {
|
||||||
|
$type[] = " event_type LIKE '%$event_type%' ";
|
||||||
|
}
|
||||||
|
else if ($event_type == "not_normal") {
|
||||||
|
$type[] = " (event_type LIKE '%warning%' OR event_type LIKE '%critical%' OR event_type LIKE '%unknown%') ";
|
||||||
|
}
|
||||||
|
else if ($event_type != "all") {
|
||||||
|
$type[] = " event_type = '" . $event_type."'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql_where .= implode(' OR ', $type) . ')';
|
||||||
|
}
|
||||||
|
|
||||||
$sql_where .= sprintf('
|
$sql_where .= sprintf('
|
||||||
AND id_grupo IN (%s)
|
AND id_grupo IN (%s)
|
||||||
AND utimestamp > %d
|
AND utimestamp > %d
|
||||||
@ -1308,7 +1331,7 @@ function events_get_group_events_steps ($begin, &$result, $id_group, $period, $d
|
|||||||
function events_get_agent ($id_agent, $period, $date = 0,
|
function events_get_agent ($id_agent, $period, $date = 0,
|
||||||
$filter_event_validated = false, $filter_event_critical = false,
|
$filter_event_validated = false, $filter_event_critical = false,
|
||||||
$filter_event_warning = false, $filter_event_no_validated = false,
|
$filter_event_warning = false, $filter_event_no_validated = false,
|
||||||
$history = false) {
|
$history = false, $filter_event_type = false) {
|
||||||
|
|
||||||
if (!is_numeric ($date)) {
|
if (!is_numeric ($date)) {
|
||||||
$date = strtotime ($date);
|
$date = strtotime ($date);
|
||||||
@ -1345,6 +1368,28 @@ function events_get_agent ($id_agent, $period, $date = 0,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($filter_event_type)) {
|
||||||
|
$sql_where .= ' AND (';
|
||||||
|
$type = array();
|
||||||
|
foreach ($filter_event_type as $event_type) {
|
||||||
|
if ($event_type != "") {
|
||||||
|
// If normal, warning, could be several (going_up_warning, going_down_warning... too complex
|
||||||
|
// for the user so for him is presented only "warning, critical and normal"
|
||||||
|
if ($event_type == "warning" || $event_type == "critical" || $event_type == "normal") {
|
||||||
|
$type[] = " event_type LIKE '%$event_type%' ";
|
||||||
|
}
|
||||||
|
else if ($event_type == "not_normal") {
|
||||||
|
$type[] = " (event_type LIKE '%warning%' OR event_type LIKE '%critical%' OR event_type LIKE '%unknown%') ";
|
||||||
|
}
|
||||||
|
else if ($event_type != "all") {
|
||||||
|
$type[] = " event_type = '" . $event_type."'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql_where .= implode(' OR ', $type) . ')';
|
||||||
|
}
|
||||||
|
|
||||||
$sql_where .= sprintf(' AND id_agente = %d AND utimestamp > %d
|
$sql_where .= sprintf(' AND id_agente = %d AND utimestamp > %d
|
||||||
AND utimestamp <= %d ', $id_agent, $datelimit, $date);
|
AND utimestamp <= %d ', $id_agent, $datelimit, $date);
|
||||||
|
|
||||||
|
@ -1189,24 +1189,26 @@ function reporting_event_report_group($report, $content,
|
|||||||
$return["description"] = $content["description"];
|
$return["description"] = $content["description"];
|
||||||
$return["date"] = reporting_get_date_text($report, $content);
|
$return["date"] = reporting_get_date_text($report, $content);
|
||||||
|
|
||||||
|
$event_filter = $content['style'];
|
||||||
|
|
||||||
$filter_event_no_validated = $content['style']['filter_event_no_validated'];
|
$filter_event_no_validated = $event_filter['filter_event_no_validated'];
|
||||||
$filter_event_validated = $content['style']['filter_event_validated'];
|
$filter_event_validated = $event_filter['filter_event_validated'];
|
||||||
$filter_event_critical = $content['style']['filter_event_critical'];
|
$filter_event_critical = $event_filter['filter_event_critical'];
|
||||||
$filter_event_warning = $content['style']['filter_event_warning'];
|
$filter_event_warning = $event_filter['filter_event_warning'];
|
||||||
$filter_event_filter_search = $content['style']['event_filter_search'];
|
$filter_event_filter_search = $event_filter['event_filter_search'];
|
||||||
|
$filter_event_type = json_decode($event_filter['filter_event_type'],true);
|
||||||
|
|
||||||
$event_graph_by_agent = $content['style']['event_graph_by_agent'];
|
$event_graph_by_agent = $event_filter['event_graph_by_agent'];
|
||||||
$event_graph_by_user_validator = $content['style']['event_graph_by_user_validator'];
|
$event_graph_by_user_validator = $event_filter['event_graph_by_user_validator'];
|
||||||
$event_graph_by_criticity = $content['style']['event_graph_by_criticity'];
|
$event_graph_by_criticity = $event_filter['event_graph_by_criticity'];
|
||||||
$event_graph_validated_vs_unvalidated = $content['style']['event_graph_validated_vs_unvalidated'];
|
$event_graph_validated_vs_unvalidated = $event_filter['event_graph_validated_vs_unvalidated'];
|
||||||
|
|
||||||
|
|
||||||
$data = reporting_get_group_detailed_event(
|
$data = reporting_get_group_detailed_event(
|
||||||
$content['id_group'], $content['period'], $report["datetime"],
|
$content['id_group'], $content['period'], $report["datetime"],
|
||||||
true, true, $filter_event_validated, $filter_event_critical,
|
true, true, $filter_event_validated, $filter_event_critical,
|
||||||
$filter_event_warning, $filter_event_no_validated,
|
$filter_event_warning, $filter_event_no_validated,
|
||||||
$filter_event_filter_search, 'hash', $history);
|
$filter_event_filter_search, 'hash', $history, $filter_event_type);
|
||||||
|
|
||||||
if (empty($data)) {
|
if (empty($data)) {
|
||||||
$return['failed'] = __('No events');
|
$return['failed'] = __('No events');
|
||||||
@ -2085,6 +2087,7 @@ function reporting_event_report_agent($report, $content,
|
|||||||
$filter_event_validated = $style['filter_event_validated'];
|
$filter_event_validated = $style['filter_event_validated'];
|
||||||
$filter_event_critical = $style['filter_event_critical'];
|
$filter_event_critical = $style['filter_event_critical'];
|
||||||
$filter_event_warning = $style['filter_event_warning'];
|
$filter_event_warning = $style['filter_event_warning'];
|
||||||
|
$filter_event_type = json_decode($style['filter_event_type'], true);
|
||||||
|
|
||||||
$event_graph_by_user_validator = $style['event_graph_by_user_validator'];
|
$event_graph_by_user_validator = $style['event_graph_by_user_validator'];
|
||||||
$event_graph_by_criticity = $style['event_graph_by_criticity'];
|
$event_graph_by_criticity = $style['event_graph_by_criticity'];
|
||||||
@ -2100,7 +2103,8 @@ function reporting_event_report_agent($report, $content,
|
|||||||
$filter_event_warning,
|
$filter_event_warning,
|
||||||
$filter_event_no_validated,
|
$filter_event_no_validated,
|
||||||
true,
|
true,
|
||||||
$history);
|
$history,
|
||||||
|
$filter_event_type);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -5464,7 +5468,8 @@ function reporting_get_group_detailed_event ($id_group, $period = 0,
|
|||||||
$date = 0, $return = false, $html = true,
|
$date = 0, $return = false, $html = true,
|
||||||
$filter_event_validated = false, $filter_event_critical = false,
|
$filter_event_validated = false, $filter_event_critical = false,
|
||||||
$filter_event_warning = false, $filter_event_no_validated = false,
|
$filter_event_warning = false, $filter_event_no_validated = false,
|
||||||
$filter_event_filter_search = null, $return_type = false, $history = false) {
|
$filter_event_filter_search = null, $return_type = false,
|
||||||
|
$history = false, $filter_event_type = false) {
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -5496,7 +5501,7 @@ function reporting_get_group_detailed_event ($id_group, $period = 0,
|
|||||||
$events = events_get_group_events($id_group, $period, $date,
|
$events = events_get_group_events($id_group, $period, $date,
|
||||||
$filter_event_validated, $filter_event_critical,
|
$filter_event_validated, $filter_event_critical,
|
||||||
$filter_event_warning, $filter_event_no_validated,
|
$filter_event_warning, $filter_event_no_validated,
|
||||||
$filter_event_filter_search, false, $history);
|
$filter_event_filter_search, false, $history, $filter_event_type);
|
||||||
|
|
||||||
if ($return_type === 'hash') {
|
if ($return_type === 'hash') {
|
||||||
return $events;
|
return $events;
|
||||||
@ -5692,7 +5697,8 @@ function reporting_get_module_detailed_event ($id_modules, $period = 0,
|
|||||||
function reporting_get_agents_detailed_event ($id_agents, $period = 0,
|
function reporting_get_agents_detailed_event ($id_agents, $period = 0,
|
||||||
$date = 0, $return = false, $filter_event_validated = false,
|
$date = 0, $return = false, $filter_event_validated = false,
|
||||||
$filter_event_critical = false, $filter_event_warning = false,
|
$filter_event_critical = false, $filter_event_warning = false,
|
||||||
$filter_event_no_validated = false, $only_data = false, $history = false) {
|
$filter_event_no_validated = false, $only_data = false,
|
||||||
|
$history = false, $filter_event_type = false) {
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -5718,8 +5724,8 @@ function reporting_get_agents_detailed_event ($id_agents, $period = 0,
|
|||||||
(int)$period,
|
(int)$period,
|
||||||
(int)$date,
|
(int)$date,
|
||||||
$filter_event_validated, $filter_event_critical,
|
$filter_event_validated, $filter_event_critical,
|
||||||
$filter_event_warning, $filter_event_no_validated,
|
$filter_event_warning, $filter_event_no_validated,
|
||||||
$history);
|
$history, $filter_event_type);
|
||||||
|
|
||||||
if (empty($event)) {
|
if (empty($event)) {
|
||||||
$event = array();
|
$event = array();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user