prometheus 监控 服务是否可用 可用性监控 blackbox_exporte

blackbox_exporter是Prometheus 官方提供的 exporter 之一,可以提供 http、dns、tcp、icmp 的监控数据采集。

blackbox_exporter 应用场景

  1. ICMP 测试
    主机探活机制

  2. HTTP 测试
    定义 Request Header 信息
    判断 Http status / Http Respones Header / Http Body 内容

  3. TCP 测试
    业务组件端口状态监听
    应用层协议定义与监听

  4. POST 测试
    接口联通性

  5. SSL 证书过期时间

  6. 自定义测试(扩展)

下载

安装

不说了,安装请看另外一篇:prometheus 监控 主机存活 监控 blackbox_exporter

在Prometheus上添加blackbox_exporter的配置

  - job_name: 服务可用性监测
    metrics_path: /probe
    params:
      module: [http_2xx]
    file_sd_configs:
    - refresh_interval: 10s
      files:
      - "/data/prometheus-2.22.1.linux-amd64/conf.d/http_status.yml"
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - target_label: __address__
        replacement: 127.0.0.1:9115
      - source_labels: [__param_target]
        target_label: instance

添加配置文件 conf.d/http_status.yml

cat conf.d/http_status.yml 
- targets: ['http://192.168.80.176:8061/carsoa-assembly/actuator/info','http://192.168.80.176:8005/carsoa-auth/actuator/info','http://192.168.80.176:8066/carsoa-bpm/actuator/info']
  labels:
    group: 'bjj'

重新加载prometheus配置

测试配置是否正确

$./promtool check config prometheus.yml
Checking prometheus.yml
  SUCCESS: 0 rule files found

重新加载Prometheus配置

$ curl -X POST http://127.0.0.1:9090/-/reload (启用了--web.enable-lifecycle选项)

查看加入的监控信息

访问 http://127.0.0.1:9090/targets

在这里插入图片描述

Grafana中加入 blackbox_exporter监控数据

导入blackbox_exporter模板

此模板为9965号模板,数据源选择Prometheus 模板下载地址
https://grafana.com/grafana/dashboards/9965

注意

此模板需要安装饼状图插件 下载地址 https://grafana.com/grafana/plugins/grafana-piechart-panel
安装插件,重启grafana生效。

$ grafana-cli plugins install grafana-piechart-panel
$ service grafana-server restart

访问Grafana

在这里插入图片描述
CSDN_码404:prometheus 监控 服务是否可用 可用性监控 blackbox_exporte

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

leenhem

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

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

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

打赏作者

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

抵扣说明:

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

余额充值