惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog
Hugging Face - Blog
Hugging Face - Blog
月光博客
月光博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
人人都是产品经理
人人都是产品经理
博客园 - Franky
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Proofpoint News Feed
F
Fortinet All Blogs
H
Help Net Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Visual Studio Blog
Jina AI
Jina AI
J
Java Code Geeks
Blog — PlanetScale
Blog — PlanetScale
S
SegmentFault 最新的问题
D
DataBreaches.Net
T
The Blog of Author Tim Ferriss
美团技术团队
博客园 - 司徒正美
宝玉的分享
宝玉的分享
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Apple Machine Learning Research
Apple Machine Learning Research

陈少文的网站

巨变与机遇的未来十年 Kubernetes 平台管理软件压力测试方案 使用镜像部署 Hexo 静态页面 终于等到你 - GitHub 镜像仓库服务(ghcr.io) 一起来学 Go --(6)Interface 一起来学 Go --(5)Goroutine 和 Channel 什么是函数式编程 如何在 Kubernetes 集群集成 Kata 柯里化与偏函数 使用 PyGithub 自动创建 Label 软件产品是团队能力的输出 Helm 2 、Helm 3 比较 IoT 变现 Kubernetes 中的 DNS 服务 国内的 Helm 镜像源 Harbor 使用自签证书支持 Https 访问 DevOps 工具链之 Prow 如何使用 kfctl 安装 Kubeflow VS Code 无法下载 Go 插件的工具包 工程师更应具有服务精神 你不知道的 Docker 使用技巧 使用 Docker 运行 Tensorflow 论中国 什么是左移 如何清空 Git 仓库全部历史记录 一禅小和尚 有风吹过厨房 时间的玫瑰 如何在 CentOS 安装 GPU 驱动 开发 Tips(19)
部署 smokeping-prober 探测网络质量
微信公众号 · 2025-05-11 · via 陈少文的网站

1. smokeping-prober 是什么

smokeping-prober 是一个用于探测网络质量的工具,它通过向目标节点发送 ICMP 请求来探测网络质量。

2. 部署 smokeping-prober

2.1 生成 smokeping-prober.yaml 配置文件

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
cat > smokeping_prober.yaml <<EOF
---
targets:
- hosts:
  - 1.2.3.4
  interval: 1s # Duration, Default 1s.
  network: ip # One of ip, ip4, ip6. Default: ip (automatic IPv4/IPv6)
  protocol: icmp # One of icmp, udp. Default: icmp (Requires privileged operation)
  size: 56 # Packet data size in bytes. Default 56 (Range: 24 - 65535)
  tos: 0x00 # Packet ToS field in decimal, hexadecimal or binary format. Default: 0 (Range: 0-255)
EOF

2.2 启动 smokeping-prober

  • 启动
1
2
3
4
5
6
7
8
nerdctl run -d \
  --name smokeping_prober \
  --restart always \
  -v `pwd`/smokeping_prober.yaml:/etc/smokeping_prober.yml \
  -p 9374:9374 \
  --privileged \
  quay.io/superq/smokeping-prober:v0.9.0 \
  --config.file=/etc/smokeping_prober.yml
  • 停止
1
nerdctl rm -f smokeping_prober
  • 查看日志
1
nerdctl logs smokeping_prober -f
  • 重启
1
nerdctl restart smokeping_prober

2.3 部署 smokeping-prober 的 Endpoints

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
kubectl apply -f - <<EOF
apiVersion: v1
kind: Service
metadata:
  name: smokeping-service
  namespace: default
  labels:
    app: smokeping
spec:
  ports:
  - name: metrics
    port: 9374
    protocol: TCP
---
apiVersion: v1
kind: Endpoints
metadata:
  name: smokeping-service
  namespace: default
subsets:
- addresses:
  - ip: 1.2.3.4
  ports:
  - name: metrics
    port: 9374
    protocol: TCP
EOF

2.4 部署 smokeping-prober 的 ServiceMonitor

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
kubectl apply -f - <<EOF
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: smokeping-monitor
  namespace: monitoring
  labels:
    tier: ai
spec:
  endpoints:
  - interval: 1s
    port: metrics
    path: /metrics
    scheme: http
    honorLabels: true
    relabelings:
    - action: replace
      sourceLabels: [__address__]
      targetLabel: node
      regex: (.*):.*
      replacement: $1
    - action: replace
      replacement: smokeping
      targetLabel: role
  selector:
    matchLabels:
      app: smokeping
  namespaceSelector:
    matchNames:
    - default
EOF

3. 查看 smokeping-prober 的指标

导入面板 https://grafana.com/grafana/dashboards/11335-smoke-ping/

可以查看网络质量的指标,如丢包率、延迟等。

可以看到类似这样的面板

面板中显示的指标时丢包数量,如果要查看丢包率,可以添加一个计算指标,计算公式为:

1
2
3
(rate(smokeping_requests_total{host="$target"}[30s]) - rate(smokeping_response_duration_seconds_count{host="$target"}[5m]))
/
rate(smokeping_requests_total{host="$target"}[30s]) / 100