Skip to content

Commit

Permalink
Merge pull request #72 from Icinga/icingadb
Browse files Browse the repository at this point in the history
Add IcingaDB support
  • Loading branch information
lbetz authored Jan 27, 2023
2 parents 259d555 + 3385246 commit 68e23a8
Show file tree
Hide file tree
Showing 17 changed files with 528 additions and 121 deletions.
85 changes: 69 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,16 @@ This module provides several non private helper classes for the other official I
* [icinga/icingaweb2]
* [icinga/icingadb]

### Changes in v2.9.0

* Class icinga::repos got a new parameter 'manage_crb' to manage the CRB repository on CentOS Stream 9, Rocky 9 and AlmaLinux 9.
* Add functions and a base class 'redis' to support the new IcingaDB from module [icingadb](https://github.com/Icinga/puppet-icingadb).

### Changes in v2.7.0

* The Class icinga::web now uses event as MPM instead of worker.
* Class icinga::repos got a new parameter 'manage_powertools' to manage the PowerTools on CentOS Stream 8, Rocky 8 and AlmaLinux 8.
### What's new in v3.0.0

Support for the IcingaDB. For this purpose, the management of monitoring, previously exclusively the monitoring module, has been separated from the web class.

### Changes in v2.0.0
From now on, the IDO based monitoring must be done by the additional declaration of the class `icinga::web::monitoring`. Likewise, the IcingaDB is configured with `icinga::web::icingadb`. Thus, the use of both in parallel is also possible.

* Earlier the parameter `manage_*` enables or disables a repository but it was still managed. Now the management is enabled or disabled, see [Enable or disable repositories](#enable-and-disable-repositories).
### Changes in v2.9.0

* Class icinga::repos got a new parameter 'manage_crb' to manage the CRB repository on CentOS Stream 9, Rocky 9 and AlmaLinux 9.
* Add functions and a base class 'redis' to support the new IcingaDB from module [icingadb](https://github.com/Icinga/puppet-icingadb).

## Setup

Expand Down Expand Up @@ -135,7 +130,9 @@ When manage is set to `true` for a repository the ressource is managed and the r
* icinga-stable-release
* icinga-testing-builds
* icinga-snapshot-builds
* epel (only on RHEL Enterprise platforms)
* epel (only on RHEL platforms)
* powertools (only RHEL 8 platforms)
* crb (only RHEL 9 platforms)
* netways-plugins
* netways-extras

Expand Down Expand Up @@ -166,6 +163,8 @@ To change to a non upstream repository, e.g. a local mirror, the repos can be cu
* icinga-testing-builds
* icinga-snapshot-builds
* epel (only on RHEL Enterprise platforms)
* powertools (only RHEL 8 platforms)
* crb (only RHEL 9 platforms)
* netways-plugins
* netways-extras

Expand Down Expand Up @@ -259,6 +258,34 @@ class { '::icinga::agent':
NOTICE: To switch off the package installation via chocolatey on windows, `icinga2::manage_packgaes` must be set to `false` for the corresponding hosts in Hiera. That works only on Windows, on Linux package installation is always used.


#### icinga::db

The class supports:

* [puppet] >= 6.0 < 8.0

Ands requires:

* [puppetlabs/mysql] >= 6.0.0
* [puppetlabs/postgresql] >= 7.0.0
* [icinga/icinga2] >= 2.0.0 < 4.0.0
* [icinga/icingadb] >= 1.0.0 < 2.0.0

To activate and configure the IcingaDB (usally on a server) do:

```
class { '::icinga::db':
db_type => 'pgsql',
db_host => 'localhost',
db_pass => 'icingadb',
manage_database => true,
manage_redis => true,
manage_feature => true,
}
```

Setting `manage_database` to `true` also setups a database as specified in `db_type` including database for the IcingaDB. The same applies to `manage_redis` and the required Redis cache. With `manage_feature` the Icinga 2 feature for the IcingaDB is additionally activated. The latter two are switched on by default.

#### icinga::ido

The class supports:
Expand Down Expand Up @@ -303,9 +330,6 @@ A Icinga Web 2 with an Apache and PHP-FPM can be managed as follows:

```
class { '::icinga::web':
backend_db_type => $icinga::ido::db_type,
backend_db_host => $icinga::ido::db_host,
backend_db_pass => $icinga::ido::db_pass,
db_type => 'pgsql',
db_host => 'localhost',
db_pass => 'supersecret',
Expand All @@ -314,10 +338,39 @@ class { '::icinga::web':
}
```

If the Icinga Web 2 is operated on the same host as the IDO, the required user credentials can be accessed, otherwise they must be specified explicitly. With `manage_database` set to `true`, a database of the specified type is also installed here. It is used to save user settings for the users of the Icinga Web 2.
Setting `manage_database` to `true`, a database of the specified type is also installed here. It is used to save user settings for the users of the Icinga Web 2 and serves as a backend for managing Icinga Web 2 users and user groups.

IMPORTANT: If you plan tu use icingacli as plugin, e.g. director health checks, businessprocess checks or vspheredb checks, set the parameter `run_web => true` for `icinga::server` on the same host `icinga::web` is declared. That put the Icinga user to the group `icingaweb2` and restart the icinga2 process if necessary.

#### icinga::web::icingadb

If the Icinga Web 2 is operated on the same host as the IcingaDB, the required user credentials can be accessed, otherwise they must be specified explicitly.

```
class { 'icinga::web::icingadb':
db_type => $icinga::db::db_type,
db_host => $icinga::db::db_host,
db_name => $icinga::db::db_name,
db_user => $icinga::db::db_user,
db_pass => $icinga::db::db_pass,
}
```

IMPORTANT: Must be declared on the same host as `icinga::web`.

#### icinga::web::monitoring

If the Icinga Web 2 is operated on the same host as the IDO, the required user credentials can be accessed, otherwise they must be specified explicitly.

```
class { 'icinga::web::monitoring':
db_type => $icinga::ido::db_type,
db_host => $icinga::ido::db_host,
db_pass => $icinga::ido::db_pass,
}
```

IMPORTANT: Must be declareid on the same host as `icinga::web`.

#### icinga::web::director

Expand Down
7 changes: 7 additions & 0 deletions examples/icingadb.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include icinga::repos

class { 'icinga::db':
db_type => 'mysql',
db_pass => 'icingadb',
manage_database => true,
}
13 changes: 8 additions & 5 deletions examples/mysql/database-mysql.pp → examples/mysql/databases.pp
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,14 @@
package_manage => false,
override_options => {
'mysqld' => {
bind-address => '0.0.0.0',
ssl => 'on',
ssl-cert => "${ssl_dir}/certs/mysql.pem",
ssl-key => "${ssl_dir}/private/mysql.pem",
ssl-ca => "${ssl_dir}/certs/mysql-ca.crt",
innodb_file_format => 'barracuda',
innodb_file_per_table => 1,
innodb_large_prefix => 1,
bind-address => '0.0.0.0',
ssl => 'on',
ssl-cert => "${ssl_dir}/certs/mysql.pem",
ssl-key => "${ssl_dir}/private/mysql.pem",
ssl-ca => "${ssl_dir}/certs/mysql-ca.crt",
},
},
}
Expand Down
12 changes: 12 additions & 0 deletions examples/mysql/icingaweb2.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class { 'icinga::repos':
manage_epel => true,
}

class { 'icinga::web':
db_type => 'mysql',
db_host => 'localhost',
db_pass => 'icingaweb2',
default_admin_user => 'admin',
default_admin_pass => 'admin',
manage_database => true,
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Setting riquired for MySQL < 5.7 and MariaDB < 10.2
if $facts['os']['family'] == 'redhat' and Integer($fachts['os']['release']['major']) < 8 {
class { 'mysql::server':
override_options => {
mysqld => {
innodb_file_format => 'barracuda',
innodb_file_per_table => 1,
innodb_large_prefix => 1,
},
},
}
}

class { 'icinga::repos':
manage_epel => true,
manage_extras => true,
Expand All @@ -12,39 +25,30 @@
run_web => true,
}

class { 'icinga::ido':
class { 'icinga::db':
db_type => 'mysql',
db_host => 'localhost',
db_pass => 'icinga2',
manage_database => true,
}

class { 'icinga::web':
backend_db_type => $icinga::ido::db_type,
backend_db_host => $icinga::ido::db_host,
backend_db_pass => $icinga::ido::db_pass,
db_type => 'mysql',
db_host => 'localhost',
db_pass => 'icingaweb2',
default_admin_user => 'admin',
default_admin_pass => 'admin',
manage_database => true,
api_pass => $icinga::server::web_api_pass,
}

class { 'icinga::web::icingadb':
db_type => $icinga::db::db_type,
db_pass => $icinga::db::db_pass,
}

class { 'icinga::web::director':
db_type => 'mysql',
db_host => 'localhost',
db_pass => 'director',
manage_database => true,
endpoint => $facts['networking']['fqdn'],
api_host => 'localhost',
api_pass => $icinga::server::director_api_pass,
}

class { 'icinga::web::vspheredb':
db_type => 'mysql',
db_host => 'localhost',
db_pass => 'vspheredb',
manage_database => true,
}
55 changes: 55 additions & 0 deletions examples/mysql/standalone-ido.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Setting riquired for MySQL < 5.7 and MariaDB < 10.2
if $facts['os']['family'] == 'redhat' and Integer($fachts['os']['release']['major']) < 8 {
class { 'mysql::server':
override_options => {
mysqld => {
innodb_file_format => 'barracuda',
innodb_file_per_table => 1,
innodb_large_prefix => 1,
},
},
}
}

class { 'icinga::repos':
manage_epel => true,
manage_extras => true,
}

class { 'icinga::server':
ca => true,
config_server => true,
global_zones => ['global-templates', 'linux-commands', 'windows-commands'],
web_api_pass => 'icingaweb2',
director_api_pass => 'director',
run_web => true,
}

class { 'icinga::ido':
db_type => 'mysql',
db_pass => 'icinga2',
manage_database => true,
}

class { 'icinga::web':
db_type => 'mysql',
db_pass => 'icingaweb2',
default_admin_user => 'admin',
default_admin_pass => 'admin',
manage_database => true,
api_pass => $icinga::server::web_api_pass,
}

class { 'icinga::web::monitoring':
db_type => $icinga::ido::db_type,
db_host => $icinga::ido::db_host,
db_pass => $icinga::ido::db_pass,
}

class { 'icinga::web::director':
db_type => 'mysql',
db_pass => 'director',
manage_database => true,
endpoint => $facts['networking']['fqdn'],
api_pass => $icinga::server::director_api_pass,
}
File renamed without changes.
41 changes: 41 additions & 0 deletions examples/pgsql/standalone-icingadb.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
class { 'icinga::repos':
manage_epel => true,
manage_extras => true,
}

class { 'icinga::server':
ca => true,
config_server => true,
global_zones => ['global-templates', 'linux-commands', 'windows-commands'],
web_api_pass => 'icingaweb2',
director_api_pass => 'director',
run_web => true,
}

class { 'icinga::db':
db_type => 'pgsql',
db_pass => 'icinga2',
manage_database => true,
}

class { 'icinga::web':
db_type => 'pgsql',
db_pass => 'icingaweb2',
default_admin_user => 'admin',
default_admin_pass => 'admin',
manage_database => true,
api_pass => $icinga::server::web_api_pass,
}

class { 'icinga::web::icingadb':
db_type => $icinga::db::db_type,
db_pass => $icinga::db::db_pass,
}

class { 'icinga::web::director':
db_type => 'pgsql',
db_pass => 'director',
manage_database => true,
endpoint => $facts['networking']['fqdn'],
api_pass => $icinga::server::director_api_pass,
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,22 @@
}

class { 'icinga::web':
backend_db_type => $icinga::ido::db_type,
backend_db_host => $icinga::ido::db_host,
backend_db_pass => $icinga::ido::db_pass,
db_type => 'pgsql',
db_host => 'localhost',
db_pass => 'icingaweb2',
default_admin_user => 'admin',
default_admin_pass => 'admin',
manage_database => true,
api_pass => $icinga::server::web_api_pass,
}

class { 'icinga::web::monitoring':
db_type => $icinga::ido::db_type,
db_host => $icinga::ido::db_host,
db_pass => $icinga::ido::db_pass,
}

class { 'icinga::web::director':
db_type => 'pgsql',
db_host => 'localhost',
db_pass => 'director',
manage_database => true,
endpoint => $facts['networking']['fqdn'],
Expand Down
Loading

0 comments on commit 68e23a8

Please sign in to comment.