MQTT Tools and Resources

Suitable tools are an important part of setting up and testing an MQTT installation.

Tools are available for Windows,Linux,Android and IPhone

In this tutorial I will give you an overview of popular tools that are available for download on the Internet, and also some of my own tools that I have created that may also be of use

Client Simulation Tools

There are a variety of tools available for use on a PC and also smart phone/tablet.

  • Command Line tools
  • Browser Tools
  • Smart Phone and Tablet Tools

Command Line Tools

These tools are part of the mosquitto broker install on Windows but are a separate install on Linux (Raspberry Pi).

Mosquitto_sub – Simple subscribe utility for testing. This comes with the Mosquitto broker.

Mosquitto_pub – Simple publish utility for testing. This comes with the Mosquitto broker.

See Using Mosquitto_pub and Mosquitto_sub tutorial

Browser Tools – Chrome

MQTT-LensChrome add-on for publishing and subscribing to an MQTT broker. –Using MQTT-Lens- Beginners Guide

MQTT-BoxChrome add-on for publishing and subscribing. More feature rich than MQTT-Lens. Supports Websockets. see Using MQTTBox

Windows, Linux Mac Apps

MQTT Explorer– Explore MQTT topic structure,graph data, delete retained messages, send and receive messages. Supports websockets.

Android Tools-Smart Phone and Tablet

MQTT Dashboard – Simple tool to publishing and subscribing.

MQTT Dash- Create MQTT dashboards for the smart home

Note: this page has a better list and more information about the main MQTT client tools

Broker Testing Tools

$SYS Topic Monitor

This node red flow will monitor the $SYS topic of the selected broker and produce a display as shown below:

mosquitto-broker-topic-monitor

Benchmark Testing

Broker Configuration File Viewing

If you have edited the default mosquitto.conf file and have difficulty finding your edits then this script will be of use.

It scans the file and prints the line number and contents of any uncommented line.

It only takes one argument -f filename if this is omitted it will check the mosquitto.conf file if available.

using-check-config-mosquitto

download

It now produces an output file without the comments. The file as the new_ prefix.

Simple Python MQTT Broker Connection Tester

I used this tool for testing the 1024 max connection limit on Linux. It creates multiple connections including ssl connections and send test messages. reports message delay max,min and average.

This video demonstrates and explains how to use t.

My Python Script Test Tools

These scripts are scripts that I’ve written while experimenting with MQTT.

MQTT Ping

mqtt-ping-iconThis test tool is a simple python script that tests if a broker is up and how long messages take, just like the traditional IP ping utility.

MQTT Ping Usage

The utility is designed to be run from the command line.

The script requires only a single parameter which is the broker IP or domain name.Type python mqtt-ping.py -h

mqtt-ping-usage

Examples

  • 1.use -c 10 for 10 pings
  • 2. Use -d 5 for 5 second delay between pings
  • use -s to only print end result

Example Run:

MQTT-Ping-Example

download

Retained Messages Utility

Two scripts one for displaying and optionally deleting retained messages on a topic tree. The other is used for creating topics with retained messages for testing purposes.

Tutorial here. includes link to download the scripts

MQTT Explorer also allow you to view and remove retained messages.

MQTT- Monitor -Monitors Selected topics

This is very useful tool for monitoring topics on a broker. I use it frequently when testing.

By default it only display changed messages.

Usage:

Type python mqtt-monitor.py -h

mqtt-monitor-usage mqtt-monitor-usage

Examples

    • Can add multiple topics by repeated use of -t option
    • Use -v no to display only changed messages
    • Use -c 100 to stop after 100 seconds
    • Use -q value (0 or 1 or 2) to set the QOS of all topics
    • Use -d yes to turn on debugging mode

mqtt-monitor-example-use

The script is designed to be run from the command line.

download

Sparkplug Monitor

Based on the MQTT monitor above but will decode Sparkplug messages.

To work the monitor needs to decode the Google protocol buffers and this uses two files available on github but also included with the download. They are

  • sparkplug_b.py
  • sparkplug_b_pb2.py

I placed them in the same folder as the Sparkplug monitor file but they can go anywhere provided they are locatable by the module.

The  switch -v will display topic and message and the default is to display topic only.

Python MQTT Bridge

This functions like the bridge in the mosquitto broker but is implemented in an external python client.

This means that you don’t need to be a mosquitto broker admin to configure it.

download

Links to External Tools

Hive have a list of useful tools here and here

Related Tutorials and resources:

Save

Save

Save

Save

Save

Save

Please rate? And use Comments to let me know more

8 comments

  1. Hi Steve,
    I try to use the $SYS Topic Monitor, but when i import the txt file in node-red, the dashboard give for result:

    Imported unrecognised types:
    ui_template
    ui_group
    ui_tab

    And the deploy isn’t ready, do you know what is the problem?
    Thanks for all

    1. Amazing tool, nice job and thank you for sharing. I do recommend this tool to anyone doing a deployment and need to keep an eye on the broker.

  2. Hi Steve, here is Wim speaking.

    Question:
    Did you ever publish something about mosquitto_sub running onder PHP?
    I got mosquitto_pub working under PHP but I can’t get a working subscribe.
    I have seen a lot of examples but non of them work for me…
    My broker and Apache2 webserver run on a Raspberry PI zero.
    Thanks for reading this.
    Wim.

    1. No never tried it but if you send me the code for both subscribe and publish using the ask steve page I’ll take a look
      rgds
      steve

Leave a Reply

Your email address will not be published. Required fields are marked *