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