prometheus监控cisco交换机的问题1

prometheus监控cisco交换机的问题1
参照 https://www.cnblogs.com/dgp-zjz/p/16199804.html
配置prometheus监控思科的3750G交换机
做 到
5、获取snmp-exporter源码包,包括generator源码包。
go get github.com/prometheus/snmp_exporter/generator
的时候报错了

img


generator 根本没下载下来,求指导,谢谢!

pleae use go1.17,because the project use go1.17

yum install gcc gcc-g++ make net-snmp net-snmp-utils net-snmp-libs net-snmp-devel
go env -w GOPROXY=https://goproxy.cn,direct
go install github.com/prometheus/snmp_exporter/generator@latest
cd ${GOPATH}/pkg/mod/github.com/prometheus/snmp_exporter@v0.20.0/generator

嗯,执行go get github.com/prometheus/snmp_exporter/generator报错
go get: installing executables with ‘go get‘ in module mode is deprecated
原因解析:
Go1.17版使用go install安装依赖
go get 用于下载并安装 Go 包、命令等,而 go install 在 module 时代几乎很少使用,在 GOPATH 年代,go install 用来编译安装本地项目。
自 1.16 起,官方说,不应该 go get 下载安装命令(即可执行程序),不过只是这么说,却依然可以使用。
但 Go1.17 开始,如果使用 go get 安装命令会告警。
解决方案:安装远程依赖命令

 # Go1.16及以前
    go get -u -v github.com/github/hub

    # Go1.17版本
    go install github.com/bingoohuang/hub@latest


参考相似案例链接,希望对你有所帮助:https://blog.csdn.net/weixin_42586723/article/details/121058242