Scaleway DocumentationIoTIoT HubHow to
Use the Data Visualization Kickstart

Jump toUpdate content

How to use the data visualization Kickstart

Reviewed on 02 June 2021Published on 01 September 2019

The data visualization Kickstart provides a storage metric and visualization application.

It will set up and configure the following software:

  • Telegraf: relays the metrics from the IoT Hub to the database
  • InfluxDB: stores the metrics
  • Grafana: displays your metrics on a nice looking dashboard
Requirements:

How to deploy the data visualization Kickstart

  1. Create a new data visualization purpose Kickstart from the Scaleway console.

  2. Select the IoT Hub and device to use with the Kickstart.

    Important:

    Currently only devices supporting insecure connections are allowed for this IoT Kickstart.

  3. Choose the geographical region to deploy your Kickstart.

  4. Set a password for the Kickstart’s dashboard.

  5. Click Create a Kickstart to launch the installation of the software stack.

Note:

The Kickstart setup process will insert a first log item in the database to make sure it is up and running.

How to use the data visualization Kickstart

The bridge will connect to your IoT Hub and subscribe to # (all topics).

Tip:

For more information about MQTT topics here.

Any valid message published on your IoT Hub will be stored as a document in the ElasticSearch database.

If the message payload is a UTF-8 encoded string, there are 3 possibilities:

  • payload is a number: this number will show up in a value field of the document
  • payload is a JSON encoded string: the first order JSON fields will be stored in the document
  • payload is any other string: this string will show up in a payload field of the document The bridge also adds a topic and a timestamp field to any document.
  1. Click IoT Hub in the IoT Station section of the side menu. The list of your IoT Hubs displays.

  2. Click the name of the IoT Hub you want to configure. The hub’s overview page displays.

  3. Click Devices to display the devices configuration.

  4. Click Add devices in the devices tab. The Create a Device wizard displays.

  5. Enter a name for the device and allow insecure connections.

  6. Click Add a Device to your Hub. The devices details displays. Take a note of the Device ID:

  7. Open a terminal window on your local computer and type the following command:

    mosquitto_pub -h iot.fr-par.scw.cloud -i <device id> -t home/bedroom/temperature -m 19.4
    Note: The Endpoint `iot-fr-par.scw.cloud` may vary, you find your endpoint on the Hub's network page.

    The command above contains the following elements:

    • -h: The endpoint or host of your IoT Hub. You require it to communicate with your hub.
    • -i: The device ID of your device. You can retrieve it from the Devices section of your hub.
    • -t: The thread to send your message to.
    • -m: The message containing the information you want to transmit.

    These values are stored in a measurement named iot within the InfluxDB scwiot database. A topic tag is attached to the value, this tag contains the topic the message was published to.

    scwiot> select * from iot
    name: iot
    time topic value
    ---- ----- -----
    1567159540648140455 home/bedroom/temperature 19.4
  8. Open a web browser and go to your Kickstarts dashboard (Grafana) available at http://<your_kickstart_instance_ip>. Log in using the user admin and the password set during the Kickstart creation. An initial Grafana dashboard containing a graph panel has been pre-configured for you. This panel will show a chart on which there is one line for each topic on which you sent a message to the IoT Hub and containing compatible data (a single numeric value). You may want, on the top right of the screen, to select the time span that suits the data you are looking at.

How to configure data ingestion settings

Data ingestion is performed by Telegraf, its configuration file is located at /etc/telegraf/telegraf.conf. Interresting values are in inputs.mqtt_consumer section:

  • topics: this is the list of topics Telegraf should subscribe to on your IoT Hub. Default is the # wildcard which means “all topics”. More information about MQTT topics here.
  • data_format and data_type: this is the format of the expected message payload. Default is value and float which means Telegraf expects a single numeric value which can be a floating value. Telegraf can handle more complex message payloads, more information about data types here.
  • name_override: this directive tells Telegraf to store the metrics in the iot measurement in InfluxDB. When using different data_format settings, this information may be received in the message payload.

You can learn more about Telegraf settings on the official website.

After changing settings, you should restart the Telegraf daemon with the following command:

systemctl restart telegraf

How to configure data visualization

Data visualization is performed by Grafana.

You can set up multiple dashboards and charts to suit your needs, please see this guide for help.

See Also