Defined Type: collectd::type

Defined in:
manifests/type.pp

Overview

Parameters:

  • target (String)
  • ds (String) (defaults to: $name)
  • ds_type (Optional[Enum['ABSOLUTE', 'COUNTER', 'DERIVE', 'GAUGE']]) (defaults to: undef)
  • min (Variant[Numeric, Enum['U']]) (defaults to: 'U')
  • max (Variant[Numeric, Enum['U']]) (defaults to: 'U')
  • ds_name (String) (defaults to: 'value')
  • types (Array[Struct[{ min => Variant[Numeric, Enum['U']], max => Variant[Numeric, Enum['U']], ds_type => Enum['ABSOLUTE', 'COUNTER', 'DERIVE', 'GAUGE'], ds_name => String, }]]) (defaults to: [])


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'manifests/type.pp', line 1

define collectd::type (
  String                                                      $target,
  String                                                      $ds = $name,
  # BC compatible ....
  Optional[Enum['ABSOLUTE', 'COUNTER', 'DERIVE', 'GAUGE']]    $ds_type = undef,
  Variant[Numeric, Enum['U']]                                 $min = 'U',
  Variant[Numeric, Enum['U']]                                 $max = 'U',
  String                                                      $ds_name = 'value',
  # BC compatible .... ending

  Array[Struct[{
        min     => Variant[Numeric, Enum['U']],
        max     => Variant[Numeric, Enum['U']],
        ds_type => Enum['ABSOLUTE', 'COUNTER', 'DERIVE', 'GAUGE'],
        ds_name => String,
  }]]                                                         $types = [],
) {
  if empty($types) {
    $_types = [{
        min     => $min,
        max     => $max,
        ds_type => $ds_type,
        ds_name => $ds_name,
    }]
  } else {
    $_types = $types
  }

  $content = $_types.map |$type| { "${type['ds_name']}:${type['ds_type']}:${type['min']}:${type['max']}" }.join(', ')

  concat::fragment { "${target}/${ds}":
    content => "${ds}\t${content}",
    target  => $target,
    order   => $ds,
  }
}