Using a variable within an influxDB node

Hi again, I'm trying to build a simple flow which will ping a set of IP addresses and send an alert if there is a failed ping.

Part of my flow will check influxdb but I need the 'measurement' to be variable. in the screenshot below, 'variable' needs to be the value of msg.ping.name but I can't work out how to do it.

I'm looking forward to any advice, thank you!

P.S I hope this is coherent enough. I'm very tired when writing this!

image

If you are using node-red-contrib-influxdb you can specify the Measurement in msg.measurement. Alternatively use a Template node to build the query and pass that in.

Hi, yes I am and I've used msg.measurement for the influxdb OUT which works great, but the influxdb IN seems to work in a completely different way where it needs a query text (see screenshot)

msg.measurement doesn't work. on the IN node sadly.

I'v tried setting up the below template, and then deleting all the query from the InfluxDB IN node, but I get a 'no query' error.

Just a little update. I've manmaged to work out how to use the template node to pass the query over (The little tip about using msg.query only showed up when I deleted all of the existing query) so I'm a lot closer! I've still not managed to pass the measurement variable in but I feel a lot closer. I'll update as I go.

SUCCESS! The syntax got me, but I'm still very new to this. Thanks for your help :slight_smile:

It is the fact you had msg.measurement that was the problem, not the triple braces.

the triple braces are because some names have none alphanumeric characters

Good point, you should indeed use triple braces.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.