当前位置:网站首页>Prometheus监控之Consul监控 [consul-exporter]
Prometheus监控之Consul监控 [consul-exporter]
2022-06-22 15:12:00 【IChen.】
1. 简介
Consul有多个组件,但总体而言,它是基础架构中的一款服务发现和配置的工具。 它提供了几个关键功能:
服务发现:Consul client 可以提供服务,例如api或mysql,也可以使用Consul client来发现指定服务的提供者。 使用DNS或HTTP,应用程序可以轻松找到他们所依赖的服务。
健康检查:Consul client 可以提供任何数量的健康检查,或者与给定的服务(“Web服务器是否返回200 OK”),或与本地节点(“内存利用率是否低于90%”)相关联。 可以使用此信息来监控集群运行状况,服务发现组件使用此信息将流量从有问题的主机中移除出去。
KV Store:应用程序可以使用Consul的分层键/值存储,包括动态配置,功能标记,协调,leader选举等等。 简单的HTTP API使其易于使用。
多数据中心:Consul支持多个数据中心。 这意味着Consul的用户不必担心构建额外的抽象层以扩展到多个区域
2. 部署
docker run -tid --restart=always -p 9107:9107 --name consul-expoter prom/consul-exporter:latest --consul.server=172.19.209.51:8500
动日志如下:
level=info caller=consul_exporter.go:486 msg=“Starting consul_exporter” version=“(version=0.7.1, branch=HEAD, revision=ae46e2ea980ecf1c961bf332b71160be707b5e98)”
zevel=info caller=consul_exporter.go:487 build_context=“(go=go1.14.6, [email protected], date=20200721-15:34:41)”
level=info caller=consul_exporter.go:538 msg=“Listening on address” address=:9107
默认监听9107端口,访问http://localhost:9107即可看到:
3.Prometheus抓取metrics
- job_name: consul-exporter
static_configs:
- targets: ['172.19.209.51:9107']
4.导入Dashboard
推荐:Consul Exporter Dashboard
ID是12049。
显示服务总数,Consul Peer数量和Leader数量、不健康的Consul服务、Consul服务与服务检测信息。

5.配置告警规则
Consul是否Down
配置文件consul_exporter_alerting_rules.yml如下:
groups:
- name: consul
rules:
- alert: ConsulDown
annotations:
description: |-
Consul instance is down
VALUE = {
{
$value }}
LABELS: {
{
$labels }}
summary: Consul down (instance {
{
$labels.instance }})
expr: consul_up == 0
for: 5m
labels:
severity: critical
prometheus.yml配置如下:
rule_files:
- “consul_exporter_alerting_rules.yml”
停掉Consul,可以看到如下告警:

启动Consul,告警消失。

边栏推荐
- 首个赛博格人陨落背后:科技与渐冻症的极限赛跑
- How to open a futures account? Is it safe to open an online futures account?
- Make the text template in pycharm project support jinjia2 syntax
- 【山大会议】多人视频通话 WebRTC 工具类搭建
- 【山大会议】软件性能优化及bug修复
- [Shanda conference] establishment of webrtc tools for multi person video call
- SAP ABAP 数据字典教程 SE11:表、锁定对象、视图和结构 -03
- CMake教程系列-00-简介
- 【华为云至简致远】征文获奖名单出炉!
- 5. reading and writing of documents (students)
猜你喜欢

Adding an unknown type of MCU to jflash

84.(cesium篇)cesium模型在地形上运动

Focus on creating a net red product. The xinjietu x70s is newly launched, starting from 87900

学习量子纠缠的可解释表示,该深度生成模型可直接应用于其他物理系统

Ironsource Luna offers a limited time discount for Apple search ads and enjoys 3 months of free service upon registration

Runtime -- explore the nature of classes, objects, and classifications

SAP ABAP data types, operators and editors-02

SAP web service cannot log in to SOA management page with soamanager

Linux安装mysql

IO模型的5中模式
随机推荐
IO模型的5中模式
过气剧本杀,被露营“复活”
首个赛博格人陨落背后:科技与渐冻症的极限赛跑
二叉树练习第二弹
Odoo local document function development record
【山大会议】项目引入 Redux
【山大会议】WebRTC基础之对等体连接
安全信得过!天翼云数据安全管理平台通过评测
[Shanda conference] application setting module
学习量子纠缠的可解释表示,该深度生成模型可直接应用于其他物理系统
执行逻辑大同小异的实现类使用模板模式
【小程序项目开发-- 京东商城】uni-app开发之轮播图
Simulation of stack and queue
2.接口(计算器)
Wechat applet avatar pendant production
用递归法求Fibonacci数列第n项的值
Basic knowledge of audio and video | analysis of ANS noise suppression principle
数值类型和字符串之间的转换
SAP ABAP 表控制与示例-07
nio服务多线程版本