This project implements a cloud-based solution for handling CoAP data. The server listens for CoAP data, writes it into an InfluxDB database, and visualizes the data using Grafana. The implementation utilizes Docker for easy deployment, and the entire system can be deployed on an AWS EC2 instance.
Create an EC2 Instance
Assign a Public IPv6 Address
Configure Inbound Rules for CoAP
In the Security Group settings, add an inbound rule for UDP at port 5683 for IPv6.
Type: Custom UDP Rule
Protocol: UDP
Port Range: 5683
Source: ::/0
This allows incoming UDP traffic on port 5683 from any IPv6 address.
[!CAUTION] Note for Testing: For testing purposes, all IPv6 addresses are allowed (::/0). In a production environment, consider limiting access by applying a range of IPs.
Configure Inbound Rules for Grafana
Add an inbound rule for TCP at port 3000 for IPv4.
Type: Custom TCP Rule
Protocol: TCP
Port Range: 3000
Source: 0.0.0.0/0
This allows incoming TCP traffic on port 3000 from any IPv4 address.
[!CAUTION] Note for Testing: For testing purposes, all IPv4 addresses are allowed (0.0.0.0/0). In a production environment, consider limiting access by applying a range of IPs.
Install InfluxDB and Grafana
Start Grafana
Start Grafana:
sudo systemctl enable grafana-server
sudo systemctl start grafana-server
Access Grafana through http://<public-ip>:3000/
.
admin
admin
Start InfluxDB
Start InfluxDB:
sudo service influxdb start
Clone the Repository
git clone <repository_url>
cd <repository_directory>/src/server
Build and Deploy the CoAP Server
./deploy.sh --mode server
This script builds the CoAP server Docker container and deploys it. It also starts Grafana and InfluxDB if the mode is set to all
.
Access Grafana Dashboard
http://<public-ip>:3000/
.Add InfluxDB Data Source
Configure InfluxDB Connection
Set the following parameters:
http://localhost:8086
.Database name
, Username
, Password
. (This need to be defined in the configuration.py file).Click on “Save & Test” to verify the connection.
Create a Dashboard
Query InfluxDB for Time-Series Data
In the “Query” tab, set the measurement and field to visualize from your InfluxDB database.
temperature
.value
.Set the time range to view your time-series data.
This will setup the Grafana dashboard visualizing time-series data from your InfluxDB database.
dht
temperature