48 lines
1.2 KiB
Markdown
48 lines
1.2 KiB
Markdown
---
|
||
title: "Blackbox_exporter"
|
||
type: concept
|
||
tags: [exporter, prometheus, blackbox, monitoring]
|
||
sources: [家庭监控方案-prometheus-grafana-node-exporter-cadvisor-blackbox]
|
||
last_updated: 2026-04-16
|
||
---
|
||
|
||
## Definition
|
||
Blackbox_exporter 是 Prometheus 官方提供的黑盒探测 exporter,通过 HTTP、HTTPS、TCP、ICMP、DNS 等协议探测目标可用性和性能。
|
||
|
||
## Supported Modules
|
||
- **HTTP/HTTPS**:探测状态码、响应时间、TLS 证书
|
||
- **TCP**:端口连通性
|
||
- **ICMP**:主机可达性(ping)
|
||
- **DNS**:域名解析
|
||
|
||
## Use Cases
|
||
- 网站可用性监控
|
||
- TLS 证书到期告警
|
||
- DNS 解析监控
|
||
- 内网服务健康检查
|
||
|
||
## Key Metrics
|
||
- `probe_success`:探测是否成功(0/1)
|
||
- `probe_duration_seconds`:探测耗时
|
||
- `probe_http_status_code`:HTTP 状态码
|
||
- `probe_ssl_earliest_cert_expiry`:SSL 证书到期时间
|
||
|
||
## Common Alert Rules
|
||
- HTTP 探测失败(连续 3 次)
|
||
- TLS 证书剩余 < 14 天
|
||
- 响应时间 > 阈值
|
||
|
||
## Docker 部署
|
||
```yaml
|
||
blackbox:
|
||
image: prom/blackbox-exporter:latest
|
||
ports:
|
||
- "9115:9115"
|
||
```
|
||
|
||
## Default Port
|
||
- 9115
|
||
|
||
## Connections
|
||
- [[Blackbox_exporter]] ← scrapes_by ← [[Prometheus]]
|
||
- [[Blackbox_exporter]] ← blackbox_monitoring ← [[Uptime Kuma]](可选集成) |