Skip to content

Commit

Permalink
Adding a config value to snmp disco to set the no_use_bulkwalkall val…
Browse files Browse the repository at this point in the history
…ue for all discovered devices. (#766)
  • Loading branch information
i3149 authored Oct 22, 2024
1 parent 264da3d commit 9417a2f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
32 changes: 17 additions & 15 deletions pkg/inputs/snmp/disco.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,15 @@ func doubleCheckHost(result scan.Result, timeout time.Duration, ctl chan bool, m
for _, config := range v3configs { // Now loop over all the possible configs.
testConfig := config // Capture this as a local var.
device = kt.SnmpDeviceConfig{
DeviceName: result.Name,
DeviceIP: result.Host.String(),
Community: "", // Run using v3 here.
UseV1: conf.Disco.UseV1,
V3: testConfig,
Debug: conf.Disco.Debug,
Port: uint16(conf.Disco.Ports[0]),
Checked: time.Now(),
DeviceName: result.Name,
DeviceIP: result.Host.String(),
Community: "", // Run using v3 here.
UseV1: conf.Disco.UseV1,
V3: testConfig,
Debug: conf.Disco.Debug,
Port: uint16(conf.Disco.Ports[0]),
Checked: time.Now(),
NoUseBulkWalkAll: conf.Disco.NoUseBulkWalkAll,
}
serv, err := snmp_util.InitSNMP(&device, timeout, conf.Global.Retries, posit, log)
if err != nil {
Expand All @@ -249,13 +250,14 @@ func doubleCheckHost(result scan.Result, timeout time.Duration, ctl chan bool, m
for _, usev1 := range versions {
for _, community := range conf.Disco.DefaultCommunities {
device = kt.SnmpDeviceConfig{
DeviceName: result.Name,
DeviceIP: result.Host.String(),
Community: community,
UseV1: usev1,
Debug: conf.Disco.Debug,
Port: uint16(conf.Disco.Ports[0]),
Checked: time.Now(),
DeviceName: result.Name,
DeviceIP: result.Host.String(),
Community: community,
UseV1: usev1,
Debug: conf.Disco.Debug,
Port: uint16(conf.Disco.Ports[0]),
Checked: time.Now(),
NoUseBulkWalkAll: conf.Disco.NoUseBulkWalkAll,
}
serv, err := snmp_util.InitSNMP(&device, timeout, conf.Global.Retries, posit, log)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions pkg/kt/snmp.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ type SnmpDiscoConfig struct {
Kentik *KentikDisco `yaml:"kentik"`
CidrOrig string `yaml:"-"`
IgnoreOrig string `yaml:"-"`
NoUseBulkWalkAll bool `yaml:"no_use_bulkwalkall"`
}

type ProviderMap struct {
Expand Down

0 comments on commit 9417a2f

Please sign in to comment.