Merge branch 'ent-3214-exact-oid-matches' into 'develop'
Add support for exact matches to SNMP alerts. See merge request artica/pandorafms!2090 Former-commit-id: 5e4c43a5343f7fa6992c05c93c0695b1881548b9
This commit is contained in:
commit
ba87d6a9b8
|
@ -751,7 +751,7 @@ if ($create_alert || $update_alert) {
|
|||
|
||||
// echo '<tr><td class="datos"><b>' . __('Alert filters') . ui_print_help_icon("snmp_alert_filters", true) . '</b></td></tr>';
|
||||
// OID
|
||||
echo '<tr id="tr-oid">'.'<td class="datos2">'.__('Enterprise String').'</td>'.'<td class="datos2">';
|
||||
echo '<tr id="tr-oid">'.'<td class="datos2">'.__('Enterprise String').ui_print_help_tip (__('Matches substrings. End the string with $ for exact matches.'), true).'</td>'.'<td class="datos2">';
|
||||
html_print_input_text('oid', $oid, '', 50, 255);
|
||||
echo '</td></tr>';
|
||||
|
||||
|
|
|
@ -3418,7 +3418,16 @@ sub pandora_evaluate_snmp_alerts ($$$$$$$$$) {
|
|||
$alert->{'oid'} = decode_entities($alert->{'oid'});
|
||||
my $oid = $alert->{'oid'};
|
||||
if ($oid ne '') {
|
||||
my $term = substr($oid, -1);
|
||||
# Strict match.
|
||||
if ($term eq '$') {
|
||||
chop($oid);
|
||||
next if ($trap_oid ne $oid && $trap_oid_text ne $oid);
|
||||
}
|
||||
# Partial match.
|
||||
else {
|
||||
next if (index ($trap_oid, $oid) == -1 && index ($trap_oid_text, $oid) == -1);
|
||||
}
|
||||
$alert_data .= "OID: $oid ";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue