diff --git a/collector/collector.go b/collector/collector.go index a436d6cd..a500e6d2 100644 --- a/collector/collector.go +++ b/collector/collector.go @@ -126,6 +126,12 @@ func ScrapeTarget(ctx context.Context, target string, config *config.Module, log snmp.UseUnconnectedUDPSocket = config.WalkParams.UseUnconnectedUDPSocket snmp.LocalAddr = *srcAddress + // Allow a set of OIDs that aren't in a strictly increasing order + if config.WalkParams.AllowNonIncreasingOIDs { + snmp.AppOpts = make(map[string]interface{}) + snmp.AppOpts["c"] = true + } + var sent time.Time snmp.OnSent = func(x *gosnmp.GoSNMP) { sent = time.Now() diff --git a/config/config.go b/config/config.go index da456b85..d145b43b 100644 --- a/config/config.go +++ b/config/config.go @@ -50,6 +50,7 @@ var ( Timeout: time.Second * 5, Auth: DefaultAuth, UseUnconnectedUDPSocket: false, + AllowNonIncreasingOIDs: false, } DefaultModule = Module{ WalkParams: DefaultWalkParams, @@ -69,6 +70,7 @@ type WalkParams struct { Timeout time.Duration `yaml:"timeout,omitempty"` Auth Auth `yaml:"auth,omitempty"` UseUnconnectedUDPSocket bool `yaml:"use_unconnected_udp_socket,omitempty"` + AllowNonIncreasingOIDs bool `yaml:"allow_nonincreasing_oids,omitempty"` } type Module struct {