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-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
Hive have a list of useful tools here and here
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
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:
And the deploy isn’t ready, do you know what is the problem?
Thanks for all
You need to install the dashboard nodes. Just install node-red-dashboard
Check out the MIMIC MQTT Lab https://mqttlab.iotsim.io for scalable
here is another nice tool probably worth mentioning
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.
Hi Steve, here is Wim speaking.
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.
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