Netdata installation with execute resource


#1

Hi all,

I intend to install netdata performance and health monitoring system with a simple custom cookbook. Binary packages are not available yet, so I use their recommended install script.
The recipe is realy simple:

execute ‘netdata-install’ do
command "bash <(curl -Ss https://my-netdata.io/kickstart.sh) all --dont-wait --install /opt"
not_if { File.exists?(’/opt/netdata/usr/sbin/netdata’) }
end

The command is working without problems in console. But it is not working in chef:

       ================================================================================
       Error executing action `run` on resource 'execute[netdata-install]'
       ================================================================================

       Mixlib::ShellOut::ShellCommandFailed
       ------------------------------------
       Expected process to exit with [0], but received '2'
       ---- Begin output of bash <(curl -Ss https://my-netdata.io/kickstart.sh) all --dont-wait --install /opt ----
       STDOUT:
       STDERR: sh: 1: Syntax error: "(" unexpected
       ---- End output of bash <(curl -Ss https://my-netdata.io/kickstart.sh) all --dont-wait --install /opt ----
       Ran bash <(curl -Ss https://my-netdata.io/kickstart.sh) all --dont-wait --install /opt returned 2

       Resource Declaration:
       ---------------------
       # In /tmp/kitchen/cache/cookbooks/wrap_monitor/recipes/build.rb

        35: execute 'netdata-install' do
        36:         command "bash <(curl -Ss https://my-netdata.io/kickstart.sh) all --dont-wait --install /opt"
        37:         not_if { File.exists?('/opt/netdata/usr/sbin/netdata') }
        38: end

Where is the problem?
Thank you in advance.


#2

There’s a bash resource that may be a me to handle the syntax of that script. Try that instead of the execute resource

  • Tim

#3

Also, I would suggest fetching the script first to a local file, and then trying to execute it. You might get a better error message that way.


#4

Thanks for your responses.
I already tried both suggested variants. The results where negative in both cases. The error message comes this time from inside the install script, some compile time errors. As if the used bash inside chef has no access to all environment variables, or something.
I ended up using netdatas other installation variant, the one with pre-built static binary installation.

execute ‘netdata-install’ do
command ‘curl -Ss https://my-netdata.io/kickstart-static64.sh | bash -s – --dont-wait’
not_if { File.exists?(’/opt/netdata/usr/sbin/netdata’) }
end

This one is working well, the only drawback is the lack of automatic update script. But I will survive with this until netdata will provide binary package for debian distributions.

Thank you.