Flink支持多种metric报告方式,例如prometheus, influbDB, JMX等。本篇主要记录Prometheus+Pushgateway的方式监控Flink任务。
00x准备工作
1. 下载Prometheus、Pushgateway和AlertManager
这三个工具都是Prometheus生态组件,下载地址:
https://prometheus.io/download/
01x配置
1. 将下载的组件解压到任意目录,如
/app/prometheus
/app/pushgateway
/app/alertmanager
2. 配置prometheus
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
- localhost:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
- "rules/*.yml"