diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 350e4a2..ece7df6 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -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 diff --git a/molecule/default/tests/test_default.py b/molecule/default/tests/test_default.py index 0424fbc..a048d61 100644 --- a/molecule/default/tests/test_default.py +++ b/molecule/default/tests/test_default.py @@ -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): diff --git a/templates/telegraf.conf.j2 b/templates/telegraf.conf.j2 index 89a055d..d5bff67 100644 --- a/templates/telegraf.conf.j2 +++ b/templates/telegraf.conf.j2 @@ -118,7 +118,7 @@ {% endif %} ############################################################################### -# PROCESSORS # +# PROCESSORS # ############################################################################### {% if telegraf_processors is defined and telegraf_processors is iterable %} @@ -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 %}