Puppet Class: icinga2::feature::opentsdb

Defined in:
manifests/feature/opentsdb.pp

Summary

Configures the Icinga 2 feature opentsdb.

Overview

Parameters:

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

    Set to present enables the feature opentsdb, absent disables it.

  • host (Optional[Stdlib::Host]) (defaults to: undef)

    OpenTSDB host address.

  • port (Optional[Stdlib::Port]) (defaults to: undef)

    OpenTSDB port.

  • enable_ha (Optional[Boolean]) (defaults to: undef)

    Enable the high availability functionality. Only valid in a cluster setup.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'manifests/feature/opentsdb.pp', line 16

class icinga2::feature::opentsdb (
  Enum['absent', 'present'] $ensure    = present,
  Optional[Stdlib::Host]    $host      = undef,
  Optional[Stdlib::Port]    $port      = undef,
  Optional[Boolean]         $enable_ha = undef,
) {
  if ! defined(Class['icinga2']) {
    fail('You must include the icinga2 base class before using any icinga2 feature class!')
  }

  $conf_dir = $icinga2::globals::conf_dir
  $_notify  = $ensure ? {
    'present' => Class['icinga2::service'],
    default   => undef,
  }

  # compose attributes
  $attrs = {
    'host'      => $host,
    'port'      => $port,
    'enable_ha' => $enable_ha,
  }

  # create object
  icinga2::object { 'icinga2::object::OpenTsdbWriter::opentsdb':
    object_name => 'opentsdb',
    object_type => 'OpenTsdbWriter',
    attrs       => delete_undef_values($attrs),
    attrs_list  => keys($attrs),
    target      => "${conf_dir}/features-available/opentsdb.conf",
    order       => 10,
    notify      => $_notify,
  }

  # manage feature
  icinga2::feature { 'opentsdb':
    ensure => $ensure,
  }
}