补齐集群状态、主机与通知链路基础监控 (#149)
yaml / yaml (push) Successful in 1m10s

Co-authored-by: panxiao81 <[email protected]>
This commit was merged in pull request #149.
This commit is contained in:
2026-09-25 17:45:56 +00:00
committed by panxiao81
parent a43b7d3c26
commit 39aeac25ee
9 changed files with 474 additions and 0 deletions
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
# 依赖 Python 3 + PyYAML,以及 PATH 中的 promtool(验证版本 3.5.0)。
set -euo pipefail
test_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
check_dir="$(mktemp -d)"
trap 'rm -rf "$check_dir"' EXIT
python3 - "$test_dir/../rules" "$check_dir/rules.yaml" <<'PY'
import pathlib
import sys
import yaml
groups = []
for name in ("kubernetes-health", "host-health", "monitoring-delivery"):
path = pathlib.Path(sys.argv[1]) / f"{name}.yaml"
groups.extend(yaml.safe_load(path.read_text())["spec"]["groups"])
pathlib.Path(sys.argv[2]).write_text(yaml.safe_dump({"groups": groups}, allow_unicode=True))
PY
cp "$test_dir/foundation.test.yaml" "$check_dir/foundation.test.yaml"
promtool check rules "$check_dir/rules.yaml"
promtool test rules "$check_dir/foundation.test.yaml"