From 7d7f0bcd5657e9b1a1f337ead695d0767c3476d3 Mon Sep 17 00:00:00 2001 From: Mike Reeves Date: Fri, 16 Nov 2018 14:31:12 -0500 Subject: [PATCH] Telegraf Module - Actually sync the config --- salt/common/init.sls | 8 ++++++++ salt/common/telegraf/etc/telegraf.conf | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) 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"