【问题标题】:how to install latest version of prometheus/promtool in ubuntu?如何在 ubuntu 中安装最新版本的 prometheus/promtool?
【发布时间】:2019-07-16 01:55:24
【问题描述】:

我下载的prometheus版本是2.3.2

wget https://github.com/prometheus/prometheus/releases/download/v2.3.2/prometheus-2.3.2.linux-amd64.tar.gz

untared 和 prometheus 已作为服务运行。

我想使用 promtool 验证我的 Prometheus 警报管理器规则。 从下面的博客创建了一条规则。

https://petargitnik.github.io/blog/2018/01/04/how-to-write-rules-for-prometheus

当我运行 promtool 检查规则 /etc/prometheus/prometheus.rules.yml

它说,Promtheus 没有安装,所以再次安装使用 容易得到普罗米修斯

但这是安装的 promtool 的旧版本,这里是版本详细信息:

    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 版本 2 使用 yml 文件作为规则,旧版本使用不同的规则,所以我的 promtool 检查规则失败。

谁能建议如何升级最新的promtool?

谢谢。

【问题讨论】:

    标签: grafana prometheus rules prometheus-alertmanager


    【解决方案1】:

    您可以使用go 直接从 github 安装最新/所需的版本。确保你有 go 设置。为方便起见,还将 GOPATH 添加到您的 PATH 中,例如对于 ZSH:

    export PATH=$PATH:$GOPATH/bin
    

    然后您可以使用go get 安装它:

    GO111MODULE=on go get github.com/prometheus/prometheus/cmd/promtool
    

    现在你的 PATH 中有 GOPATH,你可以简单地从你的 shell 中调用它:

    ➜  ~ promtool --version
    promtool, version  (branch: , revision: )
     build user:
     build date:
     go version:       go1.12.7
    

    编辑:

    确保在go 命令前添加GO111MODULE=on the vendor directory has been removed

    【讨论】:

    • go get 与 https 方案不起作用。正确的是go get github.com/prometheus/prometheus/cmd/promtool
    猜你喜欢
    • 1970-01-01
    • 2013-10-07
    • 2016-05-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-04
    相关资源
    最近更新 更多