Skip to content

syedhassaanahmed/iot-simulator-influxdb

Repository files navigation

iot-simulator-influxdb

CI

Why?

Do not do in code what can be done in infrastructure

This is certainly not the first time ever that somebody needed to generate syntheric IoT telemetry for InfluxDB. Instead of writing code/scripts to achieve that goal, we can leverage existing tools to do the heavy lifting for us.

What?

This repo demonstrates how to simulate synthetic IoT telemetry and ingest it into InfluxDB OSS. The telemetry is generated using the Azure IoT Device Telemetry Simulator. The Simulator is capable of sending data to a Confluent Community Kafka broker. Telegraf is then used to consume the telemetry from Kafka and ingest it into InfluxDB. The entire flow is orchestrated using Docker Compose.

How?

  • docker compose up
  • Wait for the containers to be up and running and for log messages to confirm that telemetry is being sent.
  • Open http://localhost:8086 in the browser and login with the InfluxDB credentials specified in thhe .env file.
  • In the Influx Query Editor, try the following Flux query to visualize the raw data.
from(bucket: "ts-bucket") 
    |> range(start: -15m)

Configuration

  • All credentials are stored in the .env file.
  • To modify the telemetry payload, the env vars Template and Variables under the iot-telemetry-simulator service in docker-compose.yml can be used.
  • To configure the JSON parsing and Influx DB measurements, please modify telegraf.conf accordingly. A reference Telegraf config can be generated by executing
docker run --rm telegraf telegraf config > default-telegraf.conf

Smoke Test

To validate that the Simulator is working E2E, we can execute the script smoke-test.sh.

About

Simulate synthetic IoT telemetry and ingest into InfluxDB

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages