19 Commits

Author SHA1 Message Date
sundapeng.sdp
b6d49ea562 feat: 优化Argus-Metric测试流程README.md;
refs #3
2025-10-11 16:50:28 +08:00
sundapeng.sdp
5211769ba8 feat: 测试环境搭建,e2e测试;
refs #3
2025-10-11 15:52:50 +08:00
sundapeng.sdp
28ef5df6e4 feat: 动态监测各组件健康状态,组件进程失败后动态拉起;
refs #11
2025-10-11 15:52:50 +08:00
sundapeng.sdp
687d29993a feat: 创建Grafana Dashboard基础配置;各镜像构建新增dns-monitor.sh脚本及相关定时任务; 2025-10-11 15:52:50 +08:00
sundapeng.sdp
54185101f0 feat: Dashboard支持 instance、hostname 不同var的过滤数据;
refs #12
2025-10-11 15:52:50 +08:00
sundapeng.sdp
018cdb40cc fix: 修复组件统一安装时,各组件入参不匹配的问题;
refs #11
2025-10-11 15:52:49 +08:00
sundapeng.sdp
36290bb08f feat: 基于原镜像构建对应的版本,解决账户兼容与持久化问题;创建 Dashboard 模版,default_dashboard.json;
refs #12
2025-10-11 15:52:49 +08:00
sundapeng.sdp
d514283cda fix: 修复 exporter_config.json 拷贝失败的问题;
refs #9
2025-10-11 15:52:49 +08:00
sundapeng.sdp
bfa1d71c49 feat: 定时任务拉取/检测变更dns.conf,更新客户端/etc/resolv.conf;定时任务拉取新版本更新;
refs #11
2025-10-11 15:52:49 +08:00
sundapeng.sdp
cb659f581b feat: 设置全局环境变量;集成fluent-bit安装包;设置组件健康检查目录;
refs #11
2025-10-11 15:52:49 +08:00
sundapeng.sdp
55f9317a1b feat: 用户侧安装组件前,提前下载全局配置文件并设置环境变量;集成 fluent-bit 安装包;
refs #11
2025-10-11 15:52:49 +08:00
sundapeng.sdp
f305a65abf feat: 打包分发程序目录调整
refs #11
2025-10-11 15:52:49 +08:00
sundapeng.sdp
46c34f3de6 feat: 定时解析argus-master产生的资源文件,生成动态配置文件,用于 Prometheus 热加载配置;
refs #9
2025-10-11 15:52:48 +08:00
sundapeng.sdp
8e2d751c2c fix: 修复启动服务失败导致的二次安装问题;修复缺少deps系统依赖问题;
refs #3
2025-10-11 15:52:48 +08:00
sundapeng.sdp
ab44edc22f feat: FTP镜像构建;加载vsftpd配置;兼容特定账户;配置共享目录;
refs #10
2025-10-11 15:52:48 +08:00
sundapeng.sdp
586740a17a feat: 基于算力平台的Prometheus镜像改造,supervisor自启应用;调整Prometheus.yml结构;
refs #9
2025-10-11 15:52:48 +08:00
sundapeng.sdp
5fa6e80578 feat: FTP服务器离线安装及配置;数据采集客户端支持一键部署、版本校验、组件健康检查、失败回滚等功能;
refs #3
2025-10-11 15:52:48 +08:00
sundapeng.sdp
e941537dd5 feat: 提交示例Node-Exporter安装包;
refs #3
2025-10-11 15:52:48 +08:00
sundapeng.sdp
4fb8652177 feat: 支持all-in-one模式构建、发布安装包;支持各组件健康状态监测;Prometheus相关配置文件;
refs #3
2025-10-11 15:52:48 +08:00
2 changed files with 42 additions and 48 deletions

View File

