paulbsd-salt/states/telegraf/templates/telegraf.conf.j2

32 lines
1.3 KiB
Plaintext
Raw Normal View History

2020-07-10 00:58:55 +02:00
## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }}
{%- from "telegraf/map.jinja" import telegraf with context %}
2022-06-28 23:21:35 +02:00
{% macro cfg(value) -%}
2024-03-20 15:02:47 +01:00
{% if value and value != 'None' -%}
2022-06-28 23:21:35 +02:00
{% 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 %}
2020-07-10 00:58:55 +02:00
[global_tags]
[agent]
2020-10-25 16:37:55 +01:00
hostname = "{{ salt['grains.get']('fqdn') }}"
2024-03-20 15:14:07 +01:00
interval = "{{ config.interval|default('1m') }}"
2024-03-20 15:18:54 +01:00
round_interval = {{ config.round_interval|default('true') }}
2024-03-20 15:14:07 +01:00
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('') }}"
2024-03-20 15:18:54 +01:00
omit_hostname = {{ config.omit_hostname|default('false') }}
2020-07-10 00:58:55 +02:00
2024-03-20 14:32:46 +01:00
{% for name, value in config.outputs.items() -%}
2021-08-18 07:10:35 +02:00
[[outputs.{{ name }}]]
2022-06-28 23:21:35 +02:00
{{ cfg(value) }}
2021-08-18 07:10:35 +02:00
{% endfor %}
2020-07-10 00:58:55 +02:00
2024-03-20 14:32:46 +01:00
{% for name, value in config.inputs.items() -%}
2020-07-10 00:58:55 +02:00
[[inputs.{{ name }}]]
2022-06-28 23:21:35 +02:00
{{ cfg(value) }}
2021-08-18 07:10:35 +02:00
{% endfor -%}