Puppet Class: telegraf

Inherits:
telegraf::params
Inherited by:
telegraf::config
Defined in:
manifests/init.pp

Summary

A Puppet module for installing InfluxData's Telegraf

Overview

Parameters:

  • package_name (String) (defaults to: $telegraf::params::package_name)

    Package name

  • ensure (String) (defaults to: $telegraf::params::ensure)

    State of the telegraf package. You can also specify a particular version to install

  • config_file (String) (defaults to: $telegraf::params::config_file)

    Path to the configuration file

  • logfile (String) (defaults to: $telegraf::params::logfile)

    Path to the log file

  • logfile_rotation_interval (String) (defaults to: $telegraf::params::logfile_rotation_interval)

    The logfile will be rotated after the time interval specified, e.g. “1d”. 0 = off. Default = “0h”

  • logfile_rotation_max_size (String) (defaults to: $telegraf::params::logfile_rotation_max_size)

    The logfile will be rotated when it becomes larger than the specified size, e.g. “10MB”. 0 = off. Default = “0MB”

  • logfile_rotation_max_archives (Integer) (defaults to: $telegraf::params::logfile_rotation_max_archives)

    Maximum number of rotated archives to keep, older logs are deleted. If set to -1, no archives are removed. Default = 5

  • config_file_owner (String) (defaults to: $telegraf::params::config_file_owner)

    User to own the telegraf config file

  • config_file_group (String) (defaults to: $telegraf::params::config_file_group)

    Group to own the telegraf config file

  • config_file_mode (Optional[Stdlib::Filemode]) (defaults to: $telegraf::params::config_file_mode)

    File mode for the telegraf config file

  • config_folder (String) (defaults to: $telegraf::params::config_folder)

    Path of additional telegraf config folder

  • config_folder_mode (Optional[Stdlib::Filemode]) (defaults to: $telegraf::params::config_folder_mode)

    File mode for the telegraf config folder

  • hostname (String) (defaults to: $telegraf::params::hostname)

    Override default hostname used to identify this agent

  • omit_hostname (Boolean) (defaults to: $telegraf::params::omit_hostname)

    Do not set the “host” tag in the telegraf agent

  • interval (String) (defaults to: $telegraf::params::interval)

    Default data collection interval for all inputs

  • round_interval (Boolean) (defaults to: $telegraf::params::round_interval)

    Rounds collection interval to ‘interval’

  • metric_batch_size (Integer) (defaults to: $telegraf::params::metric_batch_size)

    The maximum batch size to allow to accumulate before sending a flush to the configured outputs

  • metric_buffer_limit (Integer) (defaults to: $telegraf::params::metric_buffer_limit)

    The absolute maximum number of metrics that will accumulate before metrics are dropped

  • collection_jitter (String) (defaults to: $telegraf::params::collection_jitter)

    Sleep for a random time within jitter before collecting

  • flush_interval (String) (defaults to: $telegraf::params::flush_interval)

    Default flushing interval for all outputs

  • flush_jitter (String) (defaults to: $telegraf::params::flush_jitter)

    Jitter the flush interval by an amount

  • debug (Boolean) (defaults to: $telegraf::params::debug)

    Run telegraf in debug mode

  • quiet (Boolean) (defaults to: $telegraf::params::quiet)

    Run telegraf in quiet mode

  • outputs (Hash) (defaults to: $telegraf::params::outputs)

    Specify output plugins and their options

  • inputs (Hash) (defaults to: $telegraf::params::inputs)

    Specify input plugins and their options

  • global_tags (Hash) (defaults to: $telegraf::params::global_tags)

    Global tags as a key-value pair

  • processors (Hash) (defaults to: {})

    Specify processors and their configuration

  • manage_service (Boolean) (defaults to: $telegraf::params::manage_service)

    Whether to manage the telegraf service or not

  • manage_repo (Boolean) (defaults to: $telegraf::params::manage_repo)

    Whether or not to manage InfluxData’s repo

  • manage_archive (Boolean) (defaults to: $telegraf::params::manage_archive)

    Whether or not to manage InfluxData’s tar archive

  • manage_user (Boolean) (defaults to: $telegraf::params::manage_user)

    Whether or not to manage the ‘telegraf’ user when installing from archive

  • repo_location (Optional[String]) (defaults to: $telegraf::params::repo_location)

    Alternate repo location. E.g. an interal mirror

  • archive_location (Optional[String]) (defaults to: $telegraf::params::archive_location)

    Alternate archive location. E.g. an interal mirror

  • archive_version (Optional[String[1]]) (defaults to: $telegraf::params::archive_version)

    Specify a telegraf archive version. E.g. 1.17.2

  • archive_install_dir (Optional[String]) (defaults to: $telegraf::params::archive_install_dir)

    Location to extract archive to must be an absolute path

  • install_options (Array) (defaults to: $telegraf::params::install_options)

    Additional options to pass when installing package

  • purge_config_fragments (Boolean) (defaults to: $telegraf::params::purge_config_fragments)

    Whether unmanaged configuration fragments should be removed

  • repo_type (String) (defaults to: $telegraf::params::repo_type)

    Which repo (stable, unstable, nightly) to use

  • windows_package_url (String) (defaults to: $telegraf::params::windows_package_url)

    URL for windows telegraf chocolatey repo

  • precision (String) (defaults to: $telegraf::params::precision)
  • service_enable (Boolean) (defaults to: $telegraf::params::service_enable)

    enable state for the telegraf service

  • service_ensure (String) (defaults to: $telegraf::params::service_ensure)

    ensure state for the telegraf service



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'manifests/init.pp', line 47

