-
-
Notifications
You must be signed in to change notification settings - Fork 114
/
telegraf.conf.j2
133 lines (123 loc) · 4.87 KB
/
telegraf.conf.j2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
### MANAGED BY {{ role_path|basename }} ANSIBLE ROLE ###
[global_tags]
{% if telegraf_global_tags is defined and telegraf_global_tags is iterable %}
{% for item in telegraf_global_tags %}
{{ item.tag_name }} = "{{ item.tag_value }}"
{% endfor %}
{% endif %}
{% if telegraf_agent_aws_tags == true and ec2_tags is defined and ec2_tags != None %}
{% for key, value in ec2_tags.tags.items()%}
"{{telegraf_agent_aws_tags_prefix}}{{ key }}" = "{{ value }}"
{% endfor %}
{% endif %}
# Configuration for telegraf agent
[agent]
interval = "{{ telegraf_agent_interval }}s"
debug = {{ telegraf_agent_debug | lower }}
hostname = "{{ telegraf_agent_hostname }}"
round_interval = {{ telegraf_agent_round_interval | lower }}
flush_interval = "{{ telegraf_agent_flush_interval }}s"
flush_jitter = "{{ telegraf_agent_flush_jitter }}s"
{% if telegraf_agent_version is version_compare('0.13', '>=') %}
collection_jitter = "{{ telegraf_agent_collection_jitter }}s"
metric_batch_size = {{ telegraf_agent_metric_batch_size }}
metric_buffer_limit = {{ telegraf_agent_metric_buffer_limit }}
quiet = {{ telegraf_agent_quiet | lower }}
{% endif %}
{% if telegraf_agent_version is version_compare('1.1', '>=') %}
{% if ansible_os_family == "Windows" %}
logfile = "{{ telegraf_win_logfile }}"
logfile_rotation_interval = "{{ telegraf_win_logfile_rotation_interval }}"
logfile_rotation_max_size = "{{ telegraf_win_logfile_rotation_max_size }}"
logfile_rotation_max_archives = {{ telegraf_win_logfile_rotation_max_archives| int }}
{% else %}
logfile = "{{ telegraf_agent_logfile }}"
{% endif %}
omit_hostname = {{ telegraf_agent_omit_hostname | lower }}
{% endif %}
###############################################################################
# OUTPUTS #
###############################################################################
{% if telegraf_agent_output is defined and telegraf_agent_output is iterable %}
{% for item in telegraf_agent_output %}
[[outputs.{{ item.type }}]]
{% for items in item.config %}
{{ items }}
{% endfor %}
{% if item.tagpass is defined and item.tagpass is iterable %}
[outputs.{{ item.type }}.tagpass]
{% for items in item.tagpass %}
{{ items }}
{% endfor %}
{% endif %}
{% if item.tagdrop is defined and item.tagdrop is iterable %}
[outputs.{{ item.type }}.tagdrop]
{% for items in item.tagdrop %}
{{ items }}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
###############################################################################
# INPUTS #
###############################################################################
{% if telegraf_plugins_default is defined and telegraf_plugins_default is iterable %}
{% for item in telegraf_plugins_default %}
[[inputs.{{ item.plugin }}]]
{% if item.interval is defined %}
interval = "{{ item.interval }}s"
{% endif %}
{% if item.config is defined and item.config is iterable %}
{% for items in item.config %}
{{ items }}
{% endfor %}
{% endif %}
{% if item.tags is defined and item.tags is iterable %}
[inputs.{{ item.plugin }}.tags]
{% for items in item.tags %}
{{ items }}
{% endfor %}
{% endif %}
{% if item.tagpass is defined and item.tagpass is iterable %}
[inputs.{{ item.plugin }}.tagpass]
{% for items in item.tagpass %}
{{ items }}
{% endfor %}
{% endif %}
{% if item.tagdrop is defined and item.tagdrop is iterable %}
[inputs.{{ item.plugin }}.tagdrop]
{% for items in item.tagdrop %}
{{ items }}
{% endfor %}
{% endif %}
{% if item.objects is defined and item.objects is iterable %}
{% for object in item.objects %}
[[inputs.{{ item.plugin }}.object]]
ObjectName = {{ object.name | to_json }}
Instances = {{ object.instances | default(["*"]) | to_json }}
Counters = {{ object.counters | default(["*"]) | to_json }}
Measurement = {{ object.measurement | default("win_perf_counters") | to_json }}
IncludeTotal = {{ object.total | default(false) | string | lower }}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% if telegraf_plugins_default is defined and telegraf_plugins_default|length == 0 %}
{% if telegraf_plugins_extra is defined and telegraf_plugins_extra.keys() | length == 0 %}
# No plugins configured, added a mem plugin so telegraf doesn't stop working.
[[inputs.mem]]
{% endif %}
{% endif %}
###############################################################################
# PROCESSORS #
###############################################################################
{% if telegraf_processors is defined and telegraf_processors is iterable %}
{% for item in telegraf_processors %}
[[processors.{{ item.processor }}]]
{% if item.config is defined and item.config is iterable %}
{% for items in item.config %}
{{ items }}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}