-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: add SNMP provider for receiving and processing SNMP traps (#2112) #5216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…hq#2112) - Support for SNMPv1, SNMPv2c, and SNMPv3 protocols - Authentication and encryption for SNMPv3 (MD5/SHA auth, DES/AES privacy) - Automatic severity mapping for standard SNMP traps - Configurable listening address and port - Rich alert context with system information and trap variables - Comprehensive error handling and validation - Added pysnmp-lextudio dependency for SNMP protocol support - Complete documentation with usage examples
|
@MAVRICK-1 is attempting to deploy a commit to the KeepHQ Team on Vercel. A member of the Team first needs to authorize it. |
…ovider - Add thread locks to prevent race conditions on received_traps list - Fix transport info extraction with proper null checks - Prevent multiple trap receiver thread startups - Ensure atomic operations for alert buffer management Fixes identified race conditions that could cause: - Data corruption and lost alerts - Port binding conflicts - Resource leaks - Incorrect transport information
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: SNMPv3 Protocol Validation and Key Handling
The SNMP provider has two validation issues:
- SNMPv3
auth_protocolandpriv_protocolvalidation is case-sensitive, but the underlying setup code is case-insensitive, causing valid lowercase inputs to be rejected. - It fails to validate that
priv_keyis provided whenpriv_protocolis configured for SNMPv3, which can lead to runtime errors during engine setup.
keep/providers/snmp_provider/snmp_provider.py#L194-L203
keep/keep/providers/snmp_provider/snmp_provider.py
Lines 194 to 203 in 892f83d
| # Validate SNMPv3 configuration if provided | |
| if self.authentication_config.security_name: | |
| if not self.authentication_config.auth_protocol: | |
| raise ValueError("SNMPv3 security name provided but auth protocol is missing") | |
| if not self.authentication_config.auth_key: | |
| raise ValueError("SNMPv3 security name provided but auth key is missing") | |
| if self.authentication_config.auth_protocol not in ["MD5", "SHA"]: | |
| raise ValueError(f"Invalid auth protocol: {self.authentication_config.auth_protocol}. Must be MD5 or SHA") | |
| if self.authentication_config.priv_protocol and self.authentication_config.priv_protocol not in ["DES", "AES"]: | |
| raise ValueError(f"Invalid privacy protocol: {self.authentication_config.priv_protocol}. Must be DES or AES") |
Was this report helpful? Give feedback by reacting with 👍 or 👎
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey! thanks for opening this PR.
have you tested it? can you share a video of this working?
Screencast.from.2025-07-23.18-20-20.mp4 |
|
@MAVRICK-1 closing as its not ready to merge. you can see other PR's about new providers to understand whats need to be done. |
Closes #2112
📑 Description
This PR adds a new SNMP provider that enables Keep to receive and process SNMP traps from network devices, converting them into actionable Keep alerts.
Key Features Implemented:
The provider automatically maps standard SNMP traps (coldStart, warmStart, linkDown, linkUp, authenticationFailure, etc.) to appropriate alert severities
and extracts meaningful information like system name, uptime, and interface details.
✅ Checks
ℹ Additional Information
Dependencies Added:
pysnmp-lextudio = "^6.3.0"- Modern SNMP library for Python with asyncio supportConfiguration Example:
Testing:
The provider has been tested with various SNMP trap types and includes comprehensive error handling for production use. Test scripts are provided in the
codebase for validation.
Breaking Changes:
None - this is a new provider addition that doesn't affect existing functionality.
Files Added:
/claim #2112