How to drop unneeded traps received by snmptt?
Posted: Mon Dec 26, 2022 1:33 pm
There are multiple traps that we don't want to receive, in some cases all the traps from specific MIBs. We want to ingest the MIBs so the traps would be recognized properly but we want to be able to easily drop them. I can think of three solutions--all of them are looking as jumping through the hoops.
1. Adding EXEC statement like this to each trap: echo 'authenticationFailure received' > /dev/null
I tried it and it actually stopped ALL the traps from being ingested. I removed the statement but i still don't have traps coming.
2. Updating the default snmp handler script to exclude specific traps, e.g. the code to exclude authenticationFailure trap from SNMPv2-MIB:
....
if service != "Traps - SNMPv2-MIB - authenticationFailure"
return_code = get_return_code(severity)
post_results(host, service, mytime, mondata_res, return_code)
3. Using a MATCH statement to explicitly not match on any variable, e.g.
MATCH $3: (DROP THIS TRAP)
It seems that there should be a better, easier way. The solutions #1 and #3 would work on a specific trap only. #2 requires coding and maintaining the script. I'd like to be able to drop all traps from a specific MIB or drop all traps with severity Warning.
Please advise if there is a better, more generic technique to do that.
1. Adding EXEC statement like this to each trap: echo 'authenticationFailure received' > /dev/null
I tried it and it actually stopped ALL the traps from being ingested. I removed the statement but i still don't have traps coming.
2. Updating the default snmp handler script to exclude specific traps, e.g. the code to exclude authenticationFailure trap from SNMPv2-MIB:
....
if service != "Traps - SNMPv2-MIB - authenticationFailure"
return_code = get_return_code(severity)
post_results(host, service, mytime, mondata_res, return_code)
3. Using a MATCH statement to explicitly not match on any variable, e.g.
MATCH $3: (DROP THIS TRAP)
It seems that there should be a better, easier way. The solutions #1 and #3 would work on a specific trap only. #2 requires coding and maintaining the script. I'd like to be able to drop all traps from a specific MIB or drop all traps with severity Warning.
Please advise if there is a better, more generic technique to do that.