Defined Type: telegraf::input

Defined in:
manifests/input.pp

Summary

A Puppet wrapper for discrete Telegraf input files

Overview

Parameters:

  • options (Array) (defaults to: [])

    Plugin options for use in the input template.

  • plugin_type (String) (defaults to: $name)

    Define the telegraf plugin type to use (default is $name)

  • ensure (Enum['present', 'absent']) (defaults to: 'present')

    Set if the ensure params of the config file. If telegraf::ensure is absent the value is automatically absent



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'manifests/input.pp', line 8

define telegraf::input (
  String $plugin_type               = $name,
  Array  $options                   = [],
  Enum['present', 'absent'] $ensure = 'present',
) {
  include telegraf

  $_ensure = $telegraf::ensure ? {
    'absent' => 'absent',
    default  => $ensure,
  }

  file { "${telegraf::config_folder}/${name}.conf":
    ensure  => $_ensure,
    content => stdlib::to_toml({ 'inputs'=> { $plugin_type=> $options } }),
    require => Class['telegraf::config'],
    notify  => Class['telegraf::service'],
  }
}