Skip to content

Commit

Permalink
Adding a drop_undefined conf option to drop undefined traps (#658)
Browse files Browse the repository at this point in the history
  • Loading branch information
i3149 authored Feb 2, 2024
1 parent 687e4eb commit 7959aca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/inputs/snmp/traps/traps.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func (s *SnmpTrap) handle(packet *gosnmp.SnmpPacket, addr *net.UDPAddr) {
}

// If we don't want undefined vars, pass along here.
if res == nil && trap.DropUndefinedVars() {
if res == nil && (s.conf.Trap.DropUndefined || trap.DropUndefinedVars()) {
continue
}

Expand Down
13 changes: 7 additions & 6 deletions pkg/kt/snmp.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,13 @@ type SnmpDeviceConfig struct {
}

type SnmpTrapConfig struct {
Listen string `yaml:"listen"`
Community string `yaml:"community"`
Version string `yaml:"version"`
Transport string `yaml:"transport"`
V3 *V3SNMPConfig `yaml:"v3_config"`
TrapOnly bool `yaml:"trap_only"`
Listen string `yaml:"listen"`
Community string `yaml:"community"`
Version string `yaml:"version"`
Transport string `yaml:"transport"`
V3 *V3SNMPConfig `yaml:"v3_config"`
TrapOnly bool `yaml:"trap_only"`
DropUndefined bool `yaml:"drop_undefined"`
}

type KentikMatch struct {
Expand Down

0 comments on commit 7959aca

Please sign in to comment.