Mistake on this page? Email us

Set up and run

  1. Create an access key.

  2. Add your Device Management access_key to webapp/settings/development.py.

  3. Download the mbed_cloud_dev_credentials.c file from Device Management Portal.

  4. Add your mbed_cloud_dev_credentials.c file to the mbed-cloud-client-example directory.

  5. Run the following in the root of your project:

    docker-compose build
    docker-compose up --scale linux_client=3

    This spins up four items:

    • Three Linux client instances, each generating a data stream simulating a product on a shelf.
    • The proxy web application for pushing the data stream from Device Management to InfluxDB.
    • An InfluxDB instance.
    • Grafana, where all the data aggregation and visualization happens.
  6. To use Grafana to configure a visualization platform for analytics, go to http://localhost:3001. The login credentials are admin, admin.

    • To add the Influx DB data source, select InfluxDB from the dropdown list.

      • URL: http://influxdb:8086. Docker automatically handles the resolution from InfluxDB to its URL according to its label in the docker-compose script.
      • DB: example
      • Username: root
      • Pass: root
    • To add a dashboard:

      1. Create a graph.
      2. Select edit on the graph title.
      3. Go to metrics and add the following:
        • FROM: default product_count
        • SELECT: field(count) count() non_negative_difference()
        • GROUP BY: time(1s) tag(product_id) fill(previous)
        • ALIAS BY: $tag_product_id

This metric determines the level of product activity by first counting the number of interactions with a product (product taken, product returned) in a one-second interval. This is useful in understanding how much activity a particular shelf has. Additionally, computing the non-negative difference between the values gives insight into how consistent they are, and roughly translates to the velocity of product activity on a shelf.

Shutting down the application

Shut down the application with Ctrl-Z and either:

  • Bring down the docker containers in the working directory with docker-compose down.

  • Destroy the containers and delete persistent storage of saved TSDB values with docker-compose down -v.