@@ -2,7 +2,7 @@
set -euo pipefail set -euo pipefail
ES_HOST="${ELASTICSEARCH_HOSTS:-http://es:9200}" ES_HOST="${ELASTICSEARCH_HOSTS:-http://es:9200}"
KB_HOST="${KB_HOST:-http://127.0.0.1:5601}" KB_HOST="http://localhost:5601"
echo "[INFO] Starting Kibana post-start configuration..." echo "[INFO] Starting Kibana post-start configuration..."
@@ -83,37 +83,50 @@ fix_replicas_idempotent() {
} }
# 幂等创建数据视图 # 幂等创建数据视图
create_or_ensure_data_view() {
local name="$1"
local title="$2"
local list_response
list_response=$(curl -fsS "$KB_HOST/api/data_views" -H 'kbn-xsrf: true' 2>/dev/null || echo "")
if [ -z "$list_response" ]; then
echo "[WARN] Failed to list data views, skipping creation check for $title"
return
fi
if echo "$list_response" | grep -Fq "\"title\":\"$title\""; then
echo "[INFO] Data view $title already exists, skipping"
return
fi
echo "[INFO] Creating data view for $title indices (allowNoIndex)"
curl -fsS -X POST "$KB_HOST/api/data_views/data_view?allowNoIndex=true" \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' \
-d "{\"data_view\":{\"name\":\"$name\",\"title\":\"$title\",\"timeFieldName\":\"@timestamp\",\"allowNoIndex\":true}}" \
>/dev/null && echo "[OK] Created $name data view" || echo "[WARN] Failed to create $name data view"
}
create_data_views_idempotent() { create_data_views_idempotent() {
echo "[INFO] Checking and creating data views..." echo "[INFO] Checking and creating data views..."
create_or_ensure_data_view "train" "train-*" # 检查是否存在匹配的索引
create_or_ensure_data_view "infer" "infer-*" local train_indices=$(curl -s "$ES_HOST/_cat/indices/train-*?h=index" 2>/dev/null | wc -l || echo "0")
local infer_indices=$(curl -s "$ES_HOST/_cat/indices/infer-*?h=index" 2>/dev/null | wc -l || echo "0")
# 创建 train 数据视图
if [ "$train_indices" -gt 0 ]; then
# 检查数据视图是否已存在
local train_exists=$(curl -s "$KB_HOST/api/data_views" -H 'kbn-xsrf: true' 2>/dev/null | grep '"title":"train-\*"' | wc -l )
if [ "$train_exists" -eq 0 ]; then
echo "[INFO] Creating data view for train-* indices"
curl -fsS -X POST "$KB_HOST/api/data_views/data_view" \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' \
-d '{"data_view":{"name":"train","title":"train-*","timeFieldName":"@timestamp"}}' \
>/dev/null && echo "[OK] Created train data view" || echo "[WARN] Failed to create train data view"
else
echo "[INFO] Train data view already exists, skipping"
fi
else
echo "[INFO] No train-* indices found, skipping train data view creation"
fi
# 创建 infer 数据视图
if [ "$infer_indices" -gt 0 ]; then
# 检查数据视图是否已存在
local infer_exists=$(curl -s "$KB_HOST/api/data_views" -H 'kbn-xsrf: true' 2>/dev/null | grep '"title":"infer-\*"' | wc -l )
if [ "$infer_exists" -eq 0 ]; then
echo "[INFO] Creating data view for infer-* indices"
curl -fsS -X POST "$KB_HOST/api/data_views/data_view" \
-H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' \
-d '{"data_view":{"name":"infer","title":"infer-*","timeFieldName":"@timestamp"}}' \
>/dev/null && echo "[OK] Created infer data view" || echo "[WARN] Failed to create infer data view"
else
echo "[INFO] Infer data view already exists, skipping"
fi
else
echo "[INFO] No infer-* indices found, skipping infer data view creation"
fi
} }
# 主逻辑 # 主逻辑

View File

@@ -115,32 +115,20 @@ show_step "Health" "Check service health"
echo "[INFO] Checking service health..." echo "[INFO] Checking service health..."
# 检查 Elasticsearch 健康状态 # 检查 Elasticsearch 健康状态
health_check_ok=1
es_health=$(curl -s "http://localhost:9200/_cluster/health" | grep -o '"status":"[^"]*"' | cut -d'"' -f4) es_health=$(curl -s "http://localhost:9200/_cluster/health" | grep -o '"status":"[^"]*"' | cut -d'"' -f4)
if [ "$es_health" = "green" ] || [ "$es_health" = "yellow" ]; then if [ "$es_health" = "green" ] || [ "$es_health" = "yellow" ]; then
echo "✅ Elasticsearch health: $es_health" echo "✅ Elasticsearch health: $es_health"
else else
echo "❌ Elasticsearch health: $es_health" echo "❌ Elasticsearch health: $es_health"
health_check_ok=0
fi fi
# 检查 Kibana 状态 # 检查 Kibana 状态
if curl -fs "http://localhost:5601/api/status" >/dev/null 2>&1; then if curl -fs "http://localhost:5601/api/status" >/dev/null 2>&1; then
kb_status="available" kb_status="available"
echo "✅ Kibana status: $kb_status" echo "✅ Kibana status: $kb_status"
data_views_json=$(curl -fs "http://localhost:5601/api/data_views" -H 'kbn-xsrf: true' 2>/dev/null || true)
if echo "$data_views_json" | grep -F '"title":"train-*"' >/dev/null 2>&1 && \
echo "$data_views_json" | grep -F '"title":"infer-*"' >/dev/null 2>&1; then
echo "✅ Kibana data views: train-* and infer-* present"
else
echo "❌ Kibana data views missing: train-* or infer-*"
health_check_ok=0
fi
else else
kb_status="unavailable" kb_status="unavailable"
echo "⚠️ Kibana status: $kb_status" echo "⚠️ Kibana status: $kb_status"
health_check_ok=0
fi fi
# 检查 Fluent-Bit 指标 # 检查 Fluent-Bit 指标
@@ -151,13 +139,6 @@ if [ "$fb_host01_uptime" -gt 0 ] && [ "$fb_host02_uptime" -gt 0 ]; then
echo "✅ Fluent-Bit services: host01 uptime=${fb_host01_uptime}s, host02 uptime=${fb_host02_uptime}s" echo "✅ Fluent-Bit services: host01 uptime=${fb_host01_uptime}s, host02 uptime=${fb_host02_uptime}s"
else else
echo "⚠️ Fluent-Bit services: host01 uptime=${fb_host01_uptime}s, host02 uptime=${fb_host02_uptime}s" echo "⚠️ Fluent-Bit services: host01 uptime=${fb_host01_uptime}s, host02 uptime=${fb_host02_uptime}s"
health_check_ok=0
fi
if [ "$health_check_ok" -eq 1 ]; then
true
else
false
fi fi
verify_step "Service health check" verify_step "Service health check"