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,41 +8,42 @@ telegraf:
|
|||||||
os: linux
|
os: linux
|
||||||
arch: amd64
|
arch: amd64
|
||||||
config:
|
config:
|
||||||
outputs:
|
main:
|
||||||
influxdb:
|
outputs:
|
||||||
urls:
|
influxdb:
|
||||||
- '"http://localhost:8086"'
|
urls:
|
||||||
username: username
|
- '"http://localhost:8086"'
|
||||||
password: password
|
username: username
|
||||||
database: telegraf
|
password: password
|
||||||
inputs:
|
database: telegraf
|
||||||
cpu:
|
inputs:
|
||||||
percpu: true
|
cpu:
|
||||||
totalcpu: true
|
percpu: true
|
||||||
collect_cpu_time: false
|
totalcpu: true
|
||||||
report_active: false
|
collect_cpu_time: false
|
||||||
disk:
|
report_active: false
|
||||||
ignore_fs:
|
disk:
|
||||||
- '"tmpfs"'
|
ignore_fs:
|
||||||
- '"devtmpfs"'
|
- '"tmpfs"'
|
||||||
- '"devfs"'
|
- '"devtmpfs"'
|
||||||
- '"iso9660"'
|
- '"devfs"'
|
||||||
- '"overlay"'
|
- '"iso9660"'
|
||||||
- '"aufs"'
|
- '"overlay"'
|
||||||
- '"squashfs"'
|
- '"aufs"'
|
||||||
- '"fuse.rclone"'
|
- '"squashfs"'
|
||||||
diskio:
|
- '"fuse.rclone"'
|
||||||
kernel:
|
diskio:
|
||||||
kernel_vmstat:
|
kernel:
|
||||||
mem:
|
kernel_vmstat:
|
||||||
net:
|
mem:
|
||||||
netstat:
|
net:
|
||||||
postfix:
|
netstat:
|
||||||
processes:
|
postfix:
|
||||||
swap:
|
processes:
|
||||||
sensors:
|
swap:
|
||||||
smart:
|
sensors:
|
||||||
system:
|
smart:
|
||||||
systemd_units:
|
system:
|
||||||
syslog:
|
systemd_units:
|
||||||
server: "udp://:6514"
|
syslog:
|
||||||
|
server: "udp://:6514"
|
||||||
|
@ -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