美文网首页
玩转 Pushgateway

玩转 Pushgateway

作者: 埃尔温薛定谔不养猫 | 来源:发表于2019-08-27 18:08 被阅读0次

    什么是 Pushgateway

            它的存在允许短暂和批量作业将其指标暴露给 Prometheus。由于这些工作的生命周期可能不足够长,不能够存在足够的时间以让 Prometheus 抓取它们的指标。Pushgateway 允许它们可以将其指标推送到 Pushgateway,然后 Pushgateway 再将这些指标暴露给 Prometheus 抓取。

    环境准备:

    macOS 10.14.5
    Docker 18.09.2

    安装:

    docker pull prom/pushgateway
    

    启动:

    docker run -d -p 9091:9091 prom/pushgateway
    

    使用:

    • 将 Pushgateway 设置为 Prometheus 要抓取的对象
      Prometheus 将 Pushgateway 设置为抓取对象(可以在/targets页面查看是否设置成功)。必须在scrape配置将honor_labels设为true

    Prometheus 客户端库具有将已注册的指标推送到 Pushgateway 的功能。一般来说,Prometheus 客户端暴露指标来让 Prometheus 服务端来抓取。客户端库应支持推送功能,提供客户端代码来调用。

    命令行

    使用 Peometheus 文本协议,不需要提供单独的CLI,因此推送指标就变得非常简单。只需要使用像 curl 这样的命令行工具。

    相关文章

      网友评论

          本文标题:玩转 Pushgateway

          本文链接:https://www.haomeiwen.com/subject/qpoeectx.html