test
This commit is contained in:
29
common.sh
29
common.sh
@@ -287,30 +287,13 @@ pc_probe_msg_gateway() {
|
|||||||
o="${o%/}"
|
o="${o%/}"
|
||||||
[[ -z "$o" ]] && return 0
|
[[ -z "$o" ]] && return 0
|
||||||
|
|
||||||
if ! command -v curl &>/dev/null; then
|
local gateway_pid
|
||||||
return 0
|
gateway_pid=$(lsof -ti :10001 2>/dev/null | head -1 || true)
|
||||||
fi
|
if [[ -n "$gateway_pid" ]]; then
|
||||||
|
success " MsgGateway 本机端口监听正常: 127.0.0.1:10001 (PID=${gateway_pid})"
|
||||||
local local_code public_code tmp_body
|
|
||||||
tmp_body="${TMPDIR:-/tmp}/openim-msggateway-probe.$$"
|
|
||||||
|
|
||||||
local_code=$(curl -sS -o "$tmp_body" -w "%{http_code}" --max-time 3 \
|
|
||||||
"http://127.0.0.1:10001/msg_gateway" 2>/dev/null || true)
|
|
||||||
if [[ "$local_code" == "000" ]]; then
|
|
||||||
warn " MsgGateway 本机不可达: http://127.0.0.1:10001/msg_gateway(请确认 openim-server 正在监听 :10001)"
|
|
||||||
else
|
else
|
||||||
success " MsgGateway 本机可达: http://127.0.0.1:10001/msg_gateway (HTTP ${local_code},无 token 返回错误属正常)"
|
warn " MsgGateway 本机端口未监听: 127.0.0.1:10001(请确认 openim-server 已启动)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
public_code=$(curl -sS -o "$tmp_body" -w "%{http_code}" --max-time 3 \
|
info " MsgGateway Nginx 入口: ${o}/msg_gateway(不做无 token HTTP 探测,避免在 openim-server.log 中产生 token is empty 告警)"
|
||||||
"${o}/msg_gateway" 2>/dev/null || true)
|
|
||||||
if [[ "$public_code" == "000" ]]; then
|
|
||||||
warn " MsgGateway Nginx 入口不可达: ${o}/msg_gateway"
|
|
||||||
elif [[ "$public_code" == "502" || "$public_code" == "503" || "$public_code" == "504" ]]; then
|
|
||||||
warn " MsgGateway Nginx 入口返回 HTTP ${public_code}: ${o}/msg_gateway(Nginx 到 127.0.0.1:10001 可能不通)"
|
|
||||||
else
|
|
||||||
success " MsgGateway Nginx 入口可达: ${o}/msg_gateway (HTTP ${public_code},无 token 返回错误属正常)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -f "$tmp_body"
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user