Automate the agent installation only

Hey guys,

I have the script that installs Netdata etc, I am in the process of automating the installation via bash, I have been successful in passing on the y/yes but the last input needed is “press return/enter”.
I am wondering what everyone here has done via bash?

Thanks

Tommy

Hey everyone, I just published a sample application for dynamic configuration management using Cosul, in the netdata-community repository.

If you want to discuss about the consul sample-app, please do so in the community forum topic I created specifically for this reason!

Please do PR your suggestions for ansible in the same repo, as per the instructions. Let’s create a rich Community Repository full of examples and sample applications, curated by our awesome community!

1 Like

Thanks @cjcox, @jurgenhaas for the suggestions. I intend to create a public repository so that we may store these sample-apps and grow a cookbook of community-curated recipes!

What my ansible playbook looks like for CentOS 8.

---
# Note: this probably is just for "8" and not other versions.
#
- hosts: g_netdata

  tasks:
  - name: Check if a netdata is installed.
    shell:
      cmd: "netdata -V"
    failed_when:   False
    changed_when:  False
    register: netdata_version

  #
  # Install netdata via curl
  #  (note: not a lot of error handling here)
  #
  - name: Install netdata
    shell:
      cmd: "bash <(curl -Ss https://my-netdata.io/kickstart.sh) --non-interactive"
      executable: "/usr/bin/bash"
    when: netdata_version.rc != 0
1 Like

@jurgenhaas thanks for that - am looking to learn ansible myself at some stage so this should be a useful place for me to start with a side project for myself, cheers!

With Ansible, a fully automatic and dynamic deployment and configuration is no problem at all. As Ansible knows everything about each host already, the full configuration of Netdata with templates is just the obvious solution. It just requires writing all the templates, but you have to define your required configuration somewhere, don’t you.

We have developed an Ansible role at LakeDrops which may give you some idea on how this can be done. I’m using it for years on dozens of hosts and deployment/configuration is always hazzle-free.

1 Like

@Christopher-Akritidis, Thank you for your reply. I have proceeded with automation as per you suggested. Kind Regards

@Dongdong-Zheng we’re very careful to ensure we maintain backwards compatibility. All netdata 1.x versions will be backwards compatible. You will know something major will change when we go to 2.x

@Christopher_Akritidis, I did think of the same idea of copying customized config files into respective folders to achieve easy setup after each netdata agent installation. But I wonder how this approach would age as Netdata evolves at current rapid speed.

I found this example that looks kinda interesting and almost an example of what we are talking about.

So a playbook that massively overwrites the config in the user config directory and restarts netdata. That should be trivial too, right? The main thing to figure out would be how to get those config files transferred to each machine. Perhaps if the configuration is identical on each node, a better solution would be to have the user config directory point to a mounted shared drive? Just brainstorming here.

With ansible it would be pretty rudimentary to deploy Netdata. The interesting part is when we want to have dynamic configuration management, meaning that we want to change a specific configuration over a large number of nodes, without having to redeploy the nodes with the playbook.

kickstart has the “–dont-start-it” option. I would have a pre-made directory with the config files I want, install netdata with this option, copy over to the user config directory my files and then start it. I don’t know anything about ansible, but I expect it will be quite doable.

Chiming in here as i’m kinda curious about this too. If I google “ansible netdata” I get some stuff back but all a bit ad-hoc, random and maybe outdated. I wonder if some example ansible playbooks or something from netdata could be something the community might find useful. A bit out of my wheelhouse here though tbh as not sure what best practices are here (hence my curiosity)

Hey everyone,

Well, the Netdata Agent can auto-detect all the collectors, given that they have been setup with default or industry-standard settings. (e.g redis database exists at localhost). What you suggest perhaps is a scheme where we can pre-configure Netdata so that it can detect any number of sources based on the use-case of each user. That could be done perhaps with something like Ansinble or using Consul as a central configuration management key-value store.

The latter has been in my mind for quite some time. What do you thing?

Hi @Rybue, are you aware of any option available that can simply agent installation along with plugins? Something like (hypothetically) :

bash <(curl -Ss https://my-netdata.io/kickstart.sh) --dont-wait --plugins <plugin_name>

At the moment, we have to navigate and edit multiple config files before restart netdata service to make one plugin work. Kind of clumsy :stuck_out_tongue:

Hey @Rybue thanks for the advice, didnt see that sneaky option in the main doc there previously. I will test it out and let you guys know.

Very good suggestion @rybue, that’s probably it!

Hi Tom!
Maybe it would be better to use unattended way of netdata installation.
Install Netdata with kickstart.sh | Learn Netdata :

--dont-wait: Enable automated installs by not prompting for permission to install any required packages.
1 Like