Puppet Class: icinga2::feature::livestatus

Defined in:
manifests/feature/livestatus.pp

Summary

Configures the Icinga 2 feature livestatus.

Overview

Parameters:

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

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

  • socket_type (Optional[Enum['tcp', 'unix']]) (defaults to: undef)

    Specifies the socket type. Can be either ‘tcp’ or ‘unix’.

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

    IP address to listen for connections. Only valid when socket_type is ‘tcp’.

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

    Port to listen for connections. Only valid when socket_type is ‘tcp’.

  • socket_path (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    Specifies the path to the UNIX socket file. Only valid when socket_type is ‘unix’.

  • compat_log_path (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    Required for historical table queries. Requires CompatLogger feature to be enabled.



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
55
56
57
58
59
60
61
62
63
64
# File 'manifests/feature/livestatus.pp', line 22

class icinga2::feature::livestatus (
  Enum['absent', 'present']      $ensure          = present,
  Optional[Enum['tcp', 'unix']]  $socket_type     = undef,
  Optional[Stdlib::Host]         $bind_host       = undef,
  Optional[Stdlib::Port]         $bind_port       = undef,
  Optional[Stdlib::Absolutepath] $socket_path     = undef,
  Optional[Stdlib::Absolutepath] $compat_log_path = 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 = {
    'socket_type'     => $socket_type,
    'bind_host'       => $bind_host,
    'bind_port'       => $bind_port,
    'socket_path'     => $socket_path,
    'compat_log_path' => $compat_log_path,
  }

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

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