diff --git a/salt/telegraf/defaults.yaml b/salt/telegraf/defaults.yaml index a70da5a59..a0cc8095f 100644 --- a/salt/telegraf/defaults.yaml +++ b/salt/telegraf/defaults.yaml @@ -1,3 +1,10 @@ telegraf: config: - interval: '30s' \ No newline at end of file + interval: '30s' + metric_batch_size: 1000 + metric_buffer_limit: 10000 + collection_jitter: '0s' + flush_interval: '10s' + flush_jitter: '0s' + debug: 'false' + quiet: 'false' diff --git a/salt/telegraf/etc/telegraf.conf b/salt/telegraf/etc/telegraf.conf index 694f9bc2a..244732b81 100644 --- a/salt/telegraf/etc/telegraf.conf +++ b/salt/telegraf/etc/telegraf.conf @@ -7,8 +7,7 @@ {%- set UNIQUEID = salt['pillar.get']('sensor:uniqueid', '') %} {%- set ZEEK_ENABLED = salt['pillar.get']('zeek:enabled', True) %} {%- set MDENGINE = GLOBALS.md_engine %} - - +{%- set TGCMERGED = salt['pillar.get']('telegraf', TGDEFAULTS, merge=true) %} # Global tags can be specified here in key="value" format. [global_tags] role = "{{ GLOBALS.role.split('-') | last }}" @@ -16,7 +15,7 @@ # Configuration for telegraf agent [agent] ## Default data collection interval for all inputs - interval = "{{ TGDEFAULTS.telegraf.config.interval }}" + interval = "{{ TGMERGED.telegraf.config.interval }}" ## Rounds collection interval to 'interval' ## ie, if interval="10s" then always collect on :00, :10, :20, etc. round_interval = true @@ -24,27 +23,27 @@ ## Telegraf will send metrics to outputs in batches of at most ## metric_batch_size metrics. ## This controls the size of writes that Telegraf sends to output plugins. - metric_batch_size = 1000 + metric_batch_size = {{ TGMERGED.telegraf.config.metric_batch_size }} ## For failed writes, telegraf will cache metric_buffer_limit metrics for each ## output, and will flush this buffer on a successful write. Oldest metrics ## are dropped first when this buffer fills. ## This buffer only fills when writes fail to output plugin(s). - metric_buffer_limit = 10000 + metric_buffer_limit = {{ TGMERGED.telegraf.config.metric_buffer_limit }} ## Collection jitter is used to jitter the collection by a random amount. ## Each plugin will sleep for a random time within jitter before collecting. ## This can be used to avoid many plugins querying things like sysfs at the ## same time, which can have a measurable effect on the system. - collection_jitter = "0s" + collection_jitter = "{{ TGMERGED.telegraf.config.collection_jitter }}" ## Default flushing interval for all outputs. Maximum flush_interval will be ## flush_interval + flush_jitter - flush_interval = "10s" + flush_interval = "{{ TGMERGED.telegraf.config.flush_interval }}" ## Jitter the flush interval by a random amount. This is primarily to avoid ## large write spikes for users running a large number of telegraf instances. ## ie, a jitter of 5s and interval 10s means flushes will happen every 10-15s - flush_jitter = "0s" + flush_jitter = "{{ TGMERGED.telegraf.config.flush_jitter }}" ## By default or when set to "0s", precision will be set to the same ## timestamp order as the collection interval, with the maximum being 1s. @@ -57,7 +56,7 @@ ## Logging configuration: ## Run telegraf with debug log messages. - debug = false + debug = {{ TGMERGED.telegraf.config.debug }} ## Run telegraf in quiet mode (error log messages only). quiet = false ## Specify the log file name. The empty string means to log to stderr. diff --git a/salt/telegraf/soc_telegraf.yaml b/salt/telegraf/soc_telegraf.yaml index c9824abf6..cbeda5e89 100644 --- a/salt/telegraf/soc_telegraf.yaml +++ b/salt/telegraf/soc_telegraf.yaml @@ -3,4 +3,39 @@ telegraf: interval: description: Data collection interval. global: True - helpLink: telegraf.html \ No newline at end of file + helpLink: telegraf.html + metric_batch_size: + description: Data collection batch size. + global: True + advanced: True + helpLink: telegraf.html + metric_buffer_limit: + description: Data collection buffer size. + global: True + advanced: True + helpLink: telegraf.html + collection_jitter: + description: Jitter of the flush interval. + global: True + advanced: True + helpLink: telegraf.html + flush_interval: + description: Flush interval for all outputs. + global: True + advanced: True + helpLink: telegraf.html + flush_jitter: + description: Jitter the flush interval. + global: True + advanced: True + helpLink: telegraf.html + debug: + description: Data collection interval. + global: True + advanced: True + helpLink: telegraf.html + quiet: + description: Data collection interval. + global: True + helpLink: telegraf.html + \ No newline at end of file