问题
I downloaded my prometheus version is 2.3.2
wget https://github.com/prometheus/prometheus/releases/download/v2.3.2/prometheus-2.3.2.linux-amd64.tar.gz
untared and prometheus already running as service.
I want to verify my Prometheus alert manager rule using promtool. created one rule from below blog.
https://petargitnik.github.io/blog/2018/01/04/how-to-write-rules-for-prometheus
when I run the promtool check rules /etc/prometheus/prometheus.rules.yml
it says, Promtheus not installed, so installed again using apt get prometheus
but this is installed older verion of promtool, here is version details:
root@UTVA-kafka-msg-size-2mb-02509:/home/ubuntu# promtool version
prometheus, version 0.16.2+ds (branch: debian/sid, revision: 0.16.2+ds-1ubuntu1)
build user: pkg-go-maintainers@lists.alioth.debian.org
build date: 20160408-04:15:29
go version: go1.6
Prometheus version 2 using yml file for rules, older usign some different one, so my promtool check-rules is failing.
Can anyone suggest how to upgrade latest promtool?
Thanks.
回答1:
You can use go
to install the latest/desired version directly from github. Make sure you have go setup. For convenience also add GOPATH to your PATH, e.g. for ZSH:
export PATH=$PATH:$GOPATH/bin
And then you can install it using go get
:
go get https://github.com/prometheus/prometheus/tree/master/cmd/promtool
Now that you have GOPATH in your PATH you can simply call it from your shell:
➜ ~ promtool --version
promtool, version (branch: , revision: )
build user:
build date:
go version: go1.12.7
来源:https://stackoverflow.com/questions/54819160/how-to-install-latest-version-of-prometheus-promtool-in-ubuntu