Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeout cannot be configured for snmp receiver #25885

Closed
technimad-splunk opened this issue Aug 18, 2023 · 3 comments
Closed

Timeout cannot be configured for snmp receiver #25885

technimad-splunk opened this issue Aug 18, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request receiver/snmp

Comments

@technimad-splunk
Copy link
Contributor

Component(s)

receiver/snmp

Is your feature request related to a problem? Please describe.

Some devices are slow to respond. It can take more than the hard coded 5 seconds to get a reply. Currently these requests fail, as they time out.

the following message is logged when this happens:

2023-08-18T12:39:55.762Z	error	scraperhelper/scrapercontroller.go:200	Error scraping metrics	{"kind": "receiver", "name": "snmp", "data_type": "metrics", "error": "problem with getting indexed data: problem with SNMP WALK for OID '.1.3.6.1.4.1.14988.1.1.1.2.1.9': request timeout (after 0 retries)", "scraper": "snmp"}

Describe the solution you'd like

Make the timeout configurable. Use a timeout parameter at the level the connection is defined i.e.:

receivers:
  snmp:
    collection_interval: 30s
    version: 2c
    timeout: 25s

Describe alternatives you've considered

Alternative for now is to limit the number of oid to retrieve per receiver configuration. Effectively splitting a configuration in multiple receivers, and hope all will receive data within 5 seconds.

Additional context

Current timeout is defined here:
https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/snmpreceiver/client.go#L65

@technimad-splunk technimad-splunk added enhancement New feature or request needs triage New item requiring triage labels Aug 18, 2023
@github-actions
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@technimad-splunk technimad-splunk changed the title Timeout cannot be configured Timeout cannot be configured for snmp receiver Aug 18, 2023
@djaglowski djaglowski removed the needs triage New item requiring triage label Aug 18, 2023
@djaglowski
Copy link
Member

Seems reasonable. Is this a change you could contribute @technimad-splunk?

@technimad-splunk
Copy link
Contributor Author

I will give it a go. Seems trivial to add.

dmitryax pushed a commit that referenced this issue Aug 28, 2023
**Description:** 
The timeout of snmp requests was hard coded to 5 seconds. This commit
adds timeout to the configuration of this receiver. The timeout can now
be set using the timeout key at the higest level in the configuration.
The default is left at 5 seconds.

**Link to tracking Issue:** 
#25885

**Testing:** 
Updated `TestNewFactory` method to reflect new default config.
Ran receiver against devices demanding a high timeout. During testing
added extra logging statements to check if timeout setting was
propagated correctly to the underlying SNMP library and if it was
reflected in the SNMP commands executed. Tests succeeded. Removed extra
logging statements as we shouldn't create a log per datapoint received
in production.

**Documentation:** 
Added the new config option `timeout` to README.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request receiver/snmp
Projects
None yet
Development

No branches or pull requests

2 participants