Our infinimesh® platform is built to make data privacy and data ownership possible, without any doubt. To achieve this, we have built our platform in a cloud-native way and entirely API driven. It allows our customers to integrate our cloud into their systems without compromising IT Security or even move to a public cloud provider. We understand ourselves as a stretched workbench for any IoT related ideas our customers might have.

This blog post shows how easily infinimesh extends to an ultra-scalable time series, designed for high throughput and rapid prototyping, using the time series plugin from our GitHub space. Note that we use here Redis in the standalone mode. We urgently advise you to set up a Redis cluster if you want to run the plugin in production!

The plugin comes as a ready-to-ship docker container, including Redislab TimeSeries and Grafana to enable easy PoC and Hackathons.

To get it running, you need to have either a working docker environment or Kubernetes (likemicrok8s) installed. Of course, any cloud provider works, too. That is the beauty of cloud-native development.

Let’s get started:
1. Check out the plugin repository:

a. git clone https://github.com/InfiniteDevices/plugins.git

2. edit the docker-compose.yaml in timeseries:

USERNAME = YOUR INFINIMESH User
PASSWORD = YOUR INFINIMESH Password
API_URL = FQDN-API-Endpoint (ex: https://api.infinimesh.cloud)

3. Then run everything via:

docker-compose -f timeseries/docker-compose.yml --project-directory . up --build

After a few seconds, the connector and the time series backend are available, and infinimesh pushes data into:

docker-compose up –build
Creating network “grafana_default” with the default driver
Building server
Step 1/5 : FROM golang:1.15.6-alpine
—> 53efefffaa70
Step 2/5 : WORKDIR /go/src/app
—> Using cache
—> 337881896075
Step 3/5 : COPY . .
—> d93a37ff35cd
Step 4/5 : RUN go build -o main .
—> Running in 43773e4eccda
go: downloading github.com/RedisTimeSeries/redistimeseries-go v1.4.3
go: downloading github.com/gomodule/redigo v1.8.2
Removing intermediate container 43773e4eccda
—> 874e0e5b4ecd
Step 5/5 : CMD [“./main”]
—> Running in d0b5c50d5c01
Removing intermediate container d0b5c50d5c01
—> 9a2ae52d02e3
Successfully built 9a2ae52d02e3
Successfully tagged grafana_server:latest
Creating grafana_grafana_1 …done
Creating grafana_server_1 …done
Creating grafana_redis_1 …done
Attaching to grafana_server_1, grafana_grafana_1, grafana_redis_1
server_1 | 2020/12/06 11:22:27 refreshing account token…
server_1 | 2020/12/06 11:22:27 starting processor…
server_1 | 2020/12/06 11:22:27 refreshing devices…
redis_1 | 1:C 06 Dec 2020 11:22:27.837 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis_1 | 1:C 06 Dec 2020 11:22:27.837 # Redis version=6.0.9, bits=64,
commit=00000000, modified=0, pid=1, just started
redis_1 | 1:C 06 Dec 2020 11:22:27.837 # Configuration loaded
redis_1 | 1:M 06 Dec 2020 11:22:27.839 * Running mode=standalone, port=6379.
redis_1 | 1:M 06 Dec 2020 11:22:27.839 # Server initialized
redis_1 | 1:M 06 Dec 2020 11:22:27.840 * <timeseries> RedisTimeSeries version 10407, git_sha=8a4e4da70f2c6207434a128ad6f3f4268e2f9367
redis_1 | 1:M 06 Dec 2020 11:22:27.840 * <timeseries> Redis version found by RedisTimeSeries : 6.0.9 – oss
redis_1 | 1:M 06 Dec 2020 11:22:27.840 * Module ‘timeseries’ loaded from /usr/lib/redis/modules/redistimeseries.so redis_1 | 1:M 06 Dec 2020 11:22:27.841 * Ready to accept connections
grafana_1 | installing redis-datasource @ 1.2.1
grafana_1 | from: https://grafana.com/api/plugins/redis-datasource/versions/1.2.1/download
grafana_1 | into: /var/lib/grafana/plugins
grafana_1 |
server_1 | 2020/12/06 11:22:28 added time series item: object={0x13921 sma_inverterdevice} key=ac_realpower
server_1 | 2020/12/06 11:22:28 added time series item: object={0x13921 sma_inverter device} key=dc_inc_volt_A
server_1 | 2020/12/06 11:22:28 added time series item: object={0x13921 sma_inverter device} key=dc_input
server_1 | 2020/12/06 11:22:28 added time series item: object={0x13921 sma_inverter device} key=grid_current_ampere
server_1 | 2020/12/06 11:22:28 added time series item: object={0x13921 sma_inverter device} key=grid_phase_A
server_1 | 2020/12/06 11:22:28 added time series item: object={0x13921 sma_inverter device} key=apparent_power
server_1 | 2020/12/06 11:22:28 added time series item: object={0x13921 sma_inverter device} key=day_yield
server_1 | 2020/12/06 11:22:28 added time series item: object={0x13921 sma_inverter device} key=grid_freq
server_1 | 2020/12/06 11:22:28 added time series item: object={0x13921 sma_inverter device} key=grid_phase_B
server_1 | 2020/12/06 11:22:28 added time series item: object={0x13921 sma_inverter device} key=grid_phase_C

4. After some time, Grafana will be ready. Connect your browser tohttp://localhost:3000and follow the instructions to change the default admin credentials (admin/admin). Please note that the setup disappears when the docker container gets deleted.

The memory and CPU footprint shows that the plugin, which we used for this blog post, does not consume too many resources:

 

 

Dashboard

We have built a sample dashboard that can be easily imported. The sample dashboard shows all captured data in one graph. Feel free to use this as a starting point to create your powerful dashboards.

 

Add the Redis data source

Note: We provision in the newest container (build 77c68e4) redis as default data source – this step is not necessary anymore. 

When you login into Grafana the first time using an image prior to build 77c68e4, you have to add the data source by clicking:

 

Type “redis” into the search field:

 

and select this data source by clicking into it. The following shows the setup, just put redis://redis:6379 into the address field and click “save and test“:

Now Grafana can talk to the Redis time-series backend. You can now import the dashboard by Create -> Import -> Upload JSON File and select sample-dashboard.json from the directory in which you have synced the repository. You should now see the Dashboard:

 

All data we captured from the very beginning are displayed there. You can now start to explore Grafana and build awesome dashboards. With this approach, we also enable our customers to excel in rapid prototyping using infinimesh technology.

For example, here we selected some data points (pressing Ctrl + select the data point) to get fast insight into the data (this is the SMA solar plant):

 

Links:
Grafana: https://grafana.com/
Redislabs: https://oss.redislabs.com/redistimeseries/
Docker Desktop: https://www.docker.com/products/docker-desktop

Recommended Posts