本文说明:go build 编译 prometheus、promtool
#环境:go1.11及以上版本
#下载最新源码:[https://github.com/prometheus/prometheus](https://github.com/prometheus/prometheus)
cd ${yourPath}/prometheus
rm -rf vendor
#编译得到 prometheus
go build ./cmd/prometheus
#编译得到 promtool
go build ./cmd/promtool
#done
touch ./conf/prometheus.yml
./prometheus --config.file="./conf/prometheus.yml"
Mark:
- 若直接在 ${yourPath}/prometheus 下执行 go build,报错:
can't load package: package github.com/prometheus/prometheus: unknown import path "github.com/prometheus/prometheus": cannot find module providing package github.com/prometheus/prometheus
main 不在这里( ̄ε(# ̄)☆╰╮( ̄▽ ̄///)
- 可访问 google.golang.org,或者可用的配置 GOPROXY.
有疑问加站长微信联系(非本文作者)