deploy(M00-E): 补充EMQX检查模板
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# shellcheck source=lib.sh
|
||||
. "${SCRIPT_DIR}/lib.sh"
|
||||
|
||||
qipai_emqx_status() {
|
||||
local acl_template authz_template
|
||||
acl_template="${SCRIPT_DIR}/../../deploy/emqx/acl.conf.template"
|
||||
authz_template="${SCRIPT_DIR}/../../deploy/emqx/authorization.hocon.template"
|
||||
|
||||
qipai_info "EMQX target: native Ubuntu Apt package, no Docker"
|
||||
qipai_info "MQTT broker host: 101.42.38.246"
|
||||
qipai_info "MQTT protocol: MQTT 3.1.1 compatible, QoS 1 baseline"
|
||||
qipai_info "MQTTX on server: forbidden"
|
||||
qipai_info "ACL template: ${acl_template}"
|
||||
qipai_info "Authorization template: ${authz_template}"
|
||||
|
||||
if command -v emqx >/dev/null 2>&1; then
|
||||
qipai_pass "emqx command exists: $(command -v emqx)"
|
||||
emqx version 2>/dev/null || true
|
||||
else
|
||||
qipai_warn "emqx command not found"
|
||||
fi
|
||||
|
||||
if command -v mosquitto_pub >/dev/null 2>&1; then
|
||||
qipai_pass "mosquitto-clients available"
|
||||
else
|
||||
qipai_warn "mosquitto-clients not installed"
|
||||
fi
|
||||
|
||||
if command -v systemctl >/dev/null 2>&1; then
|
||||
systemctl is-enabled --quiet emqx 2>/dev/null && qipai_pass "emqx service enabled" || qipai_warn "emqx service not enabled or missing"
|
||||
systemctl is-active --quiet emqx 2>/dev/null && qipai_pass "emqx service active" || qipai_warn "emqx service inactive or missing"
|
||||
else
|
||||
qipai_warn "systemctl not available; service check skipped"
|
||||
fi
|
||||
|
||||
for port in 1883 18083; do
|
||||
if command -v ss >/dev/null 2>&1; then
|
||||
ss -ltn "( sport = :${port} )" | grep -q ":${port}" && qipai_pass "port ${port} is listening" || qipai_warn "port ${port} is not listening"
|
||||
else
|
||||
qipai_warn "ss not available; port ${port} check skipped"
|
||||
fi
|
||||
done
|
||||
|
||||
[ -f "$acl_template" ] && qipai_pass "ACL template exists" || qipai_warn "ACL template not found"
|
||||
[ -f "$authz_template" ] && qipai_pass "authorization template exists" || qipai_warn "authorization template not found"
|
||||
|
||||
qipai_info "manual install summary:"
|
||||
qipai_info "see deploy/emqx/install-ubuntu24-amd64.md"
|
||||
}
|
||||
|
||||
if [ "${1:-}" = "--run" ]; then
|
||||
qipai_emqx_status
|
||||
fi
|
||||
Reference in New Issue
Block a user