moved agent config to inline

This commit is contained in:
2025-11-27 11:48:44 +01:00
parent d96bb79a5a
commit b52de4e326
4 changed files with 105 additions and 22 deletions

View File

@@ -1,3 +1,12 @@
---
# defaults file for server
telegraf_memory_high: "120M" telegraf_memory_high: "120M"
telegraf_memory_max: "150M" telegraf_memory_max: "150M"
telegraf_memory_swap_max: "0" telegraf_memory_swap_max: "0"
telegraf_agent_interval: "10s"
telegraf_agent_flush_interval: "10s"
telegraf_agent_flush_jitter: "2s"
telegraf_agent_metric_batch_size: 500
telegraf_agent_metric_buffer_limit: 1000
telegraf_agent_collection_jitter: "1s"
telegraf_agent_round_interval: true

View File

@@ -1,20 +0,0 @@
###############################################################################
# GLOBAL AGENT CONFIG
###############################################################################
[agent]
## Erfassungsintervall
interval = "10s"
## Batches kleiner halten → weniger RAM pro Batch
metric_batch_size = 500
metric_buffer_limit = 10000 # Maximal 10.000 Messpunkte im RAM
## Wenn der Buffer voll ist, werden alte Daten verworfen
## → verhindert "Memory blowup"
collection_jitter = "1s"
flush_interval = "10s"
flush_jitter = "2s"
## Jeder Output-Write versucht nur kurz, dann wird das Batch verworfen
## → wichtig gegen RAM-Voll-Laufen
round_interval = true

View File

@@ -21,5 +21,4 @@
# - include_role: # - include_role:
# name: base # name: base
# tasks_from: users.yml # tasks_from: users.yml
# vim: ts=2 sw=2 # vim: ts=2 sw=2

View File

@@ -33,6 +33,102 @@
- "telegraf.d/*.conf" - "telegraf.d/*.conf"
notify: restart_telegraf notify: restart_telegraf
- name: Configure telegraf agent hostname
tags: telegraf
ansible.builtin.lineinfile:
path: /etc/telegraf/telegraf.conf
regexp: '^\s*#?\s*hostname\s*='
line: ' hostname = "{{ ansible_fqdn }}"'
owner: root
group: root
mode: '0644'
notify: restart_telegraf
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"]
- name: Configure telegraf agent interval
tags: telegraf
ansible.builtin.lineinfile:
path: /etc/telegraf/telegraf.conf
regexp: '^\s*#?\s*interval\s*='
line: ' interval = "{{ telegraf_agent_interval }}"'
owner: root
group: root
mode: '0644'
notify: restart_telegraf
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"]
- name: Configure telegraf agent flush_interval
tags: telegraf
ansible.builtin.lineinfile:
path: /etc/telegraf/telegraf.conf
regexp: '^\s*#?\s*flush_interval\s*='
line: ' flush_interval = "{{ telegraf_agent_flush_interval }}"'
owner: root
group: root
mode: '0644'
notify: restart_telegraf
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"]
- name: Configure telegraf agent flush_jitter
tags: telegraf
ansible.builtin.lineinfile:
path: /etc/telegraf/telegraf.conf
regexp: '^\s*#?\s*flush_jitter\s*='
line: ' flush_jitter = "{{ telegraf_agent_flush_jitter }}"'
owner: root
group: root
mode: '0644'
notify: restart_telegraf
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"]
- name: Configure telegraf agent collection_jitter
tags: telegraf
ansible.builtin.lineinfile:
path: /etc/telegraf/telegraf.conf
regexp: '^\s*#?\s*collection_jitter\s*='
line: ' collection_jitter = "{{ telegraf_agent_collection_jitter }}"'
owner: root
group: root
mode: '0644'
notify: restart_telegraf
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"]
- name: Configure telegraf agent metric_batch_size
tags: telegraf
ansible.builtin.lineinfile:
path: /etc/telegraf/telegraf.conf
regexp: '^\s*#?\s*metric_batch_size\s*='
line: ' metric_batch_size = "{{ telegraf_agent_metric_batch_size }}"'
owner: root
group: root
mode: '0644'
notify: restart_telegraf
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"]
- name: Configure telegraf agent metric_buffer_limit
tags: telegraf
ansible.builtin.lineinfile:
path: /etc/telegraf/telegraf.conf
regexp: '^\s*#?\s*metric_buffer_limit\s*='
line: ' metric_buffer_limit = "{{ telegraf_agent_metric_buffer_limit }}"'
owner: root
group: root
mode: '0644'
notify: restart_telegraf
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"]
- name: Configure telegraf agent round_interval
tags: telegraf
ansible.builtin.lineinfile:
path: /etc/telegraf/telegraf.conf
regexp: '^\s*#?\s*round_interval\s*='
line: ' round_interval = "{{ telegraf_agent_round_interval }}"'
owner: root
group: root
mode: '0644'
notify: restart_telegraf
when: ansible_distribution in ["Debian", "Ubuntu", "Linux Mint"]
- name: server | telegraf | create systemd override directory for telegraf - name: server | telegraf | create systemd override directory for telegraf
ansible.builtin.file: ansible.builtin.file:
path: /etc/systemd/system/telegraf.service.d path: /etc/systemd/system/telegraf.service.d
@@ -48,4 +144,3 @@
- restart_telegraf - restart_telegraf