Puppet Class: icinga::web::reporting

Defined in:
manifests/web/reporting.pp

Summary

Setup the reporting module for Icinga Web 2

Overview

Parameters:

  • service_ensure (Stdlib::Ensure::Service) (defaults to: 'running')

    Manages if the reporting service should be stopped or running.

  • service_enable (Boolean) (defaults to: true)

    If set to true the reporting service will start on boot.

  • db_type (Enum['mysql', 'pgsql'])

    Type of your database.

  • db_host (Stdlib::Host) (defaults to: 'localhost')

    Hostname of the database.

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

    Port of the database.

  • db_name (String) (defaults to: 'reporting')

    Name of the database.

  • db_user (String) (defaults to: 'reporting')

    Username for DB connection.

  • db_pass (Icinga::Secret)

    Password for DB connection.

  • manage_database (Boolean) (defaults to: false)

    Create database and import schema.

  • mail (Optional[String]) (defaults to: undef)

    Mails are sent with this sender address.



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
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
# File 'manifests/web/reporting.pp', line 34

class icinga::web::reporting (
  Enum['mysql', 'pgsql']    $db_type,
  Icinga::Secret            $db_pass,
  Stdlib::Ensure::Service   $service_ensure  = 'running',
  Boolean                   $service_enable  = true,
  Stdlib::Host              $db_host         = 'localhost',
  Optional[Stdlib::Port]    $db_port         = undef,
  String                    $db_name         = 'reporting',
  String                    $db_user         = 'reporting',
  Boolean                   $manage_database = false,
  Optional[String]          $mail            = undef,
) {
  unless defined(Class['icinga::web::icingadb']) or defined(Class['icinga::web::monitoring']) {
    fail('Class icinga::web::icingadb or icinga::web::monitoring has to be declared before!')
  }

  icinga::prepare_web('Reporting')

  $icingaweb2_version = $icinga::web::icingaweb2_version
  $_db_charset        = $db_type ? {
    'mysql' => 'utf8mb4',
    default => 'UTF8',
  }

  #
  # Database
  #
  if $manage_database {
    class { 'icinga::web::reporting::database':
      db_type       => $db_type,
      db_name       => $db_name,
      db_user       => $db_user,
      db_pass       => $db_pass,
      web_instances => ['localhost'],
      before        => Class['icingaweb2::module::reporting'],
    }
    $_db_host = 'localhost'
  } else {
    if $db_type != 'pgsql' {
      include mysql::client
    } else {
      include postgresql::client
    }
    $_db_host = $db_host
  }

  class { 'icingaweb2::module::reporting':
    install_method => 'package',
    db_type        => $db_type,
    db_host        => $_db_host,
    db_port        => $db_port,
    db_name        => $db_name,
    db_username    => $db_user,
    db_password    => $db_pass,
    db_charset     => $_db_charset,
    import_schema  => lookup('icingaweb2::module::reporting::import_schema', undef, undef, true),
    mail           => $mail,
  }

  if versioncmp($icingaweb2_version, '4.0.0') < 0 {
    service { 'icinga-reporting':
      ensure  => $service_ensure,
      enable  => $service_enable,
      require => Class['icingaweb2::module::reporting'],
    }
  }

  if defined(Class['icinga::web::monitoring']) {
    class { 'icingaweb2::module::idoreports':
      install_method => 'package',
      import_schema  => true,
    }
  }
}