MoquetteMon

From IoT with AME
Jump to navigation Jump to search

MoquetteMon - Augmented MQTT-Broker for Testing

REM The software is work in progress; no code or binaries have been released yet (June 2017).

When testing self-built IoT devices I found that sometimes it would be helpful to know what is going on from the MQTT broker's point of view. It looks like there are no MQTT brokers with monitoring capabilities, which is why I decided to roll my own add-on. Which broker to choose as a base? While Mosquitto is a popular open source MQTT broker, it is written in C. There is nothing wrong with C per se; I started out programming in 6502 Assembler "some time ago", and C and C++ are familiar. But, since the 90s I definitely prefer Java, and Moquette is open source, and written in Java. Additionally it has a well-designed, clear architecture and consists of very readable code.

So Moquette it is! Moquette has a built-in feature for intercepting certain client/broker interactions. Since I wanted to have access to more information than provided I injected my own code into a (very few) select locations.

MoquetteMon shows:

  • Which clients have connected to the broker from which IP address, and when. And when they last sent a message
  • Which topics have been subscribed to, by which client
  • For which topics messages have been published, by which client

I found this helpful in the following cases:

  • Accidentally, I had two devices using the same MQTT ID. This causes the broker do disconnect one of the two devices. The monitor showed that conflict.
  • A device accidentally subscribed to the wrong topics (typo) or did not subscribe to an intended topic at all
  • A device published messages to the wrong topics (type) or did not publish messages to a specific topic at all
  • Generally mismatches between subscriptions and publications (nobody is subscribed to a topic that is used for publishing)
  • You want to get a global view of what your IoT circus is doing

Home