最近项目在用Prometheus+Grafana搭建监控平台,主要用来监控hadoop生态,使用官方jmx_prometheus_javaagent发现很多参数获取不到,最后使用hadoop_exporter和zookeeper_exporter,zookeeper_exporter项目地址:https://github.com/carlpett/zookeeper_exporter,文件是x86的,在ARM下使用必须编译:
一、配置代理
#使用如下
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
二、升级go版本
升级go到1.13.1,先删除以前的旧版本目录
root@HDP-001:/home/gw/software/go# go version
go version go1.13.1 linux/arm64
三、开始编译
root@HDP-001:/home/gw/software# go get -u github.com/carlpett/zookeeper_exporter
package google.golang.org/protobuf/encoding/prototext: unrecognized import path "google.golang.org/protobuf/encoding/prototext" (https fetch: Get https://google.golang.org/protobuf/encoding/prototext?go-get=1: proxyconnect tcp: dial tcp: lookup socks on 172.16.50.2:53: server misbehaving)
解决:
mkdir -p $GOPATH/src/google.golang.org
git clone https://e.coding.net/robinqiwei/googleprotobuf.git $GOPATH/src/google.golang.org/protobuf
root@HDP-001:/home/gw/software# go get -u github.com/carlpett/zookeeper_exporter
package golang.org/x/sys/unix: unrecognized import path "golang.org/x/sys/unix" (https fetch: Get https://golang.org/x/sys/unix?go-get=1: proxyconnect tcp: dial tcp: lookup socks on 172.16.50.2:53: server misbehaving)
解决:
mkdir -p $GOPATH/src/golang.org/x
cd $GOPATH/src/golang.org/x
git clone https://github.com/golang/sys.git
git clone https://github.com/golang/sync.git
git clone https://github.com/golang/crypto.git
root@HDP-001:/home/gw/software# go get -u github.com/carlpett/zookeeper_exporter
下载完成之后二进制文件在$GOPATH/bin
//查看文件属性
root@HDP-001:/home/gw/software/go/path/bin# file zookeeper_exporter
zookeeper_exporter: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-, not stripped
可使用同样的方法编译clickhouse_exporter
go get -u github.com/Percona-Lab/clickhouse_exporter