Skip to content

Commit

Permalink
Support equipment responding from different source address (prometheu…
Browse files Browse the repository at this point in the history
…s#702)

Closes prometheus#699.

Signed-off-by: Torbjörn Lönnemark <[email protected]>
  • Loading branch information
tobbez authored Mar 21, 2022
1 parent 0b5fa5a commit 1bbd025
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ func ScrapeTarget(ctx context.Context, target string, config *config.Module, log
snmp.MaxRepetitions = config.WalkParams.MaxRepetitions
snmp.Retries = config.WalkParams.Retries
snmp.Timeout = config.WalkParams.Timeout
snmp.UseUnconnectedUDPSocket = config.WalkParams.UseUnconnectedUDPSocket

var sent time.Time
snmp.OnSent = func(x *gosnmp.GoSNMP) {
Expand Down
22 changes: 12 additions & 10 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ var (
PrivProtocol: "DES",
}
DefaultWalkParams = WalkParams{
Version: 2,
MaxRepetitions: 25,
Retries: 3,
Timeout: time.Second * 5,
Auth: DefaultAuth,
Version: 2,
MaxRepetitions: 25,
Retries: 3,
Timeout: time.Second * 5,
Auth: DefaultAuth,
UseUnconnectedUDPSocket: false,
}
DefaultModule = Module{
WalkParams: DefaultWalkParams,
Expand All @@ -62,11 +63,12 @@ var (
type Config map[string]*Module

type WalkParams struct {
Version int `yaml:"version,omitempty"`
MaxRepetitions uint32 `yaml:"max_repetitions,omitempty"`
Retries int `yaml:"retries,omitempty"`
Timeout time.Duration `yaml:"timeout,omitempty"`
Auth Auth `yaml:"auth,omitempty"`
Version int `yaml:"version,omitempty"`
MaxRepetitions uint32 `yaml:"max_repetitions,omitempty"`
Retries int `yaml:"retries,omitempty"`
Timeout time.Duration `yaml:"timeout,omitempty"`
Auth Auth `yaml:"auth,omitempty"`
UseUnconnectedUDPSocket bool `yaml:"use_unconnected_udp_socket,omitempty"`
}

type Module struct {
Expand Down

0 comments on commit 1bbd025

Please sign in to comment.