MoquetteMon

From IoT with AME
Jump to navigation Jump to search

Tools

MoquetteMon - Augmented MQTT-Broker for Testing

REM The first working version has been created; no code or binaries have been released yet (July 2017).

Why Moquette?

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. Kudos to the programmer, Andrea Selva.

So Moquette it is! Moquette has a built-in feature for intercepting certain client/broker interactions. All I had to was adding Moquette as a Maven dependency to my project.

What an MQTT client like MQTT-Spy can't show, but MoquetteMon can reveal:

  • Which clients have connected to the broker from which IP address, and when. And when they last sent a (any) message, like a ping.
  • 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

MoquetteMon

MoquetteMon is a Java application. The main window has three tabs:

  • Clients. Identified by their MQTT ID the remote IP and the time of the last ping is shown.
  • Topics: Publications. Published topics are shown as a tree on the left. A table on the right lists details such as who has been publishing messages with this topic, the time of the last publication, the last payload, and who has subscribed to the topic.
  • Topics: Subscriptions. Subscribed to topic patterns are shown as a tree on the left. A table on the right side lists details who has been publishing messages with this topic, the time of the last publication, the last payload, and who has subscribed to the topic.

I'm planning to add:

  • Clients: Publications. Who is publishing what?
  • Clients: Subscriptions. Who is subscribed to what?


Tools