diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
index 85bea20ae5..c12c594b96 100755
--- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php
+++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
@@ -100,6 +100,8 @@ $filter_event_no_validated = false;
$filter_event_critical = false;
$filter_event_warning = false;
+$filter_event_type = false;
+
$event_graph_by_agent = false;
$event_graph_by_user_validator = false;
$event_graph_by_criticity = false;
@@ -414,6 +416,7 @@ switch ($action) {
$filter_event_validated = $style['filter_event_validated'];
$filter_event_critical = $style['filter_event_critical'];
$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_user_validator = $style['event_graph_by_user_validator'];
@@ -430,6 +433,7 @@ switch ($action) {
$filter_event_validated = $style['filter_event_validated'];
$filter_event_critical = $style['filter_event_critical'];
$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_user_validator = $style['event_graph_by_user_validator'];
@@ -1303,6 +1307,20 @@ You can of course remove the warnings, that's why we include the source and do n
+
|
@@ -1817,7 +1835,6 @@ $(document).ready (function () {
async: false,
timeout: 10000,
success: function (data) {
- console.log(data);
switch (data) {
case 'boolean':
case 'sparse':
@@ -2328,6 +2345,7 @@ function chooseType() {
$("#row_last_value").hide();
$("#row_filter_search").hide();
$("#row_percentil").hide();
+ $("#row_event_type").hide();
// SLA list default state
$("#sla_list").hide();
@@ -2356,6 +2374,7 @@ function chooseType() {
$("#row_event_graph_by_user").show();
$("#row_event_graph_by_criticity").show();
$("#row_event_graph_by_validated").show();
+ $("#row_event_type").show();
$("#row_filter_search").show();
break;
@@ -2618,6 +2637,7 @@ function chooseType() {
$("#row_event_graph_by_user").show();
$("#row_event_graph_by_criticity").show();
$("#row_event_graph_by_validated").show();
+ $("#row_event_type").show();
$('#agent_autocomplete').hide();
$('#agent_autocomplete_events').show();
diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php
index 1e48fba16f..a070f7d5a0 100755
--- a/pandora_console/godmode/reporting/reporting_builder.php
+++ b/pandora_console/godmode/reporting/reporting_builder.php
@@ -1056,6 +1056,7 @@ switch ($action) {
$filter_event_no_validated = get_parameter('filter_event_no_validated', 0);
$filter_event_critical = get_parameter('filter_event_critical', 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_user_validator = get_parameter('event_graph_by_user_validator', 0);
@@ -1126,7 +1127,7 @@ switch ($action) {
$style['filter_event_validated'] = $filter_event_validated;
$style['filter_event_critical'] = $filter_event_critical;
$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_user_validator'] = $event_graph_by_user_validator;
$style['event_graph_by_criticity'] = $event_graph_by_criticity;
@@ -1435,6 +1436,7 @@ switch ($action) {
$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_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', '');
@@ -1443,6 +1445,7 @@ switch ($action) {
$style['filter_event_validated'] = $filter_event_validated;
$style['filter_event_critical'] = $filter_event_critical;
$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_user_validator'] = $event_graph_by_user_validator;
diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php
index 2bab6ca0e9..0ad8db64b8 100644
--- a/pandora_console/include/functions_events.php
+++ b/pandora_console/include/functions_events.php
@@ -1187,7 +1187,8 @@ function events_print_type_description ($type, $return = false) {
function events_get_group_events ($id_group, $period, $date,
$filter_event_validated = false, $filter_event_critical = 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;
@@ -1223,6 +1224,28 @@ function events_get_group_events ($id_group, $period, $date,
' 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('
AND id_grupo IN (%s)
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,
$filter_event_validated = false, $filter_event_critical = false,
$filter_event_warning = false, $filter_event_no_validated = false,
- $history = false) {
+ $history = false, $filter_event_type = false) {
if (!is_numeric ($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
AND utimestamp <= %d ', $id_agent, $datelimit, $date);
diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index b915dd6178..cfab2e4c80 100644
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -1239,24 +1239,26 @@ function reporting_event_report_group($report, $content,
$return["description"] = $content["description"];
$return["date"] = reporting_get_date_text($report, $content);
+ $event_filter = $content['style'];
- $filter_event_no_validated = $content['style']['filter_event_no_validated'];
- $filter_event_validated = $content['style']['filter_event_validated'];
- $filter_event_critical = $content['style']['filter_event_critical'];
- $filter_event_warning = $content['style']['filter_event_warning'];
- $filter_event_filter_search = $content['style']['event_filter_search'];
+ $filter_event_no_validated = $event_filter['filter_event_no_validated'];
+ $filter_event_validated = $event_filter['filter_event_validated'];
+ $filter_event_critical = $event_filter['filter_event_critical'];
+ $filter_event_warning = $event_filter['filter_event_warning'];
+ $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_user_validator = $content['style']['event_graph_by_user_validator'];
- $event_graph_by_criticity = $content['style']['event_graph_by_criticity'];
- $event_graph_validated_vs_unvalidated = $content['style']['event_graph_validated_vs_unvalidated'];
+ $event_graph_by_agent = $event_filter['event_graph_by_agent'];
+ $event_graph_by_user_validator = $event_filter['event_graph_by_user_validator'];
+ $event_graph_by_criticity = $event_filter['event_graph_by_criticity'];
+ $event_graph_validated_vs_unvalidated = $event_filter['event_graph_validated_vs_unvalidated'];
$data = reporting_get_group_detailed_event(
$content['id_group'], $content['period'], $report["datetime"],
true, true, $filter_event_validated, $filter_event_critical,
$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)) {
$return['failed'] = __('No events');
@@ -2162,6 +2164,7 @@ function reporting_event_report_agent($report, $content,
$filter_event_validated = $style['filter_event_validated'];
$filter_event_critical = $style['filter_event_critical'];
$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_criticity = $style['event_graph_by_criticity'];
@@ -2177,7 +2180,8 @@ function reporting_event_report_agent($report, $content,
$filter_event_warning,
$filter_event_no_validated,
true,
- $history);
+ $history,
+ $filter_event_type);
@@ -5619,7 +5623,8 @@ function reporting_get_group_detailed_event ($id_group, $period = 0,
$date = 0, $return = false, $html = true,
$filter_event_validated = false, $filter_event_critical = 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;
@@ -5651,7 +5656,7 @@ function reporting_get_group_detailed_event ($id_group, $period = 0,
$events = events_get_group_events($id_group, $period, $date,
$filter_event_validated, $filter_event_critical,
$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') {
return $events;
@@ -5847,7 +5852,8 @@ function reporting_get_module_detailed_event ($id_modules, $period = 0,
function reporting_get_agents_detailed_event ($id_agents, $period = 0,
$date = 0, $return = false, $filter_event_validated = 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;
@@ -5873,8 +5879,8 @@ function reporting_get_agents_detailed_event ($id_agents, $period = 0,
(int)$period,
(int)$date,
$filter_event_validated, $filter_event_critical,
- $filter_event_warning, $filter_event_no_validated,
- $history);
+ $filter_event_warning, $filter_event_no_validated,
+ $history, $filter_event_type);
if (empty($event)) {
$event = array();
|