当前位置:网站首页>使用 Blackbox Exporter 测试网络连通性
使用 Blackbox Exporter 测试网络连通性
2022-06-27 06:39:00 【陈少文的网站】
如果你需要监控两个主机、主机与外部服务之间的网络状况,那么就可以试一试本文提到的 Blackbox Exporter。
1. 安装 Blackbox
- 下载二进制包
| |
- 清理安装包
| |
- 新建 Systemd 服务
| |
新增如下内容:
[Unit]Description=blackbox_exporterAfter=network.target[Service]Restart=on-failureExecStart=/usr/bin/blackbox_exporter \ --config.file=/etc/prometheus/blackbox.ymlRestart=on-failure[Install]WantedBy=multi-user.target- 启动服务
| |
- 查看运行状态
| |
2. 测试主机对外访问连通性
blackbox_exporter 默认在本地 9115 端口暴露服务。
实际上,通过拼接 URL 的方式,我们就可以实现主机对任意服务的连通测试,下面是一个实例,只需要提供 target、module 参数即可,其中 target 表示测试的目标,module 表示测试用的模块:
浏览器访问 http://BLACKBOX_HOST_IP:9115/probe?target=google.com&module=http_2xx,需要将 BLACKBOX_HOST_IP 替换为主机 IP。
| |
在注释中,对这些指标有着很详尽的描述,DNS 延时、响应、协议等。
3. Prometheus 配置
接着,我们可以让 Prometheus 定时抓取 blackbox 的指标。下面是相关的配置文件,需要将 BLACKBOX_HOST_IP 替换为 blackbox_exporter 部署主机的 IP 地址。
| |
4. 配置 Grafana 面板
这里采用的是 https://grafana.com/grafana/dashboards/13587 面板。
稍微进行了调整,最终看起来如下图:

5. 可能遇到的问题
5.1 probe_http_status_code 状态码一直为 0
blackbox_exporter 默认使用的是 ipv6 栈,需要手动指定为 ipv4。
编辑配置文件 /etc/prometheus/blackbox.yml 指定 ipv4 栈。
| |
然后,重启服务:
| |
5.2 Grafana 找不到 grafana-piechart-panel
- 安装插件
| |
- 在配置文件中指定插件的路径
vim /usr/local/grafana/conf/defaults.ini[plugin.piechart]path = /var/lib/grafana/plugins/grafana-piechart-panel- 重启 Grafana
| |
边栏推荐
- Coggle 30 Days of ML 7月竞赛学习
- When there are multiple El select, the selected value is filtered by El select, and the last selected value is filtered by the second El select
- Get the query parameter in the address URL specify the parameter method
- Cloud-Native Database Systems at Alibaba: Opportunities and Challenges
- Visual studio vs shortcut key usage
- el-select多个时,el-select筛选选中过的值,第二个el-select中过滤上一个选中的值
- HTAP Quick Start Guide
- 面试官:你天天用 Lombok,说说它什么原理?我竟然答不上来…
- ORA-00909: 参数个数无效,concat引起
- pytorch Default process group is not initialized
猜你喜欢
随机推荐
Win10 remote connection to ECS
研究生数学建模竞赛-无人机在抢险救灾中的优化应用
面试官:你天天用 Lombok,说说它什么原理?我竟然答不上来…
SQL injection bypass (I)
On gpu: historical development and structure
Rust中的Pin详解
Coggle 30 Days of ML 7月竞赛学习
2018 mathematical modeling competition - special clothing design for high temperature operation
Winow10 installation nexus nexus-3.20.1-01
winow10安装Nexus nexus-3.20.1-01
poi导出excle
Spark sql 常用时间函数
[QT notes] simple understanding of QT meta object system
云服务器配置ftp、企业官网、数据库等方法
Interviewer: you use Lombok every day. What is its principle? I can't answer
2018年数学建模竞赛-高温作业专用服装设计
Talk about Domain Driven Design
Write an example of goroutine and practice Chan at the same time
HTAP 深入探索指南
小米面试官:听你说精通注册中心,我们来聊 3 天 3 夜









