ctrlX influxdb grafana nodered

IIoT: Use ctrlX CORE as a monitoring platform using InfluxDB and Grafana

MauroRiboniMX
New Contributor
The Goal

One of the most  requested IIoT feature of a machine is the capability to manage, store and visualize data. There are many ways to achieve this result, one of the best ways to achieve this goal is to combine three apps:

  • NodeRed: for connectivity
  • InfluxDB: data storage
  • Grafana: Simple and standard HMIs

Let's see together how we can setup a basic example. 

ctrlX core InfluxDB and Grafana

 

Which data?

The data are coming usually from Ethecat, Opcua or third part devices here there is a brief list which will be updated:

Two ways

There are two possible configurations: 

  1. InfluxDB 2.x + Grafana + NodeRed 
  2. INfluxDB 1.8.3 + Grafana + NodeRed

There are not many differences, InfluxDB 2.0 it's an official ctrlX AUTOMATION app equipped with all the safety and platform features needed to setup reliable IIoT system. The only advantage in using InfluxDB 1.8.3 is the possibility to use the Grafana Auto-Complention features which can save some time. Chose the one you prefer considering that only the number 1 is the full supported by Rexroth.

Step 0 - Valid for both solutions

The first step in both cases is to setup NodeRed correctly how: 

  1. install NodeRed
  2. connect ctrlX CORE to internet and check that the system clock is correctly set
  3. download the InfluxDB palette as shown in the picture

 

ctrlX node-red-contrib grafana

 

If everything goes stright we should find these three new nodes on the left:

MauroRiboniMX_1-1669053803506.png

 

 

Setup 1 - Productivity

 

What we need to install is: 

  • InfluxDB 2.x
  • Grafana

In the end the sideboard should look like this: 

ctrlx influxdb node-red grafana

 

Step 1 - Setup influx

Go to the influx page clicking the icon on the left:

MauroRiboniMX_1-1669054190094.png

 

Setup the Initial use and the first Bucket, in this guide we just use boschrexroth as anything:

MauroRiboniMX_2-1669054251159.png

 

Go to Data API Token:

MauroRiboniMX_3-1669054339563.png

Just copy and keep secret the autogenerated token:

MauroRiboniMX_4-1669054398947.png

we're done here! Let's move forward!

Step 2 - Setup Node-Red

Load the example in NodeRed and open up the InfluxDB node!

MauroRiboniMX_0-1669063648500.png

Be sure to parametrize the node as follow: 

MauroRiboniMX_1-1669063706647.png

In the server configuration is important to insert the token created before and insert the right URL:

MauroRiboniMX_2-1669063745008.png

But.. What does this example do? It's simple, basically creates a set o three random values that are then joined together to create a set of values loaded inside InfluxDB. 

MauroRiboniMX_3-1669063829201.png

If we come back to InfluxDB and we select Explore, boschrexroth, Drive1 (the default measurement), all the fields and finally apply we can see the data flowing inside the database!! great no?

MauroRiboniMX_4-1669063974179.png

Step 3 - Connect Grafana

We're almost done, we just need to connect Grafana. Nothing more simple! Lets do it!

Just open up Grafana, login with admin as user and admin as password then move to settings and then Data sources:

MauroRiboniMX_0-1669064246549.png

 

Select obviously InfluxDB then in the configuration Flux as query language.

ctrlX setup ctrlx grafana flux

ctrlx setup grafana influxdb

 

The rest of the configuration is just like the NodeRed node! The click save and test!

ctrlX setup grafana influxdb token

Ok almost done, create the first dashboard and then click the "add panel button": 

ctrlx grafana new dashboard

 

ctrlx grafana new dashboard

 

 

Ok now the panel asks for a query don't go mad.. Work smart not Hard!!

influxdb ctrlx grafana

Go back inside InfluxDB and open up the script editor, copy the query inside the panel and save!

ctrlx influxdb2 query

 

grafana ctrlx first dashboard

First Panel completed!!

 

Setup 2 - Alternative (not official)

What we need to install is: 

  • InfluxDB 1.8.3
  • Grafana

In the end the sideboard looks like this:

simple ctrlx apps grafana nodered

By default InfluxDB 1.8.3 has no frontend so, there is no icon on the sidebar.

Step 1 - Setup influx and NodeRed

How? load up the NodeRed example and deploy it!

 ctrlx influxdb  1.8.3

What is happening? 1 si creating the database trough REST API 2 is setting up  a proper retention policy and 3 is creating random data!

Step 2 - Setup Grafana

ust open up Grafana, login with admin as user and admin as password then move to settings and then Data sources:

MauroRiboniMX_0-1669064246549.png

 

Important! keep InfluxQL as Query language! and setup the url like this!

ctrlX setup grafana influxdb

 

This setup has not security active, use the firewall app to protect InfluxDB! Insert drivedata as database (the example creates this automatically).

ctrlx setup grafana influxdb

 

Ok almost done, create the first dashboard and then click the "add panel button": 

ctrlx grafana new dashboard

 

ctrlx grafana new dashboard

 

Now we just need to select what we would like to see, it's far more easy in this case!

ctrlx grafana dashboard

 

SMALL NOTE

The same example is working on both ctrlX CORE and ctrlX VIRTUAL. If we want to access to InfluxDB from the external (and this is mandatory for case 1) whr should add this routing rule if we run in the "port forwarding" mode.

ctrlX virtual rules influxdb

 

 

Must Read

3 Comments

Trending

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist