表格布局替换为按分组展示的卡片式布局,新增 group 字段配置和 TargetBoard/TargetCard 等组件。模态框详情页支持时间范围筛选和分页,SummaryCards 减为 3 个。API 端点变更:trend/history 改用 from/to 参数,history 支持分页。recentSampleCount 硬编码为 30。
213 lines
4.3 KiB
YAML
213 lines
4.3 KiB
YAML
server:
|
|
host: "127.0.0.1"
|
|
port: 3000
|
|
dataDir: "/tmp/probes_data"
|
|
|
|
runtime:
|
|
maxConcurrentChecks: 20
|
|
|
|
defaults:
|
|
interval: "30s"
|
|
timeout: "10s"
|
|
http:
|
|
method: GET
|
|
maxBodyBytes: "10MB"
|
|
command:
|
|
maxOutputBytes: "1MB"
|
|
|
|
targets:
|
|
# ========== HTTP targets ==========
|
|
|
|
- name: "Baidu 首页可用"
|
|
type: http
|
|
group: "搜索引擎"
|
|
http:
|
|
url: "https://www.baidu.com"
|
|
expect:
|
|
status: [200]
|
|
maxDurationMs: 5000
|
|
|
|
- name: "JSON API — 完整流水线"
|
|
type: http
|
|
group: "后端服务"
|
|
interval: "1m"
|
|
timeout: "15s"
|
|
http:
|
|
url: "https://httpbin.org/json"
|
|
headers:
|
|
Accept: "application/json"
|
|
expect:
|
|
headers:
|
|
Content-Type:
|
|
contains: "application/json"
|
|
maxDurationMs: 8000
|
|
body:
|
|
- json:
|
|
path: "$.slideshow.title"
|
|
equals: "Sample Slide Show"
|
|
- json:
|
|
path: "$.slideshow.slides[0].title"
|
|
contains: "Wake"
|
|
- json:
|
|
path: "$.slideshow.slides[0].type"
|
|
equals: "all"
|
|
- regex: '"title"'
|
|
|
|
- name: "HTML 页面 — CSS 选择器"
|
|
type: http
|
|
http:
|
|
url: "https://httpbin.org/html"
|
|
expect:
|
|
body:
|
|
- css:
|
|
selector: "h1"
|
|
contains: "Moby-Dick"
|
|
- css:
|
|
selector: "body"
|
|
exists: true
|
|
|
|
- name: "HTML 页面 — XPath 提取节点文本"
|
|
type: http
|
|
http:
|
|
url: "https://httpbin.org/html"
|
|
expect:
|
|
body:
|
|
- xpath:
|
|
path: "/html/body/h1/text()"
|
|
contains: "Melville"
|
|
|
|
- name: "POST 接口测试"
|
|
type: http
|
|
http:
|
|
url: "https://httpbin.org/post"
|
|
method: POST
|
|
headers:
|
|
Content-Type: "application/json"
|
|
body: '{"action":"check","version":1}'
|
|
expect:
|
|
status: [200]
|
|
body:
|
|
- json:
|
|
path: "$.json.action"
|
|
equals: "check"
|
|
- json:
|
|
path: "$.json.version"
|
|
gte: 1
|
|
|
|
- name: "请求头验证"
|
|
type: http
|
|
http:
|
|
url: "https://httpbin.org/headers"
|
|
headers:
|
|
X-Custom-Header: "gateway-checker"
|
|
expect:
|
|
status: [200]
|
|
body:
|
|
- json:
|
|
path: "$.headers.X-Custom-Header"
|
|
equals: "gateway-checker"
|
|
|
|
- name: "响应头自定义校验"
|
|
type: http
|
|
http:
|
|
url: "https://httpbin.org/response-headers"
|
|
headers:
|
|
accept: "application/json"
|
|
expect:
|
|
body:
|
|
- json:
|
|
path: "$.Content-Type"
|
|
equals: "application/json"
|
|
|
|
- name: "多状态码允许"
|
|
type: http
|
|
http:
|
|
url: "https://httpbin.org/status/200"
|
|
expect:
|
|
status: [200, 201, 204]
|
|
|
|
# ========== Command targets ==========
|
|
|
|
- name: "uname 输出匹配"
|
|
type: command
|
|
group: "系统检查"
|
|
command:
|
|
exec: "uname"
|
|
args: ["-s"]
|
|
expect:
|
|
exitCode: [0]
|
|
stdout:
|
|
- match: "^[A-Z][a-z]+$"
|
|
|
|
- name: "echo 自定义文本输出"
|
|
type: command
|
|
command:
|
|
exec: "echo"
|
|
args: ["check ok"]
|
|
expect:
|
|
stdout:
|
|
- equals: "check ok\n"
|
|
maxDurationMs: 3000
|
|
|
|
- name: "ls 目录无 stderr"
|
|
type: command
|
|
command:
|
|
exec: "ls"
|
|
args: ["/tmp"]
|
|
cwd: "/"
|
|
expect:
|
|
exitCode: [0]
|
|
stderr:
|
|
- empty: true
|
|
|
|
- name: "date 输出包含年份"
|
|
type: command
|
|
command:
|
|
exec: "date"
|
|
args: ["+%Y"]
|
|
expect:
|
|
stdout:
|
|
- match: "^20\\d{2}\n?$"
|
|
|
|
- name: "wc 行数计数"
|
|
type: command
|
|
command:
|
|
exec: "wc"
|
|
args: ["-l"]
|
|
cwd: "/etc"
|
|
env:
|
|
LANG: "C"
|
|
expect:
|
|
stdout:
|
|
- match: "\\d+"
|
|
|
|
- name: "hostname 非空输出"
|
|
type: command
|
|
command:
|
|
exec: "hostname"
|
|
expect:
|
|
stdout:
|
|
- match: ".+"
|
|
|
|
- name: "多规则 stdout 顺序校验"
|
|
type: command
|
|
interval: "5m"
|
|
command:
|
|
exec: "echo"
|
|
args: ["version: 2.0.1, status: healthy"]
|
|
expect:
|
|
stdout:
|
|
- contains: "version:"
|
|
- match: "\\d+\\.\\d+\\.\\d+"
|
|
- contains: "healthy"
|
|
|
|
- name: "stderr 内容检查"
|
|
type: command
|
|
command:
|
|
exec: "ls"
|
|
args: ["/nonexistent-path-checker-test"]
|
|
expect:
|
|
exitCode: [0, 1, 2]
|
|
stderr:
|
|
- contains: "No such file"
|