https://github.com/riflowth/mqtt-playground
CPE314 Computer Network MQTT Project
https://github.com/riflowth/mqtt-playground
grafana influxdb mqtt pubsub
Last synced: 8 days ago
JSON representation
CPE314 Computer Network MQTT Project
- Host: GitHub
- URL: https://github.com/riflowth/mqtt-playground
- Owner: riflowth
- Created: 2023-02-27T11:17:30.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-09T15:20:37.000Z (about 2 years ago)
- Last Synced: 2025-03-30T04:51:15.232Z (about 1 month ago)
- Topics: grafana, influxdb, mqtt, pubsub
- Language: Go
- Homepage:
- Size: 5.58 MB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MQTT Project
> This is a part of CPE314 Computer Networks project for learning/practicing about the MQTT## Prequisite
- **[GO](https://go.dev/) 1.19**
- **[Docker](https://www.docker.com/)**
- **Make**
- *For window: GNU make, MinGW*## Architecture
- **Broker**, we use broker implementation from [mochi-co/mqtt](https://github.com/mochi-co/mqtt/)
- **Subscriber** and **Publisher**, we implemented by [esclipe/paho.mqtt.golang](https://github.com/eclipse/paho.mqtt.golang) with GO
- **Database**, we use [influxdb](https://www.influxdata.com/) (time-series database)
- **Visualization**, our visualization dashboard on [grafana](https://grafana.com/)## Getting Started
1. Run **InfluxDB** for storing sensors data and **Grafana** for visualize the data on Docker by using the command below on your terminal:
```bash
cd ./.docker
docker compose up -d
```
*(grafana) http exposed at port 4000*
> default username `admin` default password `admin`*(influxdb) http exposed at port 8086*
> default username `admin` default password `adminadmin`2. Build broker/publisher/subscriber by just typing:
```bash
make build
```3. Run broker from built output directory:
- Required flags:
- `port`: port of broker to exposed
```bash
./dist/broker --port 1883
```1. Run subscriber:
- Required flags:
- `id`: unique id to identify the subscriber
- `topic`: topic to subscribe
- `hostname`: hostname to subscribe to the broker
- `influx-token`: token for authenticate to influxDB
- `influx-org`: org name for influxDB
- `influx-bucket`: bueckt name to connect to influxDB
- `influx-hostname` hostname to connect to influxDB
- Example:
```bash
./dist/sub --id sub-1 --topic hello-world --hostname localhost:1883 --influx-token "tokentoken" --influx-org admin --influx-bucket mqtt --influx-hostname http://localhost:8086
```1. Run publisher:
- Required flags:
- `id`: unique id to identify the publisher
- `topic`: topic to publish
- `hostname`: hostname to publish to the broker
- `interval`: interval to publish the next message to the broker (second)
- Example:
```bash
./dist/pub --id pub-1 --topic hello-world --hostname localhost:1883 --interval 180
```1. *Chill with your coffee* ☕️
## Preview
### Dashboard
