diff --git a/pandora_console/operation/snmpconsole/snmp_view.php b/pandora_console/operation/snmpconsole/snmp_view.php index 72f24e0575..649a3814c5 100755 --- a/pandora_console/operation/snmpconsole/snmp_view.php +++ b/pandora_console/operation/snmpconsole/snmp_view.php @@ -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.')))'; + } } }