Skip to content

chore(generator): fail early for bad walk OID #1411

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

Merged
merged 1 commit into from
Apr 17, 2025

Conversation

JohnVillalovos
Copy link
Contributor

@JohnVillalovos JohnVillalovos commented Apr 16, 2025

In generator.yml and in a walk: section. If an OID starts with a
period, for example .1.3.6.1.4.1.20916, this will fail to be found,
as it should be: 1.3.6.1.4.1.20916. But the error message lacks
detail when this happens.

Fail early if an OID starts with a "." and explain why.

@JohnVillalovos JohnVillalovos force-pushed the jlvillal/walk branch 2 times, most recently from 27c6aa7 to dda4c35 Compare April 16, 2025 03:10
@JohnVillalovos JohnVillalovos changed the title chore(generator): emit error message for bad walk OID chore(generator): fail early for bad walk OID Apr 16, 2025
@JohnVillalovos
Copy link
Contributor Author

Example run:

./generator generate
time=2025-04-16T06:03:37.079Z level=INFO source=net_snmp.go:174 msg="Loading MIBs" from=$HOME/.snmp/mibs:/usr/share/snmp/mibs
time=2025-04-16T06:03:37.105Z level=INFO source=main.go:57 msg="Generating config for module" module=avtech
time=2025-04-16T06:03:37.108Z level=ERROR source=main.go:141 msg="Error generating config netsnmp" err="invalid OID .1.3.6.1.4.1.20916, prefix of '.' should be removed"

@SuperQ
Copy link
Member

SuperQ commented Apr 16, 2025

This needs a DCO sign-off. You can use git commit -s --amend to add it.

@JohnVillalovos
Copy link
Contributor Author

This needs a DCO sign-off. You can use git commit -s --amend to add it.

Done.

@JohnVillalovos
Copy link
Contributor Author

@SuperQ There is a failing test but it seems unrelated to my change. As it is a failure in downloading a MIB. Please let me know if there are any other changes you would like. Thanks.

@SuperQ
Copy link
Member

SuperQ commented Apr 17, 2025

See #1412

@bastischubert
Copy link
Member

checks now fixed - go ahead 🚶

In `generator.yml` and in a `walk:` section.  If an OID starts with a
period, for example `.1.3.6.1.4.1.20916`, this will fail to be found,
as it should be: `1.3.6.1.4.1.20916`. But the error message lacks
detail when this happens.

Fail early if an OID starts with a "." and explain why.

Signed-off-by: John L. Villalovos <[email protected]>
@JohnVillalovos
Copy link
Contributor Author

checks now fixed - go ahead 🚶

Thanks. I went ahead and rebased it.

@SuperQ SuperQ merged commit 33a80d6 into prometheus:main Apr 17, 2025
6 checks passed
@JohnVillalovos JohnVillalovos deleted the jlvillal/walk branch April 17, 2025 15:48
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 this pull request may close these issues.

3 participants