Node-RED, InfmuxDB and Grafana for IoT Sebastian Bttrich, IT - - PowerPoint PPT Presentation

node red infmuxdb and grafana for iot
SMART_READER_LITE
LIVE PREVIEW

Node-RED, InfmuxDB and Grafana for IoT Sebastian Bttrich, IT - - PowerPoint PPT Presentation

Node-RED, InfmuxDB and Grafana for IoT Sebastian Bttrich, IT University of Copenhagen ICTP T rieste, 20180502 sebastian@itu.dk 1 Motivation To get from sensor node (lopy or any other) to managed data fmows (Node-RED)


slide-1
SLIDE 1

Node-RED, InfmuxDB and Grafana for IoT

Sebastian Büttrich, IT University of Copenhagen ICTP T rieste, 20180502 sebastian@itu.dk

· 1

slide-2
SLIDE 2

Motivation

5/3/18 · 2

To get from

  • sensor node

(lopy or any other) to

  • managed data fmows

(Node-RED)

  • storage

(InfmuxDB)

  • visualization / analysis / interaction

(Grafana)

  • Three strong Open Source T
  • ols
slide-3
SLIDE 3

Agenda for this talk

5/3/18 · 3

  • Introduce the three elements
  • Show them in live demo

and - for those who are hungry - Ofger you a guide on installing these yourself. Two things i will be using though we will only cover them later this week:

  • MQTT
  • The Things Network
slide-4
SLIDE 4

MQTT

5/3/18 · 4

MQTT is a lean and fast publish/subscribe messaging protocol running on top of TCP/IP (more tomorrow!)

slide-5
SLIDE 5

The Things Network /1

5/3/18 · 5

  • The Things Network is a global movement, a kind of

“The people’s Internet of Things”.

  • Open source
  • Free ... to set up and run their own, in particular:

Anyone who perpetrates a "Things Access" or a "Things Gateway" will do so free of charge for all connecting devices and servers. This to some degree explains our current interest in TTN, in an educational context.

Source, Details: https://github.com/TheThingsNetwork/Manifest

slide-6
SLIDE 6

The Things Network /2

5/3/18 · 6

  • The Things Network is a global movement, a kind of

“The people’s Internet of Things”.

  • It’s one possible choice when doing LoRaWan.
  • It’s Open source, you are free ... to set up and run their own, in

particular:

Anyone who perpetrates a "Things Access" or a "Things Gateway" will do so free of charge for all connecting devices and servers.

Source, Details: https://github.com/TheThingsNetwork/Manifest

slide-7
SLIDE 7

The Things Network /3

5/3/18 · 7

slide-8
SLIDE 8

Overview /1

5/3/18 · 8

slide-9
SLIDE 9

Overview /2

5/3/18 · 9

Roles

slide-10
SLIDE 10

Overview /3

5/3/18 · 10

Network

slide-11
SLIDE 11

Overview /4

5/3/18 · 11

Locations

slide-12
SLIDE 12

Overview /5

5/3/18 · 12

Freedom Of Choice

slide-13
SLIDE 13

Node-RED /1

5/3/18 · 13

Node-RED is a graphical tool for wiring together hardware devices, APIs and online services in new and interesting ways. It provides a browser-based editor that makes it easy to wire together fmows using the wide range of nodes in the palette that can be deployed to its runtime in a single-click. Built on Node.js

slide-14
SLIDE 14

Node-RED /2 principle

5/3/18 · 14

nodes ……………………. fmows

slide-15
SLIDE 15

Node-RED /3 nodes

5/3/18 · 15

Examples of existing nodes: Input/Output: tcp, udp, http, mqtt, ttn, ... debug, status, inject, link, trigger Functions: logic, analytics Storage: e.g. databases Social: e.g. tweet, mail You can write your own nodes! It is a bit like a DJs patchbay.

slide-16
SLIDE 16

Node-RED /4 node confjg

5/3/18 · 16

Nodes are confjgured by double-clicking and editing the necessary info, e.g. MQTT topics, http URLs, TheThingsNetwork applications and security keys

slide-17
SLIDE 17

Node-RED /5 adding nodes

5/3/18 · 17

You may add nodes, e.g. the ttn node, https://fmows.nodered.org/node/node-red-contrib-ttn via the command line, like so: $ npm install node-red-contrib-ttn Or you can go to the node-RED menu ==> and then ...

slide-18
SLIDE 18

Node-RED /6 adding nodes

5/3/18 · 18

Use the palette manager to fjnd and install new nodes, in this example, A serial port node to read direct input over USB serial

slide-19
SLIDE 19

Node-RED /7 node confjg ttn

5/3/18 · 19

Example of a TTN node:

slide-20
SLIDE 20

Node-RED /8 fmows

5/3/18 · 20

Flows are combinations of inputs, outputs, connections, Actions, etc which you can share and reuse. e.g. receive sensor messages, do calculations on the values, keep averages or deltas, put them in a database, trigger an actuator , and inform the owner via messages.

slide-21
SLIDE 21

Node-RED /9 text

5/3/18 · 21

While this is a graphical tool, behind the scenes it s all text fjles which you can access via shell, edit, export, import, ...

slide-22
SLIDE 22

InfmuxDB /1

5/3/18 · 22

