云原生之深入解析Prometheus Pushgetway的原理分析和实战操作

发布于:2023-09-22 ⋅ 阅读:(128) ⋅ 点赞:(0)

一、Pushgetway 简介

  • Pushgateway 是 Prometheus 的一个组件,Prometheus server 默认是通过 Exporter 主动获取数据(默认采取 pull 拉取数据),Pushgateway 则是通过 exporter 主动方式推送数据到 Pushgateway,再由 Prometheus 主动去拉取 Pushgateway 数据,用户可以写一些自定义的监控脚本把需要监控的数据发送给 Pushgateway。从 Prometheus server 角度看,都是由 Prometheus server 主动去拉取各个数据源(如 Exporter 和 Pushgateway)的数据。
  • Pushgateway 的优点:
    • Prometheus 默认采用定时 pull 模式拉取 targets 数据,但是如果不在一个子网或者防火墙,Prometheus 就拉取不到 targets 数据,因此可以采用各个 target 往 pushgateway 上 push 数据,然后 Prometheus 去 Pushgateway 上定时 pull 数据;
    • 在监控业务数据的时候,需要将不同数据汇总,汇总之后的数据可以由 Pushgateway 统一收集,然后由 Prometheus 统一拉取,起到给 Prometheus 减压的作用;
    • 自定义采集指标简单。
  • Pushgateway 的缺点:
    • Prometheus 拉取状态只针对 Pushgateway,不能对每个节点都有效;
    <

微信公众号

今日签到

点亮在社区的每一天
去签到