Netdata Cloud on OpenWrt won’t work

Currently the netdata package does not connect to the cloud. It only works locally. I'm referring to this topic with an existing one on the NETDATA forum:

4 Likes

any updates on this?

bumping this...

I've had success connecting OpenWrt devices to Netdata cloud by having the OpenWrt device stream to a Netdata parent node which is connected to Netdata cloud.

would you mind explaining us how you did this, please?

Yeah, I set it up within the past month but it was pretty straight forward IIRC

Create Netdata cloud account.

For the Netdata parent node I didn't want to have to fuss with any container networking stuff because at the time I was just trying to figure out the Netdata stuff so on a one of my local Proxmox servers I spun up an Alma Linux VM. Let's say it's hostname=VM. Really you could use any hypervisor for the VM, and it could prob even be a container or bare metal, dealers choice. I have the VM's NIC is attached to the Proxmox bridge which connects to my main LAN (for which the router is the gateway).

When you configure Netdata streaming you can set the target to be either an IP address or a resolvable hostname. The router will need a way to consistently find VM so on the router I assigned a static dhcp lease and also added a matching FQDN domain entry to be safe.

Once I verified that DNS resolution was working and the router could ping VM I installed Netdata on VM. I used the one-liner from app.netdata.cloud that includes the Netdata claim token and room ID needed to connect the installation to my netdata.cloud instance. You might need to enable and start the SystemD netdata.service and add firewall rules allowing tcp/udp on port 19999. If everything is set up right you should be able to see VM Netdata metrics from app.netdata.cloud. I just configured VM Netdata for streaming

Then I installed Netdata on the router via opkg. Once I configured Netdata streaming pointing at VM and restarted netdata service I was able to see routers metrics from app.netdata.cloud.

So I ran into an issue with this set up and wanted to document the fix in case anyone read this in the future.

My Netdata Cloud room was littered with stale Openwrt Netdata instances (see image below)

I discovered that on Openwrt Netdata instances their UUID is located at /var/lib/netdata/registry/netdata.public.unique.id

/var on Openwrt is usually a symlink to /tmp, and /tmp is a tmpfs mount point, so the /var/lib/netdata/registry/netdata.public.unique.id file containing the Netdata UUID does not persist upon reboot. If Netdata can't find /var/lib/netdata/registry/netdata.public.unique.id when it initializes it creates the file and generates a UUID (which is almost always different than the original).

To persist the Netdata UUID I've found a few workarounds:

  • The easiest workaround (and what I am using) is probably to just stick something in rc.local that'll write the same UUID to the file. By default rc.local runs before Netdata inits yet so you'll need to make sure the /var/lib/netdata/registry directory exists. Adding something like
    mkdir -p /var/lib/netdata/registry && echo "insert-your-netdata-uuid-here" > /var/lib/netdata/registry/netdata.public.unique.id
    to /etc/rc.local should do.
    In case it isn't obvious, this should be be added before exit 0 and replace insert-your-netdata-uuid-here with the actual uuid. You can use uuidgen to create one.

  • You can put /var/lib/netdata/registry/netdata.public.unique.id on persistent storage.

  • Netdata can be configured to use a different path by changing the
    lib directory =
    setting in /etc/netdata/netdata.conf.

After fixing the UUID persistence here is some stuff on can cleaning out the old entries