Content of pack
- Sensor to listen or subscribe data from a topic
- Action to clean data
- Action to publish data to a topic
- Action to publish bulk data to monitor
- Rule to filter data ingested to StackStrom
IBM Watson IOT Service and Stackstorm, and Python3.7 up and running.
Clone from Github repo IBM Maximo Monitor Mqtt pack:
# clone monitor_mqtt code from github repo
git clone https://github.com/StackStorm-Exchange/stackstorm-monitor_mqtt.git
st2 pack install monitor_mqtt
Copy the example configuration in monitor_mqtt.yaml.example
to /opt/stackstorm/configs/monitor_mqtt.yaml and edit as required.
tenant_id- Tenant Idhostname- MQTT Broker to connect tosubscribe- An array of MQTT topics to subscribe to (sensor only)port- MQTT port to connect to (default: 1883)protocol- MQTT protocol version (default: MQTTv311)client_id- Client ID to register on MQTT brokeruserdata- Custom userdata to include with each MQTT message payloadusername- Username to connect to MQTT Brokerpassword- Password to connect to MQTT Brokerssl- Enable SSL support (default: false)ssl_cacert- Path to SSL CA Certificatessl_cert- Path to SSL Certificatessl_key- Path to SSL Keydata_file_path- Path of csv file to input for preprocessingjson_schema_path- Path of json file for validation of data filecsvFilePath- Path of csv file for input to Mqtt Publisher action
data_file_path and json_schema_path is mandatory to use clean data Action
csvFilePath is mandatory to use bulk publish Action
Note : When modifying the configuration in /opt/stackstorm/configs/ please
remember to tell StackStorm to load these new values by running
sudo st2ctl reload --register-configs
Setup Monitor Mqtt Virtual Env in SackStorm
st2 run packs.setup_virtualenv packs=monitor_mqtt python3=True
Action to clean and process csv data
st2 run monitor_mqtt.clean_data
Action to publish a message on a topic - monitor_mqtt.publish
st2 run monitor_mqtt.publish topic="" message=""
Action to publish clean csv data - monitor_mqtt.publishcsvdata
st2 run monitor_mqtt.publishcsvdata topic=""
Workflow to clean and publish data on a specific topic - monitor_mqtt.clean_data_mqtt_ingest_chain
st2 run monitor_mqtt.clean_data_mqtt_ingest_chain topic=""
Connects to a Watson IOT broker, subscribing to various topics and emitting triggers into the system.
Requires: config setting subscribe.
Emits:
- trigger: monitor_mqtt.message
- payload: topic, message, userdata, qos, retain