paulbsd-salt/states/telegraf/templates/telegraf.conf.j2
Paul Lecuq 54132a9baa
All checks were successful
continuous-integration/drone/push Build is passing
updated telegraf state
2024-03-20 15:18:54 +01:00

32 lines
1.3 KiB
Django/Jinja

## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }}
{%- from "telegraf/map.jinja" import telegraf with context %}
{% macro cfg(value) -%}
{% if value and value != '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]
hostname = "{{ salt['grains.get']('fqdn') }}"
interval = "{{ config.interval|default('1m') }}"
round_interval = {{ config.round_interval|default('true') }}
metric_batch_size = {{ config.metric_batch_size|default(1000) }}
metric_buffer_limit = {{ config.metric_buffer_limit|default(10000) }}
collection_jitter = "{{ config.collection_jitter|default('0s') }}"
flush_interval = "{{ config.flush_interval|default('30s') }}"
flush_jitter = "{{ config.flush_jitter|default('0s') }}"
precision = "{{ config.precision|default('') }}"
omit_hostname = {{ config.omit_hostname|default('false') }}
{% for name, value in config.outputs.items() -%}
[[outputs.{{ name }}]]
{{ cfg(value) }}
{% endfor %}
{% for name, value in config.inputs.items() -%}
[[inputs.{{ name }}]]
{{ cfg(value) }}
{% endfor -%}