Commit a3fb19ab authored by 吴文龙's avatar 吴文龙

增加IP传参

parent 1b437060
......@@ -17,6 +17,4 @@ services:
- NET_ADMIN
environment:
MQTT_PORT: 1883
TB_MQTT_PORT: 31883
TB_ACCESS_TOKEN: '123456'
FORCE_HTTPS_REDIRECT: "false"
......@@ -51,14 +51,14 @@ listen mqtt-in
option external-check
option log-health-checks
external-check path "/usr/bin:/bin:/usr/local/bin"
external-check command /usr/local/bin/check_mqtt.sh
server tbMqtt1 47.99.83.75:31883 check inter 10s rise 2 fall 3
server tbMqtt2 47.97.197.103:31883 check inter 10s rise 2 fall 3
server tbMqtt3 47.96.103.209:31883 check inter 10s rise 2 fall 3
server tbMqtt4 121.43.228.88:31883 check inter 10s rise 2 fall 3
server tbMqtt5 121.43.169.33:31883 check inter 10s rise 2 fall 3
server tbMqtt6 120.55.38.205:31883 check inter 10s rise 2 fall 3
server tbMqtt7 116.62.229.50:31883 check inter 10s rise 2 fall 3
server tbMqtt8 121.196.10.235:31883 check inter 10s rise 2 fall 3
server tbMqtt9 47.114.33.137:31883 check inter 10s rise 2 fall 3
server tbMqtt10 47.97.181.210:31883 check inter 10s rise 2 fall 3
\ No newline at end of file
external-check command /usr/local/bin/check_mqtt.sh
server tbMqtt1 47.99.83.75:31883 check inter 30s rise 2 fall 3
server tbMqtt2 47.97.197.103:31883 check inter 30s rise 2 fall 3
server tbMqtt3 47.96.103.209:31883 check inter 30s rise 2 fall 3
#server tbMqtt4 121.43.228.88:31883 check inter 30s rise 2 fall 3
server tbMqtt5 121.43.169.33:31883 check inter 30s rise 2 fall 3
#server tbMqtt6 120.55.38.205:31883 check inter 30s rise 2 fall 3
server tbMqtt7 116.62.229.50:31883 check inter 30s rise 2 fall 3
server tbMqtt8 121.196.10.235:31883 check inter 30s rise 2 fall 3
server tbMqtt9 47.114.33.137:31883 check inter 30s rise 2 fall 3
#server tbMqtt10 47.97.181.210:31883 check inter 30s rise 2 fall 3
#!/bin/sh
echo $@ >> /tmp/all_arguments.txt
ip_adr=$(echo $@|awk '{print $3}')
if mosquitto_pub -h $ip_adr -p ${TB_MQTT_PORT} -u ${TB_ACCESS_TOKEN} -t v1/devices/me/attributes -f /usr/local/bin/test-mqtt.json -q 1 -d; then
source mqtt.env
currentTime=$(date "+%Y-%m-%d %H:%M:%S")
env > /tmp/env.txt
if mosquitto_pub -h $HAPROXY_SERVER_ADDR -p $HAPROXY_SERVER_PORT -u $TB_ACCESS_TOKEN -t v1/devices/me/telemetry -m "{\"check-mqtt-status\": \"ok\",\"$HAPROXY_SERVER_ADDR:$HAPROXY_SERVER_PORT\": \"$currentTime\"}" -q 1 -d; then
exit 0
else
exit 1
......
TB_ACCESS_TOKEN='123456'
\ No newline at end of file
{"check-mqtt-status": "ok"}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment