Skip to content

feat: add SNMP provider (trap receiver + OID polling, 112 tests)#6172

Open
chengyixu wants to merge 2 commits intokeephq:mainfrom
chengyixu:feat/snmp-provider
Open

feat: add SNMP provider (trap receiver + OID polling, 112 tests)#6172
chengyixu wants to merge 2 commits intokeephq:mainfrom
chengyixu:feat/snmp-provider

Conversation

@chengyixu
Copy link
Copy Markdown

Summary

Adds a new provider for SNMP (Simple Network Management Protocol), enabling Keep
to monitor any SNMP-capable infrastructure device: routers, switches, servers,
firewalls, UPS, and printers.

Closes #2112

Features

  • Push mode (trap receiver) — built-in UDP listener receives SNMP traps directly
    from devices; also accepts trap data forwarded as JSON from snmptrapd via webhook
  • Pull mode (OID polling) — periodic SNMP GET/WALK on configurable targets with
    threshold-based alert generation
  • SNMPv1, SNMPv2c, SNMPv3 — MD5/SHA authentication, DES/AES privacy
  • Standard RFC trap OID mapping (coldStart, warmStart, linkDown, linkUp, authFailure)
  • Vendor prefix detection (Cisco, HP, Dell, Juniper, Huawei, VMware, Net-SNMP)
  • Configurable OID → severity/name overrides via JSON map
  • Dependency: pysnmp-lextudio (optional, only needed for trap receiver/polling)

Files

File Description
keep/providers/snmp_provider/snmp_provider.py Provider (790 lines)
keep/providers/snmp_provider/alerts_mock.py Mock trap payloads
keep/providers/snmp_provider/requirements.txt pysnmp-lextudio
tests/providers/snmp_provider/test_snmp_provider.py 112 unit tests
docs/providers/documentation/snmp-provider.mdx Documentation
docs/snippets/providers/snmp-snippet-autogenerated.mdx Auth snippet
docs/mint.json Sidebar registration

/claim #2112

chengyixu and others added 2 commits March 29, 2026 14:28
When process_topology refreshes provider topology data it deletes all
existing TopologyService rows for that provider. If any of those services
were associated with a TopologyApplication (via the TopologyServiceApplication
join table), the delete violated the foreign-key constraint on
topologyserviceapplication.service_id and raised:

  sqlalchemy.exc.IntegrityError: ForeignKeyViolation on
  topologyserviceapplication — topologyservice.id still referenced

The fix deletes the TopologyServiceApplication join-table rows first,
in the same transaction as the dependency and service deletes, using the
same filter pattern already used for TopologyServiceDependency.

Closes keephq#5439

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a new Keep provider for SNMP, enabling integration with any
SNMP-capable infrastructure device (routers, switches, servers, firewalls,
UPS, printers).

Push mode: built-in UDP trap receiver + snmptrapd webhook forwarding.
Pull mode: periodic OID polling with configurable targets and thresholds.
Supports SNMPv1, SNMPv2c, SNMPv3 (MD5/SHA auth, DES/AES privacy).
OID severity mapping with configurable overrides.
Standard trap OID (1.3.6.1.6.3.1.1.5.*) and vendor prefix support.

112 unit tests, Mintlify docs, auto-generated snippet, mint.json entry.

Closes keephq#2112

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 29, 2026

@chengyixu is attempting to deploy a commit to the KeepHQ Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. Documentation Improvements or additions to documentation Feature A new feature Provider Providers related issues labels Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🙋 Bounty claim Documentation Improvements or additions to documentation Feature A new feature Provider Providers related issues size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🔌 Provider]: SNMP provider

1 participant