Post

Quick Monitoring with Netdata via Ansible

Quick Monitoring with Netdata via Ansible

Netdata is a great lightweight monitoring tool for quick system visibility with zero config. I use Ansible to automate the installation across my Ubuntu and Proxmox hosts using the official Netdata install script.

This is perfect for getting instant dashboards per host, and I also configure streaming to a central Netdata parent.


Setup Overview

  • Netdata installed using their one-line install script
  • Ansible handles install and configuration
  • Streaming enabled to parent node (automation-1.cal)
  • Netdata is available on port 19999 per host

Playbook: setup-netdata.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
- name: Install and configure Netdata
  hosts: proxmox:ubuntu_servers
  become: true
  vars:
    netdata_parent_ip: "10.0.1.25"
    netdata_parent_port: "19999"
    netdata_api_key: "your-streaming-api-key"

  tasks:
    - name: Download Netdata kickstart script
      get_url:
        url: https://get.netdata.cloud/kickstart.sh
        dest: /tmp/netdata-kickstart.sh
        mode: '0755'

    - name: Install Netdata
      shell: 
        cmd: sh /tmp/netdata-kickstart.sh --non-interactive
        creates: /usr/sbin/netdata

    - name: Configure Netdata streaming
      copy:
        dest: /etc/netdata/stream.conf
        content: |
          [stream]
          enabled = yes
          destination = :
          api key = 

    - name: Restart Netdata service
      service:
        name: netdata
        state: restarted
        enabled: yes

### Inventory Example
```yaml
proxmox:
  hosts:
    pve-1.cal:
    pve-2.cal:

ubuntu_servers:
  hosts:
    vm-1.cal:
    vm-2.cal:

After Deployment

Visit any host at http://:19999 to view metrics

Visit your parent (e.g. automation-1.cal:19999) to view all child streams

Optional: Secure with firewall or proxy

Notes

If you’re running a central Netdata parent, you’ll want stream.conf to accept child connections.

Add api key on both ends to match.

📁 View this playbook in the repo: https://github.com/rhysmcqueen/Learning/tree/main/Ansible-Examples/playbooks/setup-netdata.yml

This post is licensed under CC BY 4.0 by the author.