当前 IoT 平台目标是打通 MQTT → PostgreSQL → API / Grafana 的最小闭环。
/opt/iot-platformmosquitto.serviceiot-platform-consumer.serviceiot-platform-api.serviceiot_platformdufresnenana.com/grafana/devices/+/telemetry设备 / 4G 模块 → MQTT → mosquitto → iot-platform-consumer → PostgreSQL → iot-platform-api / Grafana
systemctl status mosquitto --no-pager
systemctl status iot-platform-consumer --no-pager
systemctl status iot-platform-api --no-pager
sudo journalctl -u iot-platform-consumer -n 100 --no-pager
sudo journalctl -u iot-platform-api -n 100 --no-pager
sudo -u postgres psql -d iot_platform -c "select count(*), min(ts), max(ts) from telemetry;"
sudo -u postgres psql -d iot_platform -c "select device_id, count(*), max(ts) from telemetry group by device_id order by max(ts) desc limit 10;"
curl -fsS https://dufresnenana.com/iot-api/health
curl -fsS https://dufresnenana.com/iot-api/devices
发布测试消息时应保持 JSON payload,topic 形如:
devices/test-device/telemetry
排查设备不上报时,优先确认:
devices/+/telemetry当前普通匿名 Viewer 链接比 Public Dashboard 更稳定。Public Dashboard 在 Grafana 13 曾出现 panelId=undefined 导致 Invalid panel id。
推荐普通 dashboard 链接:
/grafana/d/weather-4g/4g-e6b094-e8b1a1-e7ab99-e79b91-e68ea7?orgId=1&from=now-6h&to=now&var-device_id=All