diff --git a/salt/common/init.sls b/salt/common/init.sls index 20fdd58ff..f9456f850 100644 --- a/salt/common/init.sls +++ b/salt/common/init.sls @@ -141,6 +141,14 @@ tgrafetcdir: - name: /opt/so/conf/telegraf/etc - makedirs: True +tgrafconf: + file.managed: + - name: /opt/so/conf/telegraf/telegraf.conf + - user: 939 + - group: 939 + - template: jinja + - source: salt://common/telegraf/etc/telegraf.conf + so-telegraf: docker_container.running: - image: soshybridhunter/so-telegraf:HH1.0.4 diff --git a/salt/common/telegraf/etc/telegraf.conf b/salt/common/telegraf/etc/telegraf.conf index 3bcfa1550..4d12da9c3 100644 --- a/salt/common/telegraf/etc/telegraf.conf +++ b/salt/common/telegraf/etc/telegraf.conf @@ -12,7 +12,7 @@ # Environment variables can be used anywhere in this config file, simply prepend # them with $. For strings the variable must be within quotes (ie, "$STR_VAR"), # for numbers and booleans they should be plain (ie, $INT_VAR, $BOOL_VAR) - +{%- set MASTER = grains['master'] %} # Global tags can be specified here in key="value" format. [global_tags] @@ -90,7 +90,8 @@ ## urls will be written to each interval. # urls = ["unix:///var/run/influxdb.sock"] # urls = ["udp://127.0.0.1:8089"] - # urls = ["http://127.0.0.1:8086"] + urls = ["http://{{ MASTER }}:8086"] + ## The target database for metrics; will be created as needed. # database = "telegraf"