How to claim agent on netdata?

I've installed the netdata package 1.19.0-1 on OpenWRT 19.07.3; however, after reading the instructions here for claiming an agent:

I found that the OpenWRT package doesn't include the netdata-claim.sh script. I also found that the "claim" argument to the netdata binary, as described here, is not recognized:

I get the following error, with my redacted command shown for reference:

# /usr/sbin/netdata -D -W "claim -token=MYTOKEN -rooms=MYROOM -url=https://app.netdata.cloud"
Unknown -W parameter 'claim -token=MYTOKEN -rooms=MYROOM -url=https://app.netdata.cloud'

Could anyone give me a pointer on what I'm doing wrong?

The package is significantly out of date. It also likely will not have the cloud dependencies required even if it was updated. Can you try running the Netdata install script instead? https://learn.netdata.cloud/docs/agent/packaging/installer#automatic-one-line-installation-script

1 Like

Hi Zack,

Thanks, and welcome to the board! I just tried running the script, and got this error:

root@OpenWrt:~# bash <(curl -Ss https://my-netdata.io/kickstart.sh)
-ash: syntax error: unexpected "("

I suspect this is because OpenWRT is running ash rather than bash, by default. I installed the bash package, and now get this error:

root@OpenWrt:~# bash <(curl -Ss https://my-netdata.io/kickstart.sh)
bash: curl: command not found

So, I installed curl, and now get this:

root@OpenWrt:~# bash <(curl -Ss https://my-netdata.io/kickstart.sh)
System            : Linux
Operating System  : GNU/Linux
Machine           : mips
BASH major version: 
 --- Fetching script to detect required packages... --- 
[/tmp/netdata-kickstart-IAmOOd]# curl -q -sSL --connect-timeout 10 --retry 3 --output /tmp/netdata-kickstart-IAmOOd/install-required-packages.sh https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh  OK  

 --- Running downloaded script to detect required packages... --- 
[/tmp/netdata-kickstart-IAmOOd]# /bin/bash /tmp/netdata-kickstart-IAmOOd/install-required-packages.sh netdata Loading /etc/os-release ...
Unknown distribution ID: openwrt
Unknown distribution ID: lede
Unknown distribution ID: openwrt
Cannot find valid distribution in: openwrt lede openwrt
Cannot find valid distribution with lsb-release

I NEED YOUR HELP
It seems I cannot detect your system automatically.
And it seems I cannot find a known package manager in this system.
Please open a github issue to help us support your system too.
 FAILED  

 WARNING  It failed to install all the required packages, but installation might still be possible. 

Press ENTER to attempt netdata installation > 

I pressed enter, and finally we end here:

 --- OK, let's give it a try... --- 
[/tmp/netdata-kickstart-PnlPCM]# curl -q -sSL --connect-timeout 10 --retry 3 --output /tmp/netdata-kickstart-PnlPCM/sha256sum.txt https://storage.googleapis.com/netdata-nightlies/sha256sums.txt  OK  

[/tmp/netdata-kickstart-PnlPCM]# curl -q -sSL --connect-timeout 10 --retry 3 --output /tmp/netdata-kickstart-PnlPCM/netdata-latest.tar.gz https://storage.googleapis.com/netdata-nightlies/netdata-latest.tar.gz  OK  

[/tmp/netdata-kickstart-PnlPCM]# tar -xf netdata-latest.tar.gz tar: invalid tar magic
 FAILED  

/proc/self/fd/63: line 391: cd: netdata-*: No such file or directory
 ABORTED  Cannot cd to netdata source tree 

It appears that even though the script reported downloading that netdata-latest.tar.gz file ok, it actually did not, as it doesn't appear in the temp directory:

root@OpenWrt:~# cd /tmp/netdata-kickstart-PnlPCM/
root@OpenWrt:/tmp/netdata-kickstart-PnlPCM# ls
install-required-packages.sh  sha256sum.txt
root@OpenWrt:/tmp/netdata-kickstart-PnlPCM# 

Any thoughts?

When the script cannot figure out a known distro, it downloads its dependencies manually as well as Netdata and attempts to compile/install. The surprising part is that the curl download did not work - or potentially there was some issue with tar. I'm not too familiar with how well those two work on openwrt.
Can you open up an issue on Github? We may run into additional issues anyways.

As for my best guess, this may be the reason: https://unix.stackexchange.com/questions/249353/invalid-tar-magic-on-openwrt

There's a pending pull request to update it, but it seems that we care about privacy. More details can be found here: https://github.com/openwrt/packages/pull/12164#issuecomment-655981628

There are already all dependencies request for netdata, but you just need to use opkg update and then install all required packages. If you want to compile packages for OpenWrt, it is a better to cross-compile them.