paulbsd-salt/states/telegraf/telegraf.conf.j2
Paul Lecuq 5ee366fd68
All checks were successful
continuous-integration/drone/push Build is passing
updated telegraf state
2022-06-28 23:21:35 +02:00

32 lines
1.0 KiB
Django/Jinja

## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }}
{%- from "telegraf/map.jinja" import telegraf with context %}
{% macro cfg(value) -%}
{% if value is not none -%}
{% for paramname, paramvalue in value.items() -%}
{{ ' ' }}{{ paramname }} = {% if paramvalue is sameas True or paramvalue is sameas False %}{{ paramvalue|string|lower }}{% elif paramvalue is iterable and paramvalue is not string %}[{{ paramvalue|join(",") }}]{% else %}"{{ paramvalue }}"{% endif %}
{% endfor %}
{%- endif %}
{%- endmacro %}
[global_tags]
[agent]
interval = "1m"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "30s"
flush_jitter = "0s"
precision = ""
hostname = "{{ salt['grains.get']('fqdn') }}"
omit_hostname = false
{% for name, value in telegraf.config.outputs.items() -%}
[[outputs.{{ name }}]]
{{ cfg(value) }}
{% endfor %}
{% for name, value in telegraf.config.inputs.items() -%}
[[inputs.{{ name }}]]
{{ cfg(value) }}
{% endfor -%}