InfmuxDB is an open-source time series database developed by InfmuxData. It is written in Go and optimized for fast, high-availability storage and retrieval of time series data in fjelds such as operations monitoring, application metrics, Internet of Things sensor data, and real-time analytics. Open Source: Each component (except for some …) of the InfmuxData platform or TICK Stack is on github and available via a simple download. The company Infmuxdata is venture funded.

slide-23
SLIDE 23

InfmuxDB /2

5/3/18 · 23

SQL-like language with builtin time-centric functions for querying a data structure composed of measurements, series, and points. Each point consists of several key-value pairs called the fjeldset and a

  • timestamp. When grouped together by a set of key-value pairs called the

tagset, these defjne a series. Finally, series are grouped together by a string identifjer to form a measurement.

measurement(,tag_key=tag_val)* field_key=field_val(,field_key_n=field_value_n)* (nanoseconds-timestamp)

Values can be 64-bit integers, 64-bit fmoating points, strings, and booleans.

slide-24
SLIDE 24

InfmuxDB /3

5/3/18 · 24

Main difgerences to a classical SQL database or NoSQL database: It s for time series - nothing else! A "table" (called measurement here) has 2 “columns”, not more *: a timestamp and the value for that point in time. (You can add optional “tags” to create some structure). You would not keep an address database or such in InfmuxDB.

* it s actually possible, but not advised to do so: https://stackoverfmow.com/questions/45368535/infmuxdb-single-or-multiple- measurement#45545405

slide-25
SLIDE 25

InfmuxDB /4 look inside: the shell: show databases

5/3/18 · 25

InfluxDB shell 0.10.0 > show databases name: databases

  • name

_internal pit001 pit002 pit003

slide-26
SLIDE 26

InfmuxDB /5 look inside: the shell: show measurements

5/3/18 · 26

> use pit001 Using database pit001 > show measurements name: measurements

  • name

003-01-light 003-01-moist 003-01-temp 003-02-light

slide-27
SLIDE 27

InfmuxDB /6 look inside: the shell: select

5/3/18 · 27

> select * from "004-01-temp" 1525096049108783758 50 1525096124247923458 49 1525096199476486703 49 1525096274435089220 50 1525096349502370874 50 1525096424982100010 50 1525096499794455963 49

slide-28
SLIDE 28

InfmuxDB /6 look inside: the shell: create database

5/3/18 · 28

> CREATE DATABASE MyNewDatabase >

slide-29
SLIDE 29

InfmuxDB /6 look inside: the shell

5/3/18 · 29

> select * from "004-01-temp" 1525096049108783758 50 1525096124247923458 49 1525096199476486703 49 1525096274435089220 50 1525096349502370874 50 1525096424982100010 50 1525096499794455963 49

slide-30
SLIDE 30

InfmuxDB /7 access

5/3/18 · 30

T ypically, you would access data via network rather than direct - InfmuxDB accepts data via HTTP , TCP , and UDP. For example you could connect from ….

slide-31
SLIDE 31

Grafana /1

5/3/18 · 31

Visualizing, Monitoring, Analyzing, Querying, Alerting As of right now, there are 41 data sources, 30 panels, 17 apps and 857 dashboards available. Data sources include: infmuxDB, MySql, Postgres, Azure, ...

slide-32
SLIDE 32

Grafana /2

5/3/18 · 32

slide-33
SLIDE 33

Grafana /1

5/3/18 · 33

Dashboards, Graphs, Queries: Setting up a new one is mainly click, drag and drop.

slide-34
SLIDE 34

Grafana /4

5/3/18 · 34

Alerts let you defjne fmexible alert conditions and may trigger emails, telegram messages, slack messages, ...

slide-35
SLIDE 35

Node-RED, Grafana & Infmux demo

5/3/18 · 35

slide-36
SLIDE 36

Installing your own

5/3/18 · 36

slide-37
SLIDE 37

Installing your own

5/3/18 · 37

  • While a server is the preferred place for these, you can do a demo on

your laptop or on a Raspberry Pi or such.

  • Our guide is at

https://github.com/ITU-PITLab/public/blob/master/TheThingsNetwork+node-red+infmuxdb+grafana.md

It mainly links to guides on the websites of TTN, Node-RED, infmuxdb and Grafana, and adds a few tips and hints.

  • It is targeted at Debian/Ubuntu – installation on other operating

systems is a bit difgerent – check this and the links therein:

https://www.thethingsnetwork.org/labs/story/store-and-visualize-data-using-infmuxdb-and-grafana and use your search engine, e.g. with query like “Infmuxdb installation Windows”

slide-38
SLIDE 38

Installing your own

5/3/18 · 38

For the impatient, here s the short version:

# Installation / commands summary (Debian/Ubuntu) // Node-RED # apt-get install nodejs (<<< or nodejs-legacy) # nodejs -v ( or: node -v) # apt install npm # npm install -g --unsafe-perm node-red (start with) # node-red // Infmux # apt-get install infmuxdb infmuxdb-client (test with) # infmux // Grafana # wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_5.1.0_amd64.deb # sudo dpkg -i grafana_5.1.0_amd64.deb # service grafana-server start

```

slide-39
SLIDE 39

Thank you!

5/3/18 · 39

  • Contact me via

sebastian@itu.dk