ctrlX influxdb grafana nodered

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

MauroRiboniMX
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
Edit

It's now possible to use the official influxDB app with external memory support 📲. Scroll down to the end 🚀

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

ctrlX core InfluxDB and GrafanactrlX 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 grafanactrlX node-red-contrib grafana

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

InfluxDB nodesInfluxDB nodes

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 grafanactrlx InfluxDB node-red grafana

Step 0 - Use an external memory (Optional) 

When the influxDB (and thus memory) workload is high it is necessary to use an external memory to save influxDB data. Here there are the steps we need to follow: 

  1. Navigate no setting ➡️ storage and locate youre device
  2. Format the device as an Ext4 device otherwise it won't work correctly in the long term.
  3. Mount it, it will be automatically mounted at boot

mount sd card ctrlxmount sd card ctrlx

 Now we need to go to the "Manage app data" menu, save the archive and edit the influxdb config file. W need to change the bold path and engine path to use our device. Once the file is saved we just need to upload the configuration on the device and update it. 

archive modification memory externalarchive modification memory external

Here there is my file configuration example. usually mmcblk1p1 is for external microSD cards and sda1 stand for removable usb device. 

Influxdb ctrlX external memoryInfluxdb ctrlX external memoryNOW REBOOT!!!

Step 1 - Setup influx

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

Welcome to InfluxDBWelcome to InfluxDB

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

Setup initial userSetup initial user

 Go to Data API Token:

API TokensAPI Tokens

Just copy and keep secret the autogenerated token:

API TokensAPI Tokens

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?

Data ExplorerData Explorer

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:

Data sourcesData sources

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

ctrlX setup ctrlx grafana fluxctrlX setup ctrlx grafana flux

ctrlx setup grafana InfluxDBctrlx setup grafana InfluxDB

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

ctrlX setup grafana InfluxDB tokenctrlX setup grafana InfluxDB token

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

ctrlx grafana new dashboardctrlx grafana new dashboard

ctrlx grafana new dashboardctrlx grafana new dashboard

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

InfluxDB ctrlx grafanaInfluxDB ctrlx grafana

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

ctrlx InfluxDB2 queryctrlx InfluxDB2 query

grafana ctrlx first dashboardgrafana 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 noderedsimple 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.3ctrlx 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:

Data sourcesData sourcesImportant! keep InfluxQL as Query language! and setup the url like this!

ctrlX setup grafana InfluxDBctrlX 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 InfluxDBctrlx setup grafana InfluxDB

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

ctrlx grafana new dashboardctrlx grafana new dashboard

ctrlx grafana new dashboardctrlx grafana new dashboardNow we just need to select what we would like to see, it's far more easy in this case!

ctrlx grafana dashboardctrlx grafana dashboard

 

9 Comments
TN_X
Established Member

Very interesting!

Is it possible to share with me the InfluxDB & Grafana App?

Thanks

XuanLuo
New Poster

It's very useful for me!

But I can't get the Grafana App. Could you please share it with me? Or just tell me how can I get it.

Thanks

StefanH
Community Moderator
Community Moderator

Dear @XuanLuo ,

ctrlX IoT Dashboard will be available with the march release of ctrlX AUTOMATION. IoT Dashboard app is based on Grafana.

Regards

bschmidt
New Contributor

Thank you for this info! It is great to learn how to configure InfluxDB to use microSD for storage, as the on-board memory is limited and there is no setting in the InfluxDB web-UI for this.

CHH
Member

Great guide!! thank you.

But when trying to access the InfluxDB 2.x web UI, i get the following error:
404 – Page not found. There is no page available under the path /influxdb

CHH_0-1680624791907.png

I installed the app on a virtual ctrlx.

Can you please advise me on how to solve this issue? thank you in advance.

MauroRiboniMX
Contributor

You have to use the last version of the ctrlX core software!!

chockalingam
Member

Great How-To tutorial guide. Thank you!

Usalas
Established Member

Hi All,

when we have the data base set up as external, the restore process does not work. i believe that the backup process does not include the SD card data and configuration that InfluxDB set up there. is this accurate? if so, how can we include those InfluxDB set up files from the SD card into the backup and be able to restore it to the SD card.

any suggestions?

 

Thanks

stefanAT_ctrlX
New Contributor

I could not format my new SD-Card with the CORE (EXT4 format). I hade to format it before on my notebook to the exFAT Format and then I could format it in the ctrlX CORE with the EXT4 format. Runs well 👍.

Must Read
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