prometheus / snmp_exporter

SNMP Exporter for Prometheus
Apache License 2.0
1.69k stars 625 forks source link

SNMP Generator - make build error #580

Closed Biomains closed 3 years ago

Biomains commented 3 years ago

Trying to follow the instructions, but get an error:

[root@server-p1 generator]# pwd /root/go/src/github.com/prometheus/snmp_exporter/generator [root@server-p1 generator]# go build go: github.com/go-kit/kit@v0.10.0 requires github.com/casbin/casbin/v2@v2.1.2 requires github.com/Knetic/govaluate@v3.0.1-0.20171022003610-9aa49832a739+incompatible: invalid pseudo-version: git fetch --unshallow -f origin in /root/go/pkg/mod/cache/vcs/dac3237ce23c7a321475df4e3bb8c7115ea5c093fdf9bc1798a57a9ef75ede77: exit status 128: fatal: git fetch-pack: expected shallow list

Installed: golang.x86_64 0:1.15.2-1.el7

Dependency Installed: apr.x86_64 0:1.4.8-7.el7 apr-util.x86_64 0:1.5.2-6.el7 git.x86_64 0:1.8.3.1-23.el7_8 gnutls.x86_64 0:3.3.29-9.el7_6 golang-bin.x86_64 0:1.15.2-1.el7 golang-src.noarch 0:1.15.2-1.el7 libmodman.x86_64 0:2.0.1-8.el7
libproxy.x86_64 0:0.4.11-11.el7 mercurial.x86_64 0:2.6.2-11.el7 neon.x86_64 0:0.30.0-4.el7 nettle.x86_64 0:2.7.1-8.el7 pakchois.x86_64 0:0.4-10.el7 perl-Error.noarch 1:0.17020-2.el7 perl-Git.noarch 0:1.8.3.1-23.el7_8 perl-TermReadKey.x86_64 0:2.30-20.el7 rsync.x86_64 0:3.1.2-10.el7 subversion.x86_64 0:1.7.14-16.el7 subversion-libs.x86_64 0:1.7.14-16.el7 trousers.x86_64 0:0.3.14-2.el7

brian-brazil commented 3 years ago

That works fine for me in a fresh directory, this sounds like a problem on your end.

Biomains commented 3 years ago

I still get an error on RHEL machine when trying to "go build", on a new server as well.

[root@server-t1 generator]# go build go: github.com/go-kit/kit@v0.10.0 requires github.com/casbin/casbin/v2@v2.1.2 requires github.com/Knetic/govaluate@v3.0.1-0.20171022003610-9aa49832a739+incompatible: invalid pseudo-version: git fetch --unshallow -f origin in /root/go/pkg/mod/cache/vcs/dac3237ce23c7a321475df4e3bb8c7115ea5c093fdf9bc1798a57a9ef75ede77: exit status 128: fatal: git fetch-pack: expected shallow list

I see similar error on node_exporter on CentOS: https://github.com/prometheus/node_exporter/issues/1863

alpha01 commented 3 years ago

I ran into the same error on CentOS 7 with golang-1.15.2-1.el7.x86_64 (from epel repo)

I was able to successfully build the generator when switching to the v0.19.0 tag. So I suspect this was recently introduced on master. Unfortionately, my golang skills are somewhat limited. Here is a diff between both Makefiles:

tony@alpha03-2 ~/diff $ diff snmp_exporter/generator/Makefile snmp_exporter-0.19.0/generator/Makefile
36d35
< SERVERTECH4_URL   := 'https://cdn10.servertech.com/assets/documents/documents/815/original/Sentry4.mib'
43d41
< LIEBERT_URL       := https://www.vertiv.com/492204/contentassets/b00273585e0a453a9c983523e8a0d6ff/lgpmib-unix_rev16.tar
98d95
<   $(MIBDIR)/servertech-sentry4-mib \
104,105c101
<   $(MIBDIR)/IPD-MIB_Q419V9.mib \
<   $(MIBDIR)/LIEBERT_GP_PDU.MIB
---
>   $(MIBDIR)/IPD-MIB_Q419V9.mib
206,209d201
< $(MIBDIR)/servertech-sentry4-mib:
<   @echo ">> Downloading servertech-sentry4-mib"
<   @curl $(CURL_OPTS) -o $(MIBDIR)/servertech-sentry4-mib $(SERVERTECH4_URL)
<
243,249d234
<
< $(MIBDIR)/LIEBERT_GP_PDU.MIB:
<   $(eval TMP := $(shell mktemp))
<   @echo ">> Downloading LIEBERT_GP_PDU.MIB to $(TMP)"
<   @curl $(CURL_OPTS) -o $(TMP) $(LIEBERT_URL)
<   @tar --no-same-owner -C $(MIBDIR) -xvf $(TMP)
<   @rm -v $(TMP)
brian-brazil commented 3 years ago

go doesn't use make, so I'd suspect it's an issue with either the git or go you're using.

remijouannet commented 3 years ago

hi, didn't dig that much on why git version trigger this issue, but updating to git 2.24 fix this error (on centos 7)

rverdugo01 commented 3 years ago

Trying to follow the instructions, but get an error:

[root@server-p1 generator]# pwd /root/go/src/github.com/prometheus/snmp_exporter/generator [root@server-p1 generator]# go build go: github.com/go-kit/kit@v0.10.0 requires github.com/casbin/casbin/v2@v2.1.2 requires github.com/Knetic/govaluate@v3.0.1-0.20171022003610-9aa49832a739+incompatible: invalid pseudo-version: git fetch --unshallow -f origin in /root/go/pkg/mod/cache/vcs/dac3237ce23c7a321475df4e3bb8c7115ea5c093fdf9bc1798a57a9ef75ede77: exit status 128: fatal: git fetch-pack: expected shallow list

Installed: golang.x86_64 0:1.15.2-1.el7

Dependency Installed: apr.x86_64 0:1.4.8-7.el7 apr-util.x86_64 0:1.5.2-6.el7 git.x86_64 0:1.8.3.1-23.el7_8 gnutls.x86_64 0:3.3.29-9.el7_6 golang-bin.x86_64 0:1.15.2-1.el7 golang-src.noarch 0:1.15.2-1.el7 libmodman.x86_64 0:2.0.1-8.el7 libproxy.x86_64 0:0.4.11-11.el7 mercurial.x86_64 0:2.6.2-11.el7 neon.x86_64 0:0.30.0-4.el7 nettle.x86_64 0:2.7.1-8.el7 pakchois.x86_64 0:0.4-10.el7 perl-Error.noarch 1:0.17020-2.el7 perl-Git.noarch 0:1.8.3.1-23.el7_8 perl-TermReadKey.x86_64 0:2.30-20.el7 rsync.x86_64 0:3.1.2-10.el7 subversion.x86_64 0:1.7.14-16.el7 subversion-libs.x86_64 0:1.7.14-16.el7 trousers.x86_64 0:0.3.14-2.el7

go 1.16.2 in centos 7.9 fix it problem. Now "go build " to finished not problem.

RichiH commented 3 years ago

Thank you @remijouannet & @rverdugo01; closing the issue.

bhushan-j commented 2 years ago

upgrading to git version 2.34.1 resolved the issue.