Skip to content

feat(provider): add SNMP provider - webhook-based trap receiver (closes #2112)#6400

Open
irisdigitaldocs-maker wants to merge 5 commits intokeephq:mainfrom
irisdigitaldocs-maker:feat/snmp-provider-2112
Open

feat(provider): add SNMP provider - webhook-based trap receiver (closes #2112)#6400
irisdigitaldocs-maker wants to merge 5 commits intokeephq:mainfrom
irisdigitaldocs-maker:feat/snmp-provider-2112

Conversation

@irisdigitaldocs-maker
Copy link
Copy Markdown

Summary

Adds a new SNMP provider that receives SNMP trap notifications as Keep alerts — closes #2112.

This is a webhook-based, zero-dependency implementation: Keep acts as the HTTP endpoint for a small handler script that forwards trap data from snmptrapd (or any SNMP manager such as Zabbix or Icinga) as JSON. No pysnmp library required.

What is included

  • keep/providers/snmp_provider/snmp_provider.py — provider implementation

    • Handles three real-world payload shapes: structured JSON (Checkmk/custom), flat JSON, and snmptrapd-style output
    • Resolves trap names from explicit fields, OID lookup, or SNMPv1 generic trap number
    • Maps all 6 well-known RFC 1215 traps to correct severity/status
    • linkUp / warmStart auto-resolve to AlertStatus.RESOLVED
    • Zero new dependencies (pure stdlib + existing Keep packages)
  • keep/providers/snmp_provider/alerts_mock.py — 6 realistic mock payloads for manual QA

  • tests/test_snmp_provider.py — 30+ unit tests covering all trap name resolution paths, severity mappings, status paths, all three payload formats, and edge cases

  • docs/providers/documentation/snmp-provider.mdx — full MDX docs with severity table, three setup options (snmptrapd handler script, direct JSON POST, Zabbix media type), and supported fields reference

Testing

pytest tests/test_snmp_provider.py -v

All 30+ tests pass with zero external dependencies.

Setup overview

# snmptrapd handler forwards to Keep webhook
curl -X POST https://your-keep/api/alerts/event/snmp \
  -H "Content-Type: application/json" \
  -d '{"trap_name":"linkDown","source_ip":"192.168.1.1","trap_oid":"1.3.6.1.6.3.1.1.5.3"}'

Full setup docs at docs/providers/documentation/snmp-provider.mdx.

@dosubot dosubot Bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label May 5, 2026
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@dosubot dosubot Bot added Documentation Improvements or additions to documentation Feature A new feature Provider Providers related issues labels May 5, 2026
@irisdigitaldocs-maker
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Improvements or additions to documentation Feature A new feature Provider Providers related issues size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🔌 Provider]: SNMP provider

3 participants