mqtt-tools / mqttwarn

A highly configurable MQTT message router, where the routing targets are notification plugins, primarily written in Python.
https://mqttwarn.readthedocs.io/
Eclipse Public License 2.0
958 stars 184 forks source link

Publish metric information like "messages/received" to "mqttwarn/$SYS" topic #553

Open amotl opened 3 years ago

amotl commented 3 years ago

Hi again,

based on #552, which implemented status_publish and status_topic settings, I would like to see the possibility to configure a status_interval setting, defaulting to 60 seconds. Status information shall be collected and published in the configured interval.

In that manner, publishing more volatile information, like Mosquitto's $SYS/broker/load/messages/{received,sent}/+ can be implemented.

Synopsis

mqttwarn/$SYS/event/start 2021-10-17T17:49:06+02:00
mqttwarn/$SYS/messages/received 42

Requests for comments

I would like to share this idea, in order to find out if that would be a sensible feature altogether. Maybe this feature resonates with @sumnerboy12, @psyciknz and others using mqttwarn within a multicontainer Docker setup or similar environments like Kubernetes. Please let me know about anything which comes to mind.

With kind regards, Andreas.

psyciknz commented 3 years ago

I'd support that. So start would be since running? And messages received sent would be for the life of the instance? That would make interesting viewing in grafana.

Actually does mqttwarn post an online status as LWT anywhere upon starting?

Not that I've every had to question is it up and running as it always is. But it would be good practice.

sumnerboy12 commented 3 years ago

There is a configurable LWT topic - see https://github.com/jpmens/mqttwarn/blob/main/HANDBOOK.md#the-defaults-section.

sumnerboy12 commented 3 years ago

Can't see any harm in publishing these sorts of metrics. Might be interesting to track them although I am not sure I would have much use for them initially.

jpmens commented 3 years ago

I like the idea of mqttwarn/$SYS/messages/received 42, and as @sumnerboy12 says, there's no harm in doing so. ;)