完成a6000测试系统构建、部署、测试整合 (#35)

测试方案:

- lm2机器端口映射到本机:18080, 18081, 8082-8085
- 访问URL: http://localhost:18080/dashboard

![image.png](/attachments/30ed6e20-697a-4d3b-a6d3-6acccd2e9922)

![image.png](/attachments/38ef1751-0f3b-49c6-9100-f70d15617acc)

![image.png](/attachments/3be45005-9b9e-4165-8ef6-1d27405800f1)

![image.png](/attachments/eb916192-edc1-4096-8f9f-9769ab6d9039)

![image.png](/attachments/620e6efc-bd02-45ae-bba1-99a95a1b4c02)

![image.png](/attachments/986e77e7-c687-405f-a760-93282249f72f)

端到端测试通过:

![image.png](/attachments/c6e29875-4a16-4718-8b2f-368f64eb545e)

Co-authored-by: sundapeng.sdp <sundapeng@hashdata.cn>
Reviewed-on: #35
Reviewed-by: xuxt <xuxt@zgclab.edu.cn>
Reviewed-by: sundapeng <sundp@mail.zgclab.edu.cn>
Reviewed-by: huhy <husteryezi@163.com>
This commit was merged in pull request #35.
This commit is contained in:
2025-10-29 10:04:27 +08:00
parent d1b89c0cf6
commit 59a38513a4
143 changed files with 10840 additions and 609 deletions

View File

@@ -0,0 +1,69 @@
#!/bin/bash
# Argus Agent 健康检查脚本
# 输出 JSON 格式结果
set -e
# 检查 Argus Agent 健康状态
check_health() {
local name="argus-agent"
local status="unhealth"
local reason=""
local install_record="/opt/argus-metric/current/.install_record"
# 首先尝试通过安装记录文件检查进程
if [[ -f "$install_record" ]]; then
# 尝试使用jq解析JSON格式的安装记录文件
local pid=""
if command -v jq &> /dev/null; then
pid=$(jq -r '.components."argus-agent".pid // empty' "$install_record" 2>/dev/null || echo "")
else
# 如果没有jq,使用简单的文本解析方法
pid=$(grep -A 10 '"argus-agent"' "$install_record" | grep '"pid"' | cut -d'"' -f4 | head -1)
fi
if [[ -n "$pid" && "$pid" =~ ^[0-9]+$ ]]; then
if kill -0 "$pid" 2>/dev/null; then
# 进程存在且运行正常
status="health"
reason="进程运行正常 (PID: $pid)"
echo "{\"name\": \"$name\", \"status\": \"$status\", \"reason\": \"$reason\"}"
exit 0
else
reason="安装记录中的 PID $pid 进程不存在"
echo "{\"name\": \"$name\", \"status\": \"$status\", \"reason\": \"$reason\"}"
exit 1
fi
else
reason="安装记录文件中未找到有效的 argus-agent PID"
echo "{\"name\": \"$name\", \"status\": \"$status\", \"reason\": \"$reason\"}"
exit 1
fi
else
# 如果安装记录文件不存在,尝试查找 argus-agent 进程
local pids=$(pgrep -f "argus-agent" 2>/dev/null || true)
if [[ -n "$pids" ]]; then
# 取第一个找到的 PID
local pid=$(echo "$pids" | head -1)
status="health"
reason="发现 argus-agent 进程运行 (PID: $pid),但未找到安装记录"
echo "{\"name\": \"$name\", \"status\": \"$status\", \"reason\": \"$reason\"}"
exit 0
else
reason="未找到 argus-agent 进程,且安装记录文件不存在"
echo "{\"name\": \"$name\", \"status\": \"$status\", \"reason\": \"$reason\"}"
exit 1
fi
fi
}
# 主函数
main() {
check_health
}
# 脚本入口
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
main "$@"
fi