Build snmp generator on Centos 7.

454 views
Skip to first unread message

Ollie

unread,
Oct 5, 2018, 4:00:21 AM10/5/18
to Prometheus Users
Hey - this is my first dabble into Grafana + Prometheus + snmp-exporter, from what I can see this is a pretty awesome stack and I am really looking forward to seeing what I can do with it. I have Grafana + Prometheus + snmp-exporter installed and running using systemd - which in itself is pretty cool.

My aim is to monitor a bunch of Mellanox + Brocade + Arista switches.

I havent quite wrapped my head around the 'generator' - but at this time I am just trying to build it.

There is this, from here

sudo apt-get install build-essential libsnmp-dev # Debian-based distros
go
get github.com/prometheus/snmp_exporter/generator
cd $
{GOPATH-$HOME/go}/src/github.com/prometheus/snmp_exporter/generator
go build
make mibs

My question is in regard to build-essential + libsnmp-dev. What are the equivalent packages to install via yum on Centos 7?

Or more thoroughly how do I build the generator on Centos 7?

Thanks for any guidance you can provide !
Cheers.

Ollie

Ben Kochie

unread,
Oct 5, 2018, 4:29:38 AM10/5/18
to ot...@otimm.net, Prometheus Users
We're just in the process of adding those instructions to the docs.


--
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 post to this group, send email to promethe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/fbe01faf-c60a-4e21-be1a-3a89099ba3bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ollie

unread,
Oct 5, 2018, 5:41:29 AM10/5/18
to Prometheus Users
Thanks very much Ben!
Message has been deleted

Ollie

unread,
Oct 8, 2018, 11:22:46 PM10/8/18
to Prometheus Users
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!

Ben Kochie

unread,
Oct 9, 2018, 4:12:20 AM10/9/18
to ot...@otimm.net, Prometheus Users
You're right, that should be gcc-c++. Want to send a PR to fix it?

--
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 post to this group, send email to promethe...@googlegroups.com.

Charan Tej

unread,
Aug 19, 2022, 12:22:19 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.

Brian Candler

unread,
Aug 19, 2022, 4:54:27 PM8/19/22
to Prometheus Users
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
The thread you are replying to here is about building snmp generator, which is a different issue.
Reply all
Reply to author
Forward
0 new messages