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
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.
Browser Tools – Chrome
MQTT-Lens – Chrome add-on for publishing and subscribing to an MQTT broker. –Using MQTT-Lens- Beginners Guide
MQTT-Box– Chrome 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:
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.
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.
This 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
- 1.use -c 10 for 10 pings
- 2. Use -d 5 for 5 second delay between pings
- use -s to only print end result
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- 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.
Type python mqtt-monitor.py -h
- 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
The script is designed to be run from the command line.
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
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.
Links to External Tools
Related Tutorials and resources:
- Using The Mosquitto_pub and Mosquitto_sub MQTT Client Tools- Examples
- Logging MQTT Sensor Data to SQL DataBase With Python
- How to Send a File Using MQTT Using a Python Script
- Simple Python MQTT Data Logger
- Simple Controllable MQTT Sensor Simulator in Python