This repository contains a collection of Dockerized services and scripts to simulate, collect, store, and visualize IoT data. The architecture includes an MQTT broker, an InfluxDB database, Telegraf for data ingestion, Grafana for visualization, and a Python-based IoT simulator.
✅ IoT Simulator generates data → ✅ MQTT distributes it → ✅ Telegraf processes it → ✅ InfluxDB stores it → ✅ Grafana visualizes it 🚀
- Overview
- Architecture
- Setup
- Files and Descriptions
- Usage
- Grafana Dashboard Provisioning
- InfluxDB Setup
- Contributing
- License
This system simulates IoT devices using MQTT, stores the data in InfluxDB, and visualizes it in Grafana. The setup includes:
- MQTT Broker: For IoT device communication.
- InfluxDB: Time-series database for data storage.
- Telegraf: Intermediary for ingesting MQTT data into InfluxDB.
- Grafana: Visualization and monitoring platform.
- IoT Simulator: Python script to simulate IoT devices sending data to the MQTT broker.
The architecture consists of the following containers and services:
- MQTT Broker: Based on Eclipse Mosquitto.
- InfluxDB: Stores IoT data like temperature, pressure, etc.
- Telegraf: Bridges MQTT and InfluxDB.
- Grafana: Visualizes data using dashboards.
- IoT Simulator: Python script to generate dummy IoT data.
- Docker and Docker Compose installed on your machine.
- Clone the repository:
git clone https://github.com/georgevio/SensoGraf.git cd SensoGraf - Build and start the Docker containers:
docker-compose up -d
- Access Grafana at
http://localhost:3000(default username/password:admin/admin). - Grafana is pre-configured to connect to InfluxDB using automatic provisioning.
Defines the Docker services:
- MQTT Broker: Uses
eclipse-mosquittowith ports1883and9001exposed. - InfluxDB: Stores IoT data; accessible at port
8086. - Telegraf: Configured to consume MQTT data and write to InfluxDB.
- Grafana: Visualization platform with pre-configured dashboards.
- IoT Simulator: Python-based data simulator.
Configuration file for the MQTT broker (Eclipse Mosquitto).
Telegraf configuration file to define MQTT input and InfluxDB output.
Python script to simulate IoT data:
- Publishes random sensor data (e.g., temperature, pressure) to the MQTT broker.
- Configurable sensor types and publishing frequency.
To ensure Grafana dashboards are automatically set up, provisioning is used.
-
Preconfigured Data Source:
- Stored in
grafana/provisioning/datasources/influxdb.yml - Example Configuration:
apiVersion: 1 datasources: - name: InfluxDB type: influxdb access: proxy url: http://influxdb:8086 database: iot_data isDefault: true
- Stored in
-
Predefined Dashboard:
- Export your existing dashboard from Grafana.
- Save it as
grafana/provisioning/dashboards/iot_dashboard.json - Create a provisioning file:
apiVersion: 1 providers: - name: 'IoT Dashboard' folder: '' type: file options: path: /etc/grafana/provisioning/dashboards/iot_dashboard.json
-
Modify
docker-compose.ymlto Include These Filesvolumes: - ./influxdb.yml:/etc/grafana/provisioning/datasources/influxdb.yml - ./iot_dashboard.json:/etc/grafana/provisioning/dashboards/iot_dashboard.json - ./dashboard.yml:/etc/grafana/provisioning/dashboards/dashboard.yml
InfluxDB is automatically pre-configured using environment variables.
Modify the Docker configuration to auto-create the iot_data database:
influxdb:
environment:
- INFLUXDB_DB=iot_dataOnce the system is up, check:
- Go to Grafana → Configuration → Data Sources.
- Ensure InfluxDB is connected.
- Load dashboards.
-
Start the System: Use Docker Compose to start all containers:
docker-compose up -d
-
Simulate IoT Devices: The
iot_data_simulator_mqtt.pyscript automatically starts and pushes data to the MQTT broker. -
View the Data:
- Log in to Grafana at
http://localhost:3000. - The IoT Dashboard will be preloaded automatically.
- Log in to Grafana at
Contributions are welcome! Please fork the repository and create a pull request with your changes.
This project is licensed under the MIT License. See the LICENSE file for details.
The system is automated—Grafana automatically loads dashboards, InfluxDB creates the necessary database, and all services connect seamlessly.

