Broker Test
Runs tests against the specified broker to find out its features and limitations.
mqtt test
By default, the test command will use MQTT 3 clients to test the broker first and will afterward check the connect restrictions returned by a connect of a MQTT 5 client. You can alter this behavior by specifying different options when using the command.
Example
$ mqtt test -h broker.hivemq.com
MQTT 3: OK
- Maximum topic length: 65535 bytes
- QoS 0: Received 10/10 publishes in 47,59ms
- QoS 1: Received 10/10 publishes in 68,87ms
- QoS 2: Received 10/10 publishes in 43,18ms
- Retain: OK
- Wildcard subscriptions: OK
- Shared subscriptions: OK
- Payload size: >= 100000 bytes
- Maximum client id length: 65535 bytes
- Unsupported Ascii Chars: ALL SUPPORTED
MQTT 5: OK
- Connect restrictions:
> Retain: OK
> Wildcard subscriptions: OK
> Shared subscriptions: OK
> Subscription identifiers: OK
> Maximum QoS: 2
> Receive maximum: 10
> Maximum packet size: 268435460 bytes
> Topic alias maximum: 5
> Session expiry interval: Client-based
> Server keep alive: Client-based
Options
Option | Long Version | Explanation | Default |
---|---|---|---|
-V | --mqttVersion | The MQTT version to test the broker on. | Both versions will be tested |
-a | --all | Perform all tests for all MQTT versions. | false (Only test MQTT 3) |
-t | --timeOut | The time to wait for the broker to respond (in seconds). | 10 |
-q | --qosTries | The amount of messages to send and receive from the broker for each QoS level. | 10 |
Connect Options
Option | Long Version | Explanation | Default |
---|---|---|---|
-h | --host | The MQTT host. | localhost |
-p | --port | The MQTT port. | 1883 |
Security Options
Credentials Authentication
Option | Long Version | Explanation | Default |
---|---|---|---|
-u | --user | Define the username for authentication. | |
-pw | --password | Define the password for authentication directly. If left blank the user will be prompted for the password in the console. | |
-pw:env | Define that the password for authentication is read in from an environment variable. | MQTT_CLI_PW if the option is specified without a value | |
-pw:file | Define the path to a file from which the password is read from. |
TLS Authentication
Option | Long Version | Explanation | Default |
---|---|---|---|
-s | --secure | Whether a default (properties file) TLS configuration is used. | false |
--cafile , --ca-cert , --server-cert | The path to the file containing a trusted CA certificate, to enable encrypted certificate based communication. | ||
--capath , --ca-cert-dir , --server-cert-dir | The path to the directory containing trusted CA certificates, to enable encrypted certificate based communication. | ||
--cert , --client-cert | The path to the client certificate to use for client-side authentication. | ||
--key , --client-private-key | The path to the corresponding private key for the given client certificate. | ||
--keypw , --client-private-key-password | The password for the client private key. | ||
--ks , --keystore | The path to the client keystore for client side authentication. | ||
--kspw , --keystore-password | The password for the keystore. | ||
--kspkpw , --keystore-private-key-password | The password for the private key inside the keystore. | ||
--ts , --truststore | The path to the client truststore, to enable encrypted certificate based communication. | ||
--tspw , --truststore-password | The password for the truststore. | ||
--ciphers | The supported cipher suites in IANA string format concatenated by the ‘:’ character, if more than one cipher should be supported. e.g TLS_CIPHER_1:TLS_CIPHER_2 See IANA Format for supported cipher suite strings. | ||
--tls-version | The TLS version to use - TLSv1.1 TLSv1.2 TLSv1.3 . | TLSv1.2 |
Logging Options
Option | Long Version | Explanation | Default |
---|---|---|---|
-l | Log to ~./mqtt-cli/logs (Configurable through ~/.mqtt-cli/config.properties). | false |
Help Options
Option | Long Version | Explanation |
---|---|---|
--help | Display help message for command. | |
--version | Display version information of the cli. |
Further Examples
Perform tests for MQTT 5 only
$ mqtt test -h broker.hivemq.com -a -V 5
MQTT 5: OK
- Connect restrictions:
> Retain: OK
> Wildcard subscriptions: OK
> Shared subscriptions: OK
> Subscription identifiers: OK
> Maximum QoS: 2
> Receive maximum: 10
> Maximum packet size: 268435460 bytes
> Topic alias maximum: 5
> Session expiry interval: Client-based
> Server keep alive: Client-based
- Maximum topic length: 65535 bytes
- QoS 0: Received 10/10 publishes in 52,70ms
- QoS 1: Received 10/10 publishes in 79,95ms
- QoS 2: Received 10/10 publishes in 125,65ms
- Retain: OK
- Wildcard subscriptions: OK
- Shared subscriptions: OK
- Payload size: >= 100000 bytes
- Maximum client id length: 65535 bytes
- Unsupported Ascii Chars: ALL SUPPORTED
Test receiving of 100 publishes in 10s (for each qos level)
$ mqtt test -h broker.hivemq.com -q 100
...
- QoS 0: Received 100/100 publishes in 123,44ms
- QoS 1: Received 100/100 publishes in 223,78ms
- QoS 2: Received 100/100 publishes in 340,81ms
...