From 34b70868171e3faf0d0ae3ea812e1487eb4c5fc2 Mon Sep 17 00:00:00 2001 From: Henrik Thostrup Jensen Date: Mon, 26 Jun 2017 11:45:57 +0200 Subject: [PATCH] make package work with newer puppetlabs-apt, add support for metric batch size, and update buffer limit default to current telegraf default (#63) * make it work with newer puppetlabs-apt * add support for metric batch size * telegraf uses 10000 as default for metric_buffer_limit so puppet should probably do that as well --- manifests/init.pp | 5 +++++ manifests/params.pp | 3 ++- metadata.json | 2 +- templates/telegraf.conf.erb | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index a414fbd..bee8cdb 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -38,6 +38,9 @@ # [*round_interval*] # Boolean. Rounds collection interval to 'interval' # +# [*metric_batch_size*] +# Integer. Telegraf will limit each output batch to this size. +# # [*metric_buffer_limit*] # Integer. Cache metric_buffer_limit metrics for each output, and flush this # buffer on a successful write. @@ -98,6 +101,7 @@ $omit_hostname = $telegraf::params::omit_hostname, $interval = $telegraf::params::interval, $round_interval = $telegraf::params::round_interval, + $metric_batch_size = $telegraf::params::metric_batch_size, $metric_buffer_limit = $telegraf::params::metric_buffer_limit, $flush_buffer_when_full = $telegraf::params::flush_buffer_when_full, $collection_jitter = $telegraf::params::collection_jitter, @@ -134,6 +138,7 @@ validate_bool($omit_hostname) validate_string($interval) validate_bool($round_interval) + validate_integer($metric_batch_size) validate_integer($metric_buffer_limit) validate_bool($flush_buffer_when_full) validate_string($collection_jitter) diff --git a/manifests/params.pp b/manifests/params.pp index 1d1156b..b63290b 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -34,7 +34,8 @@ $omit_hostname = false $interval = '10s' $round_interval = true - $metric_buffer_limit = '1000' + $metric_batch_size = '1000' + $metric_buffer_limit = '10000' $flush_buffer_when_full = true $collection_jitter = '0s' $flush_interval = '10s' diff --git a/metadata.json b/metadata.json index 79d58b5..67edd3e 100644 --- a/metadata.json +++ b/metadata.json @@ -36,7 +36,7 @@ ], "dependencies": [ { "name": "puppetlabs-stdlib", "version_requirement": ">=4.10.0 < 5.0.0" }, - { "name": "puppetlabs-apt", "version_requirement": ">= 2.0.0 < 3.0.0" } + { "name": "puppetlabs-apt", "version_requirement": ">= 2.0.0 < 5.0.0" } ], "requirements": [ { "name": "puppet", "version_requirement": "> = 3.0.0 < 5.0.0" } diff --git a/templates/telegraf.conf.erb b/templates/telegraf.conf.erb index 0d75f45..b319588 100644 --- a/templates/telegraf.conf.erb +++ b/templates/telegraf.conf.erb @@ -14,6 +14,7 @@ omit_hostname = <%= @omit_hostname %> interval = "<%= @interval %>" round_interval = <%= @round_interval %> + metric_batch_size = <%= @metric_batch_size %> metric_buffer_limit = <%= @metric_buffer_limit %> flush_buffer_when_full = <%= @flush_buffer_when_full %> collection_jitter = "<%= @collection_jitter %>"