mirror of
https://github.com/dj-wasabi/ansible-telegraf.git
synced 2025-07-17 08:46:37 +00:00
Adding support for aggregators (#156)
* templates/telegraf.conf.j2: Adding aggregator support. Adding aggregator support and tagpass/tagdrop support for processors and aggregators. * Adding test for aggregator templating
This commit is contained in:
@ -52,6 +52,13 @@ provisioner:
|
||||
name: grok
|
||||
config:
|
||||
- patterns = ["invoked oom-killer"]
|
||||
telegraf_aggregators:
|
||||
- aggregator: basicstats
|
||||
config:
|
||||
- drop_original = false
|
||||
- stats = ['mean']
|
||||
tagpass:
|
||||
- cpu = ["cpu-total"]
|
||||
|
||||
scenario:
|
||||
name: default
|
||||
|
@ -24,6 +24,7 @@ def test_telegraf_dot_conf(host):
|
||||
assert telegraf.contains('[[outputs.influxdb]]')
|
||||
assert telegraf.contains('["http://influxdb:8086"]')
|
||||
assert telegraf.contains('[[inputs.net]]')
|
||||
assert telegraf.contains('[[aggregators.basicstats]]')
|
||||
|
||||
|
||||
def test_telegraf_dot_d_dir(host):
|
||||
|
@ -129,5 +129,44 @@
|
||||
{{ items }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if item.tagpass is defined and item.tagpass is iterable %}
|
||||
[processors.{{ item.processor }}.tagpass]
|
||||
{% for items in item.tagpass %}
|
||||
{{ items }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if item.tagdrop is defined and item.tagdrop is iterable %}
|
||||
[processors.{{ item.processor }}.tagdrop]
|
||||
{% for items in item.tagdrop %}
|
||||
{{ items }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
###############################################################################
|
||||
# AGGREGATORS #
|
||||
###############################################################################
|
||||
|
||||
{% if telegraf_aggregators is defined and telegraf_aggregators is iterable %}
|
||||
{% for item in telegraf_aggregators %}
|
||||
[[aggregators.{{ item.aggregator }}]]
|
||||
{% if item.config is defined and item.config is iterable %}
|
||||
{% for items in item.config %}
|
||||
{{ items }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if item.tagpass is defined and item.tagpass is iterable %}
|
||||
[aggregators.{{ item.aggregator }}.tagpass]
|
||||
{% for items in item.tagpass %}
|
||||
{{ items }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if item.tagdrop is defined and item.tagdrop is iterable %}
|
||||
[aggregators.{{ item.aggregator }}.tagdrop]
|
||||
{% for items in item.tagdrop %}
|
||||
{{ items }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
Reference in New Issue
Block a user