What does "go version" show? I am guessing you have a very old version if that "go install" command doesn't work.
However, there's no need at all for you to build snmp_exporter from source. Just download the pre-built binary package from https://github.com/prometheus/snmp_exporter/releases Probably the right one for you is https://github.com/prometheus/snmp_exporter/releases/download/v0.20.0/snmp_exporter-0.20.0.linux-amd64.tar.gz The thread you are replying to here is about building snmp generator, which is a different issue. On Friday, 19 August 2022 at 17:22:19 UTC+1 [email protected] wrote: > Hello All, > > I am trying to install snmp-exporter in RHEL 7 and following the commands > from the Github repo. > > sudo yum install gcc gcc-c++ make net-snmp net-snmp-utils net-snmp-libs > net-snmp-devel --- done > go get github.com/prometheus/snmp_exporter/generator -- latest error is > below, > # github.com/gosnmp/gosnmp > /root/go/src/github.com/gosnmp/gosnmp/gosnmp.go:351:72: unknown field > 'Control' in struct literal of type net.Dialer > /root/go/src/github.com/gosnmp/gosnmp/v3_usm.go:159:9: undefined: > strings.Builder > > Initial error (package gopkg.in/yaml.v2: unrecognized import path " > gopkg.in/yaml.v2" (parse) , I thought "go get" was deprecated and as a > workaround I tried > wget https://storage.googleapis.com/golang/getgo/installer_linux > chmod +x installer_linux > source /root/.bash_profile > go install github.com/prometheus/snmp_exporter@latest -- > can't load package: package github.com/prometheus/snmp_exporter@latest: > cannot find package "github.com/prometheus/snmp_exporter@latest" in any > of: > /usr/lib/golang/src/github.com/prometheus/snmp_exporter@latest (from > $GOROOT) > /root/go/src/github.com/prometheus/snmp_exporter@latest (from $GOPATH) > > Next steps: > cd ${GOPATH-$HOME/go}/src/github.com/prometheus/snmp_exporter/generator > go build > make mibs > > I spent almost a week trying to figure out how to get this working, if > someone could help me with all the steps for installing snmp-exporter for > Prometheus in RHEL 7, I would greatly appreciate it. > > On Tuesday, October 9, 2018 at 3:12:20 AM UTC-5 [email protected] wrote: > >> You're right, that should be gcc-c++. Want to send a PR to fix it? >> >> On Tue, Oct 9, 2018 at 5:22 AM Ollie <[email protected]> wrote: >> >>> I'm getting this error when I try to install the following: >>> >>> sudo yum install gcc gcc-g++ make net-snmp net-snmp-utils net-snmp-libs >>> # RHEL-based distros >>> >>> *No package gcc-g++ available.* >>> >>> Would someone more educated, than me, point me in the right direction? >>> Is it a dev-repo or something I need to add? >>> thank you! >>> >>> -- >>> >> You received this message because you are subscribed to the Google Groups >>> "Prometheus Users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To post to this group, send email to [email protected]. >>> >> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/prometheus-users/4fa8ca46-bf91-4ca6-91a7-1daa8f484fd3%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/prometheus-users/4fa8ca46-bf91-4ca6-91a7-1daa8f484fd3%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >> >> >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/853a56d2-75fa-4254-bb3c-12330e758c3fn%40googlegroups.com.

