Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to install latest version of prometheus/promtool in ubuntu?

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:       [email protected]
  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.

like image 550
anand babu Avatar asked Feb 22 '19 02:02

anand babu


People also ask

How do I access Prometheus on Ubuntu?

Access the Prometheus Web Interface Replace the term “ip-address” with the actual IP address of your system. You can access the Prometheus web interface from any system within your local network. You can also use localhost or 127.0. 0.1 to access the Prometheus site on your local system.


1 Answers

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:

GO111MODULE=on go get github.com/prometheus/prometheus/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

EDIT:

Make sure you prepend GO111MODULE=on to the go command as the vendor directory has been removed

like image 160
user3681304 Avatar answered Oct 19 '22 00:10

user3681304