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

retries 0 is not respected #785

Closed
xkilian opened this issue Aug 3, 2022 · 1 comment · Fixed by #786
Closed

retries 0 is not respected #785

xkilian opened this issue Aug 3, 2022 · 1 comment · Fixed by #786

Comments

@xkilian
Copy link

xkilian commented Aug 3, 2022

Host operating system: output of uname -a

Ubuntu 18.04LTS

snmp_exporter version: output of snmp_exporter -version

snmp_exporter 0.19

What device/snmpwalk OID are you using?

N/A

If this is a new device, please link to the MIB(s).

N/A

What did you do that produced an error?

configure a device collection using the option:

retries 0

generate the configuration

What did you expect to see?

retries 0 appear in the generated configuration

What did you see instead?

The line is not placed in the snmp.yml output. Causing it to default to retries: 3.

Clarify the documentation to indicate if retries 0 (no retries) is a supported configuration or not. If it is not, is there a reason for this. Some devices cannot be polled twice in a row without a delay, otherwise the snmp stacks will crash.

@SuperQ
Copy link
Member

SuperQ commented Aug 3, 2022

That is very strange. I did some tests and found that the retries is correctly parsed from the generator.yml when you run generator generate. But the Marshal yaml output skips this value.

It seems to do the same thing for other values like max_repetitions: 0.

This seems to be a bug in the yaml library output. Or possibly the way the walk parameters are inlined in the yaml struct.

SuperQ added a commit that referenced this issue Aug 3, 2022
Fix parsing of `0` in retries in the generator config by making the
struct value a pointer[0].

Fixes: #785

[0]: https://www.sohamkamani.com/golang/omitempty/#the-difference-between-0--and-nil

Signed-off-by: SuperQ <[email protected]>
SuperQ added a commit that referenced this issue Aug 3, 2022
Fix parsing of `0` in retries in the generator config by making the
struct value a pointer[0].

Fixes: #785

[0]: https://www.sohamkamani.com/golang/omitempty/#the-difference-between-0--and-nil

Signed-off-by: SuperQ <[email protected]>
SuperQ added a commit that referenced this issue Aug 4, 2022
Fix parsing of `0` in retries in the generator config by making the
struct value a pointer[0].

Fixes: #785

[0]: https://www.sohamkamani.com/golang/omitempty/#the-difference-between-0--and-nil

Signed-off-by: SuperQ <[email protected]>
SuperQ added a commit that referenced this issue Aug 4, 2022
Fix parsing of `0` in retries in the generator config by making the
struct value a pointer[0].

Fixes: #785

[0]: https://www.sohamkamani.com/golang/omitempty/#the-difference-between-0--and-nil

Signed-off-by: SuperQ <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants