New flow: input validation for InfluxDB

Hi all, another day, another - hopefully helpful - flow.

InfluxDB: input validation function for influxdb-out (flow) - Node-RED

This is a simple function node designed to validate data that you want to store in InfluxDB via the influxdb-out node from node-red-contrib-influxdb.

The structure of data for InfluxDB can be rather confusing. While influxdb-out makes it simpler, the instructions could be clearer. Because putting the wrong type of data or using the wrong structure when outputting can be hard to fix due to the way that InfluxDB works, it is much easier to validate things before they get there.

The flow comes with a bunch of test inputs to help you understand the data and potential issues (and they let me test the function).

Let me know if there are any errors or you would like something else added to the function.

3 Likes

Julian, does it cover v1.0 and V2.0?

No, it currently only covers 1.x as that is all I use. I've looked at moving to v2 twice now and each time, I realise that there is too much to take into account and to have to deal with manually. Hopefully they will come up with a better migration path at some point and then I can think about transitioning. Until then, I'll start to try and use the v2 API's and Flux language. The returned data from Flux though is a nightmare. They have the cheek to label it as CSV but really that isn't true at all. You certainly shouldn't run it through the Node-RED CSV node.

I have some other example flows that I will share at some point where I've been investigating the use of Flux. But those are still against a v1.8 db. I've also been looking at the v2 API's (which work with v1.8). Again, I will share something when I have a better set of tests.

I would actually like to avoid the use of node-red-contrib-influxdb if I can and would prefer to write direct to the API's.

I also did some tests using the influx command line tool and the exec node. Mostly I've been trying to create some standard query and create commands because I always forget how I've got things set up. As I'm working on my next-gen home automation system, I thought this was the best time to create some flows that will create/recreate my standard dbs, CQs, RPs, and measures.

v2 API tests:

v1.x API tests:

The function nodes in the above flows process the output into something more Node-RED'ish.

I also need to do an equivalent set of tests using node-red-contrib-influxdb for comaprison.

1 Like

I did, a couple of weeks back start messing about with V2. I managed to decipher the scheme for writing and reading using node-red-contrib-stackhero-influxdb-v2.
I have left it for the time being as I have no real need of V2 at the moment.
I must say that the Flux syntax, which seemed daunting at first, proved to be relatively instinctive to use.

To be honest, up to now, I've not queried anything back to Node-RED, all my queries have been done in Grafana. Data goes from NR to InfluxDB but not the other way around :smiley:

But while I was looking at the details, I thought it best to create some examples so that should I want to do things in the future, I can start from an example instead of having to scratch my head for a week.

As it is, I'm forever having to work back through how I've got InfluxDB set up. This time, I've got the commands recorded in flows so I can just look at them. But then this will be my 3rd generation of InfluxDB settings so I ought to be getting things more sorted by now!

2 Likes

node-red-contrib-influxdb is supposed to cope with V2 now, though I have not tried it.

1 Like

Yes Colin, just after I had got the other node working they introduces V.2 support. I haven't tried it yet.