Prometheus+Grafana监控flink任务指标
前期准备
Prometheus 是一款基于时序数据库的开源监控告警系统,由go语言开发,Prometheus的基本原理是通过HTTP协议周期性抓取被监控组件的状态,任意组件只要提供对应的HTTP接口就可以接入监控。
Grafana 是一款采用Go语言编写的开源应用,前端由React框架开发,是一个跨平台的开源的度量分析和可视化工具,可以通过将采集的数据查询然后可视化的展示,并及时通知。
Pushgateway 是 Prometheus 生态系统中的一个组件,它的设计目的是允许任务将指标数据推送到 Pushgateway,然后由 Prometheus 从 Pushgateway 中拉取这些数据。
这里对 Pushgateway 的安装作简要介绍:
Pushgateway 安装
下载安装包
下载 pushgateway,下载地址如下:
https://github.com/prometheus/pushgateway/releases
解压安装
解压文件
tar -zxvf pushgateway-1.10.0.linux-amd64.tar.gz -C /opt/
mv pushgateway-1.10.0.linux-amd64/ pushgateway
启动pushgateway
nohup ./pushgateway > pushgateway_run.log 2>&1 &
ss -lntp | grep <pid> # 默认端口9091
LISTEN 0 32768 [::]:9091 [::]:* users:(("pushgateway",pid=27981,fd=3))
常用启动选项,Pushgateway 支持多种启动选项,可以通过命令行参数来配置它的行为。以下是一些常用的选项:
-
--web.listen-address
: 指定 Pushgateway 监听的地址和端口。默认是:9091
。./pushgateway --web.listen-address=":9091"
-
--web.telemetry-path
: 指定 Prometheus 抓取指标的路径。默认是/metrics
。./pushgateway --web.telemetry-path="/metrics"