Merge branch 'ent-4859-8959-SNMP-console-filter-warning-critical-critical-normal' into 'develop'

fix bug in snmp console filter

See merge request artica/pandorafms!2844
This commit is contained in:
Daniel Rodriguez 2019-11-05 14:01:35 +01:00
commit 01ba485401
1 changed files with 32 additions and 9 deletions

View File

@ -430,15 +430,38 @@ if ($date_to_trap != '') {
}
if ($filter_severity != -1) {
// Test if install the enterprise to search oid in text or oid field in ttrap.
if ($config['enterprise_installed']) {
$whereSubquery .= ' AND (
(alerted = 0 AND severity = '.$filter_severity.') OR
(alerted = 1 AND priority = '.$filter_severity.'))';
} else {
$whereSubquery .= ' AND (
(alerted = 0 AND 1 = '.$filter_severity.') OR
(alerted = 1 AND priority = '.$filter_severity.'))';
// There are two special severity values aimed to match two different trap standard severities in database: warning/critical and critical/normal.
if ($filter_severity != EVENT_CRIT_OR_NORMAL && $filter_severity != EVENT_CRIT_WARNING_OR_CRITICAL) {
// Test if enterprise is installed to search oid in text or oid field in ttrap.
if ($config['enterprise_installed']) {
$whereSubquery .= ' AND (
(alerted = 0 AND severity = '.$filter_severity.') OR
(alerted = 1 AND priority = '.$filter_severity.'))';
} else {
$whereSubquery .= ' AND (
(alerted = 0 AND 1 = '.$filter_severity.') OR
(alerted = 1 AND priority = '.$filter_severity.'))';
}
} else if ($filter_severity === EVENT_CRIT_WARNING_OR_CRITICAL) {
// Test if enterprise is installed to search oid in text or oid field in ttrap.
if ($config['enterprise_installed']) {
$whereSubquery .= ' AND (
(alerted = 0 AND (severity = '.EVENT_CRIT_WARNING.' OR severity = '.EVENT_CRIT_CRITICAL.')) OR
(alerted = 1 AND (priority = '.EVENT_CRIT_WARNING.' OR priority = '.EVENT_CRIT_CRITICAL.')))';
} else {
$whereSubquery .= ' AND (
(alerted = 1 AND (priority = '.EVENT_CRIT_WARNING.' OR priority = '.EVENT_CRIT_CRITICAL.')))';
}
} else if ($filter_severity === EVENT_CRIT_OR_NORMAL) {
// Test if enterprise is installed to search oid in text or oid field in ttrap.
if ($config['enterprise_installed']) {
$whereSubquery .= ' AND (
(alerted = 0 AND (severity = '.EVENT_CRIT_NORMAL.' OR severity = '.EVENT_CRIT_CRITICAL.')) OR
(alerted = 1 AND (priority = '.EVENT_CRIT_NORMAL.' OR priority = '.EVENT_CRIT_CRITICAL.')))';
} else {
$whereSubquery .= ' AND (
(alerted = 1 AND (priority = '.EVENT_CRIT_NORMAL.' OR priority = '.EVENT_CRIT_CRITICAL.')))';
}
}
}