class telegraf (
  String  $package_name                          = $telegraf::params::package_name,
  String  $ensure                                = $telegraf::params::ensure,
  String  $config_file                           = $telegraf::params::config_file,
  String  $config_file_owner                     = $telegraf::params::config_file_owner,
  String  $config_file_group                     = $telegraf::params::config_file_group,
  Optional[Stdlib::Filemode] $config_file_mode   = $telegraf::params::config_file_mode,
  String  $config_folder                         = $telegraf::params::config_folder,
  Optional[Stdlib::Filemode] $config_folder_mode = $telegraf::params::config_folder_mode,
  String  $hostname                              = $telegraf::params::hostname,
  Boolean $omit_hostname                         = $telegraf::params::omit_hostname,
  String  $interval                              = $telegraf::params::interval,
  Boolean $round_interval                        = $telegraf::params::round_interval,
  Integer $metric_batch_size                     = $telegraf::params::metric_batch_size,
  Integer $metric_buffer_limit                   = $telegraf::params::metric_buffer_limit,
  String  $collection_jitter                     = $telegraf::params::collection_jitter,
  String  $flush_interval                        = $telegraf::params::flush_interval,
  String  $flush_jitter                          = $telegraf::params::flush_jitter,
  String  $precision                             = $telegraf::params::precision,
  String  $logfile                               = $telegraf::params::logfile,
  String  $logfile_rotation_interval             = $telegraf::params::logfile_rotation_interval,
  String  $logfile_rotation_max_size             = $telegraf::params::logfile_rotation_max_size,
  Integer $logfile_rotation_max_archives         = $telegraf::params::logfile_rotation_max_archives,
  Boolean $debug                                 = $telegraf::params::debug,
  Boolean $quiet                                 = $telegraf::params::quiet,
  Hash    $inputs                                = $telegraf::params::inputs,
  Hash    $outputs                               = $telegraf::params::outputs,
  Hash    $global_tags                           = $telegraf::params::global_tags,
  Hash    $processors                            = {},
  Boolean $manage_service                        = $telegraf::params::manage_service,
  Boolean $manage_repo                           = $telegraf::params::manage_repo,
  Boolean $manage_archive                        = $telegraf::params::manage_archive,
  Boolean $manage_user                           = $telegraf::params::manage_user,
  Optional[String] $repo_location                = $telegraf::params::repo_location,
  Optional[String] $archive_location             = $telegraf::params::archive_location,
  Optional[String[1]] $archive_version           = $telegraf::params::archive_version,
  Optional[String] $archive_install_dir          = $telegraf::params::archive_install_dir,
  Boolean $purge_config_fragments                = $telegraf::params::purge_config_fragments,
  String  $repo_type                             = $telegraf::params::repo_type,
  String  $windows_package_url                   = $telegraf::params::windows_package_url,
  Boolean $service_enable                        = $telegraf::params::service_enable,
  String  $service_ensure                        = $telegraf::params::service_ensure,
  Array   $install_options                       = $telegraf::params::install_options,
) inherits telegraf::params {
  $service_hasstatus = $telegraf::params::service_hasstatus
  $service_restart   = $telegraf::params::service_restart

  $ensure_file = $ensure ? {
    'absent' => 'absent',
    default  => 'file',
  }

  $ensure_status = $ensure ? {
    'absent' => 'absent',
    default  => 'present',
  }

  contain telegraf::install
  contain telegraf::config
  contain telegraf::service

  $processors.each |$processor, $attributes| {
    telegraf::processor { $processor:
      * => $attributes,
    }
  }

  Class['telegraf::install'] -> Class['telegraf::config'] ~> Class['telegraf::service']
  Class['telegraf::install'] ~> Class['telegraf::service']
}