MQTTKit


About

Kotori MQTTKit bundles services for operating an instant-on, generic
telemetry data sink for collecting sensor data in different scenarios.

It uses MQTT as communication protocol
and JSON as data serialization format.

MQTTKit specifically addresses data collection in multi-node, multi-sensor
environments as its design is directly derived from vendor Hiveeyes.

Todo

Write some words about the mqtt bus topic topology (mqttkit-1/testdrive/area-42/node-1) used here. In the meanwhile, please have a look at the Hiveeyes One topology.

Configuration

Take a look at etc/examples/mqttkit.ini as a configuration blueprint.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
; ------------------------------------------
; Name:     mqttkit
; Date:     March/April 2016
; About:    A generic distributed monitoring platform for
;           collecting sensor data in wide area network setups.
; Channel:  Transport: MQTT over TCP; Format: JSON
; Storage:  InfluxDB
; See also: https://getkotori.org/docs/applications/mqttkit.html
; ------------------------------------------

[mqttkit-1]
enable      = true
type        = application
realm       = mqttkit-1
mqtt_topics = mqttkit-1/#
application = kotori.daq.application.mqttkit:mqttkit_application

Todo

Describe how to activate configuration a) in package mode and b) in development mode.

Receiving data

# Receive telemetry data by subscribing to MQTT topic
mosquitto_sub -t mqttkit-1/#

Data acquisition

It is really easy to transmit telemetry data to Kotori in different ways over the MQTT bus.

Basic

  1. Send measurement values / telemetry data to the “testdrive” channel from the command line:

    # Setup "mosquitto_pub"
    aptitude install mosquitto-clients
    
    # Where to send data to
    export MQTT_BROKER=kotori.example.org
    export MQTT_TOPIC=mqttkit-1/testdrive/area-42/node-1
    
    # Define an example sensor emitting a single sample of a sawtooth signal in JSON format
    sensor() { echo "{\"sawtooth\": $(date +%-S)}"; }
    
    # Define the transmission command to send telemetry data to the "testdrive" network
    transmitter() { mosquitto_pub -h $MQTT_BROKER -t $MQTT_TOPIC/data.json -l; }
    
    # Acquire and transmit a single sensor reading
    sensor | transmitter
    
  2. Navigate to the automatically populated Grafana testdrive dashboard to watch measurement values floating in.

Tip

Please follow up at Data acquisition over MQTT for transmitting telemetry data over MQTT from other environments (Python, Arduino, mbed).

Advanced

Operations

Kotori

It is recommended to start Kotori in debug mode like:

kotori --debug-mqtt --debug-influx

Database

For dropping the InfluxDB database using its HTTP API:

export INFLUXDB_HOST=kotori.example.org
curl --silent --get "http://$INFLUXDB_HOST:8086/query?pretty=true" --user admin:admin --data-urlencode 'q=DROP DATABASE "mqttkit_1_testdrive"'