How to define host ip on one place while using it in mulpiple nodes

Hoi

I am looking for a solution for defining the host IP in one place (one node) while using it in multiple nodes.
I have an SNMP box with relays. For each relay, that IS snmp call with consist of the IP address. Due to DHCP the IP address changed no I need to change it om 60 nodes, that pain full. how to solve this. possible some can give me an example

thanks

by the way my node red is running on docker synology

Chris

One way to do this is via environment variables... but may depend on what the individual nodes accept in terms of their configuration.

This also assumes you're on Node-RED 3.1 (or maybe 3.0... )

  1. Under the main settings menu in the editor, thre is an 'Environment' tab. Under that, add a new Global Environment Variable called MY_IP (or whatever you want to call it...) with the value set to the desired ip address.

  2. In the individual nodes, you can then use ${MY_IP} in place of the ip address. Note this will only work if you are setting the whole value via the env var. You cannot do something like ${MY_IP}/foo. It is also possible individual nodes may have particular validation enabled that doesn't like this because it doesn't "look" like an IP address.

With all those caveats aside, when you deploy, the runtime will automatically insert the value of the env var into each node's configuration. If you want to change it, you just have to change it in the Environment tab under settings.

Note that it is also possible to set these env vars against individual tabs, or groups in the editor - there's a properties tab in their edit dialog where they can be set.

oke, i see i run some old node red instance 2.1.4 and and even 1.2.2 hoop dat upgrade to the 3.0 version will not bring me in issue where nodes are not supported :slight_smile: pffff first to see how to upgrade my docker version. Thanks for your quick replay

@knolleary Thanks, I was able to upgrade and implement your suggestion. It did the job; there are great new things in this version. now still upgrading my remote pi with the 1 version :wink: but will dod that when I am on location.

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