Puppet Class: icinga2::feature::debuglog

Defined in:
manifests/feature/debuglog.pp

Overview

== Class: icinga2::feature::debuglog

This module configures the Icinga 2 feature mainlog.

=== Parameters

[*ensure*] Set to present enables the feature mainlog, absent disables it. Defaults to present.

[*path*] Absolute path to the log file. Default depends on platform: /var/log/icinga2/debug.log on Linux C:/ProgramData/icinga2/var/log/icinga2/debug.log on Windows

Parameters:

  • ensure (Enum['absent', 'present']) (defaults to: present)
  • path (Stdlib::Absolutepath) (defaults to: "${::icinga2::globals::log_dir}/debug.log")


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
# File 'manifests/feature/debuglog.pp', line 16

class icinga2::feature::debuglog(
  Enum['absent', 'present'] $ensure   = present,
  Stdlib::Absolutepath      $path     = "${::icinga2::globals::log_dir}/debug.log",
) {

  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 = {
    severity => 'debug',
    path     => $path,
  }

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

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