From 9743f1a2d401833967ba7269b303b809d9ec9842 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Fri, 6 Mar 2020 12:59:31 +0100 Subject: [PATCH] Fix storm protection for SNMPv2 traps. --- pandora_server/lib/PandoraFMS/SNMPServer.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pandora_server/lib/PandoraFMS/SNMPServer.pm b/pandora_server/lib/PandoraFMS/SNMPServer.pm index 254eba58f0..f26cb4c3d9 100644 --- a/pandora_server/lib/PandoraFMS/SNMPServer.pm +++ b/pandora_server/lib/PandoraFMS/SNMPServer.pm @@ -157,6 +157,10 @@ sub data_producer ($) { # Storm protection. my ($ver, $date, $time, $source, $null) = split(/\[\*\*\]/, $line, 5); + if ($ver eq "SNMPv2" || $pa_config->{'snmp_pdu_address'} eq '1' ) { + $source =~ s/(?:(?:TCP|UDP):\s*)?\[?([^] ]+)\]?(?::-?\d+)?(?:\s*->.*)?$/$1/; + } + next unless defined ($source); if (! defined ($AGENTS{$source})) { $AGENTS{$source}{'count'} = 1;