This commit is contained in:
parent
e7229ae189
commit
2931ebd8bf
@ -9,13 +9,17 @@ telegraf-config-dir:
|
||||
- watch_in:
|
||||
- service: telegraf-service
|
||||
|
||||
{% for cfg, value in telegraf.config.items() %}
|
||||
telegraf-config-file:
|
||||
file.managed:
|
||||
- name: /etc/telegraf/telegraf.conf
|
||||
- name: /etc/telegraf/{{ cfg }}.conf
|
||||
- source: salt://telegraf/templates/telegraf.conf.j2
|
||||
- user: root
|
||||
- group: root
|
||||
- mode: 600
|
||||
- template: jinja
|
||||
- context:
|
||||
config: {{ value }}
|
||||
- watch_in:
|
||||
- service: telegraf-service
|
||||
- service: telegraf-{{ cfg }}-service
|
||||
{% endfor %}
|
||||
|
@ -8,6 +8,7 @@ telegraf:
|
||||
os: linux
|
||||
arch: amd64
|
||||
config:
|
||||
main:
|
||||
outputs:
|
||||
influxdb:
|
||||
urls:
|
||||
|
@ -2,7 +2,7 @@
|
||||
{%- from "telegraf/map.jinja" import telegraf with context %}
|
||||
telegraf-service-file:
|
||||
file.managed:
|
||||
- name: /etc/systemd/system/telegraf.service
|
||||
- name: /etc/systemd/system/telegraf@.service
|
||||
- source: salt://telegraf/templates/telegraf.service.j2
|
||||
- user: root
|
||||
- group: root
|
||||
@ -10,7 +10,9 @@ telegraf-service-file:
|
||||
- watch_in:
|
||||
- service: telegraf-service
|
||||
|
||||
telegraf-service:
|
||||
{% for cfg, value in telegraf.config.items() %}
|
||||
telegraf-{{ cfg }}-service:
|
||||
service.running:
|
||||
- name: telegraf
|
||||
- name: telegraf@{{ cfg }}
|
||||
- enable: true
|
||||
{% endfor %}
|
||||
|
@ -20,12 +20,12 @@
|
||||
hostname = "{{ salt['grains.get']('fqdn') }}"
|
||||
omit_hostname = false
|
||||
|
||||
{% for name, value in telegraf.config.outputs.items() -%}
|
||||
{% for name, value in config.outputs.items() -%}
|
||||
[[outputs.{{ name }}]]
|
||||
{{ cfg(value) }}
|
||||
{% endfor %}
|
||||
|
||||
{% for name, value in telegraf.config.inputs.items() -%}
|
||||
{% for name, value in config.inputs.items() -%}
|
||||
[[inputs.{{ name }}]]
|
||||
{{ cfg(value) }}
|
||||
{% endfor -%}
|
||||
|
@ -7,7 +7,7 @@ After=network.target
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=-/etc/default/telegraf
|
||||
ExecStart=/usr/local/bin/telegraf --config /etc/telegraf/telegraf.conf
|
||||
ExecStart=/usr/local/bin/telegraf --config /etc/telegraf/%i.conf
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
Restart=on-failure
|
||||
RestartForceExitStatus=SIGPIPE
|
||||
|
Loading…
Reference in New Issue
Block a user