From 154e1e6bcc77957ba14741df02e9aad81cb81f57 Mon Sep 17 00:00:00 2001 From: Mike Reeves Date: Tue, 27 Nov 2018 12:27:17 -0500 Subject: [PATCH] Common Module - Fix Telegraf ES input for nodes --- salt/common/init.sls | 2 ++ salt/common/telegraf/etc/telegraf.conf | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/salt/common/init.sls b/salt/common/init.sls index 25f715ab3..b5960dd04 100644 --- a/salt/common/init.sls +++ b/salt/common/init.sls @@ -288,6 +288,7 @@ dashboard-master: - defaults: SERVERNAME: {{ SN }} MANINT: {{ SNDATA.manint }} + MONINT: {{ SNDATA.manint }} CPUS: {{ SNDATA.totalcpus }} UID: {{ SNDATA.guid }} @@ -325,6 +326,7 @@ dashboard-{{ SN }}: - defaults: SERVERNAME: {{ SN }} MANINT: {{ SNDATA.manint }} + MONINT: {{ SNDATA.manint }} CPUS: {{ SNDATA.totalcpus }} UID: {{ SNDATA.guid }} diff --git a/salt/common/telegraf/etc/telegraf.conf b/salt/common/telegraf/etc/telegraf.conf index 34831baed..5da611fff 100644 --- a/salt/common/telegraf/etc/telegraf.conf +++ b/salt/common/telegraf/etc/telegraf.conf @@ -12,7 +12,10 @@ # 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'] %} +{% set NODEIP = salt['pillar.get']('node:mainip', '') %} + # Global tags can be specified here in key="value" format. [global_tags] @@ -571,6 +574,11 @@ # # servers = ["http://user:pass@localhost:9200"] servers = ["http://{{ MASTER }}:9200"] {% endif %} +{% if grains['role'] == 'so-node'} + [[inputs.elasticsearch]] + servers = ["http://{{ NODEIP }}:9200"] +{% endif %} + # # ## Timeout for HTTP requests to the elastic search server(s) # http_timeout = "5s"