Puppet Class: icingaweb2::module::monitoring

Defined in:
manifests/module/monitoring.pp

Summary

Manages the monitoring module. This module is deprecated.

Overview

Requirements:

* IDO feature in Icinga 2 (MySQL or PostgreSQL)
* `ApiUser` object in Icinga 2 with proper permissions

class {'icingaweb2::module::monitoring':
  ido_host        => 'localhost',
  ido_type        => 'mysql',
  ido_db_name     => 'icinga2',
  ido_db_username => 'icinga2',
  ido_db_password => 'supersecret',
  commandtransports => {
    icinga2 => {
      transport => 'api',
      username  => 'icingaweb2',
      password  => 'supersecret',
    }
  }
}
Note:

At first have a look at the [Monitoring module documentation](www.icinga.com/docs/icingaweb2/latest/modules/monitoring/doc/01-About/).

Examples:

This module is mandatory for almost every setup. It connects your Icinga Web interface to the Icinga 2 core. Current and history information are queried through the IDO database. Actions such as ‘Check Now`, `Set Downtime` or `Acknowledge` are send to the Icinga 2 API.

Parameters:

  • ensure (Enum['absent', 'present'])

    Enable or disable module.

  • protected_customvars (Variant[String[1], Array[String[1]]])

    Custom variables in Icinga 2 may contain sensible information. Set patterns for custom variables that should be hidden in the web interface.

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

    Type of your IDO database. Either ‘mysql` or `pgsql`.

  • ido_host (Stdlib::Host)

    Hostname of the IDO database.

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

    Port of the IDO database.

  • ido_resource_name (String)

    Resource name for the IDO database.

  • ido_db_name (String)

    Name of the IDO database.

  • ido_db_username (String)

    Username for IDO DB connection.

  • ido_db_password (Optional[Icinga::Secret]) (defaults to: undef)

    Password for IDO DB connection.

  • ido_db_charset (Optional[String[1]]) (defaults to: undef)

    The character set to use for the database connection.

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

    Either enable or disable TLS encryption to the database. Other TLS parameters are only affected if this is set to ‘true’.

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

    Location of the private key for client authentication. Only valid if tls is enabled.

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

    Location of the certificate for client authentication. Only valid if tls is enabled.

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

    Location of the ca certificate. Only valid if tls is enabled.

  • tls_key (Optional[Icinga::Secret]) (defaults to: undef)

    The private key to store in spicified ‘tls_key_file` file. Only valid if tls is enabled.

  • tls_cert (Optional[String[1]]) (defaults to: undef)

    The certificate to store in spicified ‘tls_cert_file` file. Only valid if tls is enabled.

  • tls_cacert (Optional[String[1]]) (defaults to: undef)

    The ca certificate to store in spicified ‘tls_cacert_file` file. Only valid if tls is enabled.

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

    The file path to the directory that contains the trusted SSL CA certificates, which are stored in PEM format. Only available for the mysql database.

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

    Disable validation of the server certificate.

  • tls_cipher (Optional[String[1]]) (defaults to: undef)

    Cipher to use for the encrypted database connection.

  • settings (Hash[String[1], Any])

    General configuration of module monitoring. See official Icinga [documentation](icinga.com/docs/icinga-web/latest/modules/monitoring/doc/03-Configuration)

  • commandtransports (Hash)

    A hash of command transports.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'manifests/module/monitoring.pp', line 97

class icingaweb2::module::monitoring (
  Enum['absent', 'present']            $ensure,
  Variant[String[1], Array[String[1]]] $protected_customvars,
  Hash                                 $commandtransports,
  Hash[String[1], Any]                 $settings,
  Enum['mysql', 'pgsql']               $ido_type,
  Stdlib::Host                         $ido_host,
  String                               $ido_resource_name,
  String                               $ido_db_name,
  String                               $ido_db_username,
  Optional[Stdlib::Port]               $ido_port             = undef,
  Optional[Icinga::Secret]             $ido_db_password      = undef,
  Optional[String[1]]                  $ido_db_charset       = undef,
  Optional[Boolean]                    $use_tls              = undef,
  Optional[Stdlib::Absolutepath]       $tls_key_file         = undef,
  Optional[Stdlib::Absolutepath]       $tls_cert_file        = undef,
  Optional[Stdlib::Absolutepath]       $tls_cacert_file      = undef,
  Optional[Stdlib::Absolutepath]       $tls_capath           = undef,
  Optional[Icinga::Secret]             $tls_key              = undef,
  Optional[String[1]]                  $tls_cert             = undef,
  Optional[String[1]]                  $tls_cacert           = undef,
  Optional[Boolean]                    $tls_noverify         = undef,
  Optional[String[1]]                  $tls_cipher           = undef,
) {
  require icingaweb2

  $module_conf_dir = "${icingaweb2::globals::conf_dir}/modules/monitoring"
  $cert_dir        = "${icingaweb2::globals::state_dir}/monitoring/certs"

  $db = {
    type     => $ido_type,
    database => $ido_db_name,
    host     => $ido_host,
    port     => $ido_port,
    username => $ido_db_username,
    password => $ido_db_password,
  }

  $tls = icinga::cert::files(
    $ido_db_username,
    $cert_dir,
    $tls_key_file,
    $tls_cert_file,
    $tls_cacert_file,
    $tls_key,
    $tls_cert,
    $tls_cacert,
  )

  $backend_settings = {
    'type'     => 'ido',
    'resource' => $ido_resource_name,
  }

  $security_settings = {
    'protected_customvars' => $protected_customvars ? {
      String        => $protected_customvars,
      Array[String] => join($protected_customvars, ','),
    },
  }

  $_settings = {
    'module-monitoring-backends' => {
      'section_name' => 'backends',
      'target'       => "${module_conf_dir}/backends.ini",
      'settings'     => delete_undef_values($backend_settings),
    },
    'module-monitoring-security' => {
      'section_name' => 'security',
      'target'       => "${module_conf_dir}/config.ini",
      'settings'     => delete_undef_values($security_settings),
    },
    'module-monitoring-general' => {
      'section_name' => 'settings',
      'target'       => "${module_conf_dir}/config.ini",
      'settings'     => delete_undef_values($settings),
    },
  }

  class { 'icingaweb2::module::monitoring::install': }
  -> class { 'icingaweb2::module::monitoring::config': }
  contain icingaweb2::module::monitoring::install
  contain icingaweb2::module::monitoring::config
}