# Executing this version
Check the following examples for executing your agent.
# Input parameters
You can obtain a complete list of the available input parameters by executing:
./generic-mqtt --help
# Version
You can easily check the version, the target operating system, architecture, and extra information about this agent by executing:
./generic-mqtt --version
# Default
The basic command for running your agent is as follows:
./generic-mqtt --id 2 \
--gateway 127.0.0.1:9090 \
--token 44049908-de2d-4811-add7-0608b9f18538 \
--broker 127.0.0.1:1883
This command will set your agent as follows:
- It will identify the agent with id
2
and token44049908-de2d-4811-add7-0608b9f18538
when connecting to the IoTHub - It will connect the agent with the IoTHub Gateway module running at the address
127.0.0.1
port9090
- It will connect the agent with the MQTT broker running at the address
127.0.0.1
port1883
- It will identify the agent as client with a random name in the MQTT broker
- It will subscribe the agent to the default topic
/device
- It will disable the internal debug mode by logging only info, warnings, and error messages
# Enable debug
For enabling the internal debug mode and log also debug
messages you can execute your agent as follows:
./generic-mqtt --id 2 \
--gateway 127.0.0.1:9090 \
--token 44049908-de2d-4811-add7-0608b9f18538 \
--broker 127.0.0.1:1883 \
--debug true \
--broker-debug true
# Broker TLS
For enabling a secure connection with the MQTT broker you can specify the respective TLS files as follows:
./generic-mqtt --id 2 \
--gateway 127.0.0.1:9090 \
--token 44049908-de2d-4811-add7-0608b9f18538 \
--broker 127.0.0.1:8883 \
--broker-ca /path/to/ca.crt \
--client-cert /path/to/client.crt \
--client-key /path/to/client.key
# Customize topics
For overriding the default topics you can execute the agent as follows:
./generic-mqtt --id 2 \
--gateway 127.0.0.1:9090 \
--token 44049908-de2d-4811-add7-0608b9f18538 \
--broker 127.0.0.1:1883 \
--root-topic mytopic \
--write-topic update \
--config-topic settings
# Config file
You can also specify a YAML file with your input settings.
id: 2
token: 44049908-de2d-4811-add7-0608b9f18538
gateway: 127.0.0.1:9090
debug: true
broker: 178.63.220.244:8883
broker-debug: false
broker-ca: /path/to/ca.crt
client-cert: /path/to/client.crt
client-key: /path/to/client.key
root-topic: mytopic
write-topic: write/to/device
config-topic: config/to/device
Then, you can input this configuration file into your agent as follows:
./generic-mqtt --config-file /path/to/config.yml