A Docker-based IoT monitoring system that combines MQTT messaging, InfluxDB time-series database, and Grafana visualization for real-time data collection and monitoring.
The system consists of the following components:
- MQTT Broker (Eclipse Mosquitto)
- InfluxDB time-series database
- MQTT Publisher (Java-based)
- MQTT to InfluxDB Scrapper
- Grafana dashboard
- Docker and Docker Compose
- Java Development Kit (JDK) for building custom images
- Git
- Clone the repository
- Create the following secret files:
.env.influxdb2-admin-username
.env.influxdb2-admin-password
.env.influxdb2-admin-token
- Configure environment variables in
.env
file - Build the custom Docker images:
docker build -t mqtt-pub-java:latest ./mqtt-publisher docker build -t mqtt-influx-scrapper:latest ./mqtt-scrapper
- Start the services:
docker-compose up -d
Variable | Description | Default Value |
---|---|---|
INFLUXDB_ORG | InfluxDB organization name | pathvariable |
INFLUXDB_BUCKET | InfluxDB bucket name | smartgarden |
GRAFANA_USER | Grafana admin username | admin |
GRAFANA_PASSWORD | Grafana admin password | adminpassword |
MQTT_TOPIC | MQTT topic to subscribe/publish | nursery |
INFLUXDB_TOKEN | InfluxDB authentication token | MyInitialAdminToken0== |
- Port: 1884 (external), 1883 (internal)
- Anonymous access enabled
- Persistent storage for messages and logs
- Port: 8086
- Secured with username/password
- Data and config persistence
- Port: 3001 (external), 3000 (internal)
- Pre-configured with InfluxDB data source
- Customizable dashboards
- Access Grafana at
http://localhost:3001
- Login with credentials from environment variables
- Configure InfluxDB data source if not auto-configured
- Create dashboards to visualize your IoT data
- IoT devices publish data to MQTT broker
- MQTT Scrapper subscribes to topics and forwards data to InfluxDB
- Grafana queries InfluxDB and displays data in dashboards