prometheus + pushgateway + grafana 监控 Flink

日萌社

人工智能AI:Keras PyTorch MXNet TensorFlow PaddlePaddle 深度学习实战(不定时更新)


配置 prometheus、pushgateway 监控 Flink metrics指标

prometheus + pushgateway + grafana 监控 Flink

prometheus + pushgateway + grafana 监控 Flink on Yarn


1.grafana下载
	https://grafana.com/grafana/download
	https://dl.grafana.com/oss/release/grafana-7.1.0.linux-amd64.tar.gz

2.安装 grafana
	tar zxvf grafana-7.1.0.linux-amd64.tar.gz
	mv grafana-7.1.0 grafana
	cd /root/grafana

3.启动 grafana
	cd /root/grafana/bin
	./grafana-server &(用了&之后即启动了之后再按一次回车就可以退出打印台)
	ps aux|grep grafana-server

4.登录 grafana
	http://node1:3000 使用默认用户名密码(admin/admin)


prometheus + pushgateway

当prometheus的server与target不在同一网段网络不通,无法直接拉取target数据,需要使用pushgateway作为数据中转点。
flink metric数据流转的流程是 flink metric -> pushgateway -> prometheus。
pushgateway 和 prometheus 都装到同一台机器node1节点上。
Prometheus+PushGateway安装配置
	为什么还要使用PushGateway呢?从上面的图可以发现,Prometheus在正常情况下是采用拉模式从产生metric的作业或者exporter(比如专门监控主机的NodeExporter)拉取监控数据。
	但是我们要监控的是Flink on YARN作业,想要让Prometheus自动发现作业的提交、结束以及自动拉取数据显然是比较困难的。
	PushGateway就是一个中转组件,通过配置Flink on YARN作业将metric推到PushGateway,Prometheus再从PushGateway拉取就可以了。

1.prometheus 和 pushgateway 都是同一个网站下载:https://prometheus.io/download/

2.把 /root/flink/opt (Flink目录下的opt)下的 flink-metrics-prometheus-1.10.1.jar 拷贝一份到 /root/flink/lib(Flink目录下的lib)
	cp /root/flink/opt/flink-metrics-prometheus-1.10.1.jar /root/flink/lib

3.配置 /root/flink/conf/flink-conf.yaml
	官网解释:https://ci.apache.org/projects/flink/flink-docs-release-1.11/zh/monitoring/metrics.html
	flink会把一些metric push到pushgateway的9091端口上,然后prometheus采集。

	vim /root/flink/conf/flink-conf.yaml
		metrics.reporter.promgateway.class: org.apache.flink.metrics.prometheus.PrometheusPushGatewayReporter
		metrics.reporter.promgateway.host: node1
		metrics.reporter.promgateway.port: 9091
		metrics.reporter.promgateway.jobName: myJob
		metrics.reporter.promgateway.randomJobNameSuffix: true
		metrics.reporter.promgateway.deleteOnShutdown: false
		metrics.reporter.promgateway.groupingKey: k1=v1;k2=v2
		metrics.reporter.promgateway.interval: 1 SECONDS

4.配置 prometheus
	tar zxvf prometheus-2.20.0-rc.0.linux-amd64.tar.gz
	mv prometheus-2.20.0-rc.0.linux-amd64 prometheus
	vim /root/prometheus/prometheus.yml

scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'
    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.
    static_configs:
    - targets: ['node1:9090']
  
  - job_name: 'pushgateway'
    scrape_interval: 1s
    static_configs:
    - targets: ['node1:9091']
      labels:
        instance: 'pushgateway'

5.安装 pushgateway
	tar zxvf pushgateway-1.2.0.linux-amd64.tar.gz	
	mv pushgateway-1.2.0.linux-amd64 pushgateway

6.启动 flink集群
	cd /root/flink/bin
	./start-cluster.sh
	./stop-cluster.sh
	http://node1:8081 打开UI界面

7.启动 pushgateway
	cd /root/pushgateway
	./pushgateway &(用了&之后即启动了之后再按一次回车就可以退出打印台)
	http://node1:9091 打开UI界面
	ps aux|grep pushgateway 

8.启动 prometheus 
	cd /root/prometheus
	./prometheus --config.file=prometheus.yml &(用了&之后即启动了之后再按一次回车就可以退出打印台)
	http://node1:9090 打开UI界面
	ps aux|grep prometheus 

 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
一、prometheus简介 Prometheus是一个开源的系统监控和告警系统,现在已经加入到CNCF基金会,成为继k8s之后第二个在CNCF维护管理的项目,在kubernetes容器管理系统中,通常会搭配prometheus进行监控prometheus支持多种exporter采集数据,还支持通过pushgateway进行数据上报,Prometheus再性能上可支撑上万台规模的集群。 二、prometheus架构图 三、prometheus组件介绍 1.Prometheus Server: 用于收集和存储时间序列数据。 2.Client Library: 客户端库,检测应用程序代码,当Prometheus抓取实例的HTTP端点时,客户端库会将所有跟踪的metrics指标的当前状态发送到prometheus server端。 3.Exporters: prometheus支持多种exporter,通过exporter可以采集metrics数据,然后发送到prometheus server端 4.Alertmanager: 从 Prometheus server 端接收到 alerts 后,会进行去重,分组,并路由到相应的接收方,发出报警,常见的接收方式有:电子邮件,微信,钉钉, slack等。 5.Grafana监控仪表盘 6.pushgateway: 各个目标主机可上报数据到pushgatewy,然后prometheus server统一从pushgateway拉取数据。 四、课程亮点 五、效果图展示 六、讲师简介 先超(lucky):高级运维工程师、资深DevOps工程师,在互联网上市公司拥有多年一线运维经验,主导过亿级pv项目的架构设计和运维工作 主要研究方向: 1.云计算方向:容器 (kubernetes、docker),虚拟化(kvm、Vmware vSphere),微服务(istio),PaaS(openshift),IaaS(openstack)等2.系统/运维方向:linux系统下的常用组件(nginx,tomcat,elasticsearch,zookeeper,kafka等),DevOps(Jenkins+gitlab+sonarqube+nexus+k8s),CI/CD,监控(zabbix、prometheus、falcon)等 七、课程大纲

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

あずにゃん

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值