Installing snmp-exporter/ generator on RHEL 7

480 views
Skip to first unread message

Charan Tej

unread,
Aug 19, 2022, 12:22:26 PM8/19/22
to Prometheus Users
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,
/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 
chmod +x installer_linux 
source /root/.bash_profile
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:
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.

Ben Kochie

unread,
Aug 19, 2022, 12:25:56 PM8/19/22
to Charan Tej, Prometheus Users
This is likely because your Go compiler is too old.

Make sure you have the latest version of Go installed.


--
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 prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/5cde3582-6a2f-4ec5-b057-efdf1577e505n%40googlegroups.com.

Charan Tej

unread,
Aug 25, 2022, 5:19:45 PM8/25/22
to Ben Kochie, Prometheus Users
Ben,

Thank you, I was able to proceed after upgrading go version, but the latest errors are when I do "make build". Do you have any idea? the mibs directory was created but nothing inside.

#make mibs
mkdir: created directory ‘mibs’
>> Downloading apc-powernet-mib
make: *** [mibs/apc-powernet-mib] Error 22


Thank you,
Charan Jalakam


Charan Tej

unread,
Aug 26, 2022, 12:24:30 PM8/26/22
to Prometheus Users
I tried all the options on the web but had no luck.

Brian Candler

unread,
Aug 26, 2022, 4:06:47 PM8/26/22
to Prometheus Users
If you show what you actually did, and what error you got back, someone might be able to help.
Reply all
Reply to author
Forward
0 new messages