Skip to content

Commit

Permalink
Merge branch 'bede' of github.com:BedeGaming/puppet-telegraf into bede
Browse files Browse the repository at this point in the history
  • Loading branch information
robrankin committed Aug 15, 2017
2 parents aaceb85 + 536e2b3 commit 9d1a658
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 17 deletions.
23 changes: 23 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Alex Simenduev <shamil.si@gmail.com>
Ashton Davis <contact@adavis.me>
Asif Shaikh <ripclawffb@users.noreply.github.com>
Cosmo Petrich <cosmopetrich@users.noreply.github.com>
doomnuggets <doomnuggets@users.noreply.github.com>
Gerold Katzinger <gerold@katzinger.info>
Henrik Thostrup Jensen <thostrup@gmail.com>
James Glenn <thedonkdonk@gmail.com>
Jessica <mxjessie@users.noreply.github.com>
Joshua Spence <josh@joshuaspence.com>
Joshua-Snapp <jksnapp@gmail.com>
Karolis Labrencis <karolis@labrencis.lt>
Luke Swithenbank <swithenbank.luke@gmail.com>
Mark McKinstry <mmckinst@users.noreply.github.com>
Maxime Devalland <maxime@devalland.com>
Mohammed Naser <mnaser@vexxhost.com>
nexecook <ecook@nexcess.net>
Nick Jones <nick.jones@datacentred.co.uk>
Simon <spjmurray@yahoo.co.uk>
Stuart Fox <sfox@xmatters.com>
Stuart Fox <stuart@1000-clouds.ca>
Sébastien <sebastien.nahelou@gmail.com>
Tomas Barton <barton.tomas@gmail.com>
14 changes: 4 additions & 10 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,11 @@
# [*round_interval*]
# Boolean. Rounds collection interval to 'interval'
#
# [*metric_batch_size*]
# Integer. Telegraf will limit each output batch to this size.
# [*metric_batch_size*] Integer. The maximum batch size to allow to
# accumulate before sending a flush to the configured outputs
#
# [*metric_buffer_limit*]
# Integer. Cache metric_buffer_limit metrics for each output, and flush this
# buffer on a successful write.
#
# [*flush_buffer_when_full*]
# Boolean. Flush buffer whenever full, regardless of flush_interval
# [*metric_buffer_limit*] Integer. The absolute maximum number of
# metrics that will accumulate before metrics are dropped.
#
# [*collection_jitter*]
# String. Sleep for a random time within jitter before collecting.
Expand Down Expand Up @@ -103,7 +99,6 @@
$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,
$flush_interval = $telegraf::params::flush_interval,
$flush_jitter = $telegraf::params::flush_jitter,
Expand Down Expand Up @@ -140,7 +135,6 @@
validate_bool($round_interval)
validate_integer($metric_batch_size)
validate_integer($metric_buffer_limit)
validate_bool($flush_buffer_when_full)
validate_string($collection_jitter)
validate_string($flush_interval)
validate_string($flush_jitter)
Expand Down
34 changes: 34 additions & 0 deletions manifests/output.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# == Define: telegraf::output
#
# A Puppet wrapper for discrete Telegraf output files
#
# === Parameters
#
# [*options*]
# Hash. Plugin options for use the the output template.
#
# [*sections*]
# Hash. Some outputs take multiple sections.
#
define telegraf::output (
$plugin_type = $name,
$options = undef,
$suboptions = undef,
$sections = undef,
) {
include telegraf

if $options {
validate_hash($options)
}

if $sections {
validate_hash($sections)
}

Class['::telegraf::config']
-> file { "${telegraf::config_folder}/output-${name}.conf":
content => template('telegraf/output.conf.erb'),
}
~> Class['::telegraf::service']
}
1 change: 0 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
$round_interval = true
$metric_batch_size = '1000'
$metric_buffer_limit = '10000'
$flush_buffer_when_full = true
$collection_jitter = '0s'
$flush_interval = '10s'
$flush_jitter = '0s'
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "datacentred-telegraf",
"version": "1.4.0",
"version": "1.5.0",
"author": "DataCentred Ltd",
"summary": "Configuration and management of InfluxData's Telegraf metrics collection agent",
"license": "GPL-3.0",
Expand Down
15 changes: 15 additions & 0 deletions scripts/generate_authors.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -e

cd "$(dirname "$(readlink -f "$BASH_SOURCE")")/.."

# see also ".mailmap" for how email addresses and names are deduplicated

{
cat <<-'EOH'
# This file lists all individuals having contributed content to the repository.
# For how it is generated, see `scripts/generate-authors.sh`.
EOH
echo
git log --format='%aN <%aE>' | LC_ALL=C.UTF-8 sort -uf
} > AUTHORS
8 changes: 5 additions & 3 deletions spec/classes/telegraf_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
it { should contain_class('telegraf::service') }
it { should contain_class('telegraf')
.with(
:ensure => '0.11.1-1',
:interval => '60s',
:flush_interval => '60s',
:ensure => '1.3.5-1',
:interval => '60s',
:metric_batch_size => '1000',
:metric_buffer_limit => '10000',
:flush_interval => '60s',
:global_tags => {
"dc" => "dc",
"env" => "production",
Expand Down
2 changes: 1 addition & 1 deletion spec/hieradata/test/telegraf.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
telegraf::ensure: "0.11.1-1"
telegraf::ensure: "1.3.5-1"
telegraf::interval: "60s"
telegraf::flush_interval: "60s"
telegraf::global_tags:
Expand Down
16 changes: 16 additions & 0 deletions templates/output.conf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[[outputs.<%= @plugin_type %>]]
<% unless @options == nil -%>
<% @options.sort.each do | option, value | -%>
<%= option -%> = <% if value.is_a?(String) %>"<%= value %>"<% elsif value.is_a?(Array) %><%= value.inspect %><% else %><%= value %><% end %>
<% end -%>
<% end -%>
<% if @sections -%>
<% @suboptions.sort.each do |section, option| -%>
[outputs.<%= @plugin_type %>.<%= section %>]
<% unless option == nil -%>
<% option.sort.each do | suboption, value | -%>
<%= suboption -%> = <% if value.is_a?(String) %>"<%= value %>"<% elsif value.is_a?(Array) %><%= value.inspect %><% else %><%= value %><% end %>
<% end -%>
<% end -%>
<% end -%>
<% end -%>
1 change: 0 additions & 1 deletion templates/telegraf.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
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 %>"
flush_interval = "<%= @flush_interval %>"
flush_jitter = "<%= @flush_jitter %>"
Expand Down

0 comments on commit 9d1a658

Please sign in to comment.