如何通过HTTP监控mosquitto服务器

How to monitor mosquitto server through HTTP

如何通过HTTP监控mosquitto服务器?我看起来像 https://my.mosquitto.server.com/health or https://my.mosquitto.server.com/info.

谢谢

您总是需要一个 MQTT 客户端来访问 $SYS 主题 space 中的信息。

当启用 MQTT over Websockets 时,您可以让 mosquitto 提供一个页面,该页面将使用带有 MQTT over Websockets 的 Paho Javascript 客户端连接到代理。该页面可以订阅您想要的任何主题。

例如您可以使用 http_dir 选项指定 moquitto 将从中提供静态文件服务器的目录。在这里,您可以部署我的 D3 MQTT topic tree viewer (code on github 的稍微修改过的版本(修改是将主题从 # 更改为 %SYS/#)。

来自 mosquitto.conf 手册页:

http_dir directory

When a listener is using the websockets protocol, it is possible to serve http data as well. Set http_dir to a directory which contains the files you wish to serve. If this option is not specified, then no normal http connections will be possible.

Not reloaded on reload signal.