Skip to content
New issue

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

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

Already on GitHub? # to your account

When using make docker-generate get "Error generating config netsnmp" #1048

Closed
jvillal-amp opened this issue Nov 17, 2023 · 6 comments
Closed

Comments

@jvillal-amp
Copy link
Contributor

Error seen is:

$ make docker-generate
docker build -t "prom/snmp-generator:main" .
<snip>
ts=2023-11-17T19:37:13.416Z caller=net_snmp.go:162 level=info msg="Loading MIBs" from=mibs
ts=2023-11-17T19:37:13.610Z caller=main.go:132 level=error msg="Error generating config netsnmp" err="error parsing yml config: yaml: unmarshal errors:\n  line 159: field scale not found in type main.plain\n  line 583: field scale not found in type main.plain\n  line 584: field offset not found in type main.plain"
make: *** [Makefile:86: docker-generate] Error 1

Using:

commit aec1630028c7e3bfe27a6187aa9623adde133372 (HEAD -> refs/heads/main, refs/remotes/origin/main, refs/remotes/origin/HEAD)
Author: Ben Kochie <superq@gmail.com>
Date:   Tue Nov 14 04:37:24 2023 -0600

    Refactor HOST-RESOURCES-MIB (#1027)
@hhromic
Copy link
Contributor

hhromic commented Nov 18, 2023

See #1045 , the problem is that the main Docker image tag is built with a generator binary using the latest tagged release in the repository, and not a binary using the latest state/commit of the main branch.

The error you see is because the generator.yml file in main requires a recent feature not yet in a tagged release.

If you want to try a quick local fix, edit the generator/Dockerfile file and change @latest to @main.
Afterwards, running make docker-generate should work as expected.

@hhromic
Copy link
Contributor

hhromic commented Nov 21, 2023

Now that #1045 was merged, this should work as expected:

$ git clone git@github.com:prometheus/snmp_exporter.git
Cloning into 'snmp_exporter'...
remote: Enumerating objects: 7644, done.
remote: Counting objects: 100% (1680/1680), done.
remote: Compressing objects: 100% (462/462), done.
remote: Total 7644 (delta 1303), reused 1328 (delta 1192), pack-reused 5964
Receiving objects: 100% (7644/7644), 9.55 MiB | 8.07 MiB/s, done.
Resolving deltas: 100% (4297/4297), done.

$ cd snmp_exporter/generator/
$ make docker-generate
docker build --build-arg REPO_TAG="main" -t "prom/snmp-generator:main" .
(...)
>> Downloading apc-powernet-mib
# Workaround to make DisplayString available (#867)
>> Downloading Cisco AIRESPACE-REF-MIB
>> Downloading Cisco AIRESPACE-WIRELESS-MIB
>> Downloading ARISTA-ENTITY-SENSOR-MIB
(...)
docker run -ti -v "/home/hromic/temp/snmp_exporter/generator:/opt/" "prom/snmp-generator:main" generate
ts=2023-11-21T10:57:58.161Z caller=net_snmp.go:175 level=info msg="Loading MIBs" from=mibs
ts=2023-11-21T10:57:58.343Z caller=main.go:53 level=info msg="Generating config for module" module=ubiquiti_airmax
ts=2023-11-21T10:57:58.359Z caller=main.go:68 level=info msg="Generated metrics" module=ubiquiti_airmax metrics=79
ts=2023-11-21T10:57:58.359Z caller=main.go:53 level=info msg="Generating config for module" module=keepalived
ts=2023-11-21T10:57:58.400Z caller=main.go:68 level=info msg="Generated metrics" module=keepalived metrics=187
(...)
ts=2023-11-21T10:58:14.737Z caller=main.go:93 level=info msg="Config written" file=/opt/snmp.yml

@JohnVillalovos
Copy link

Thanks. I will test this when I get back from vacation next week.

@jvillal-amp
Copy link
Contributor Author

I have tested it this morning.

I am getting the following error now:

ts=2023-11-27T15:48:48.150Z caller=net_snmp.go:175 level=info msg="Loading MIBs" from=mibs
ts=2023-11-27T15:48:48.150Z caller=main.go:134 level=error msg="Error generating config netsnmp" err="unable to determine absolute path for output"
make: *** [Makefile:92: docker-generate] Error 1

Not sure if I should open a new issue or not.

Current tip is:

commit d404ca54576558b2489504f50e309796f134d9d7 (HEAD -> refs/heads/main, refs/remotes/origin/main, refs/remotes/origin/HEAD)
Author: Nico <rey.nico@gmail.com>
Date:   Sat Nov 25 05:33:53 2023 -0300

    Add Netgear ReadyNAS and ReadyData appliances support (#1053)
<snip>

@jvillal-amp
Copy link
Contributor Author

Never mind. I forgot to modify the Makefile to allow selinux to work. Once I did that then everything is working.

Thanks for the help @hhromic !!

@jvillal-amp
Copy link
Contributor Author

@hhromic I created a PR to resolve my SELINUX issue. #1054

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants