diff --git a/site-modules/profile/manifests/icinga2/master.pp b/site-modules/profile/manifests/icinga2/master.pp index 00316266..cc6b865c 100644 --- a/site-modules/profile/manifests/icinga2/master.pp +++ b/site-modules/profile/manifests/icinga2/master.pp @@ -1,96 +1,103 @@ # An icinga master host class profile::icinga2::master { $zonename = lookup('icinga2::master::zonename') $features = lookup('icinga2::features') $icinga2_network = lookup('icinga2::network') $hiera_host_vars = lookup('icinga2::host::vars', Hash, 'deep') $icinga2_db_username = lookup('icinga2::master::db::username') $icinga2_db_password = lookup('icinga2::master::db::password') $icinga2_db_database = lookup('icinga2::master::db::database') include profile::icinga2::objects include profile::icinga2::objects::agent_checks $local_host_vars = { disks => hash(flatten( $::mounts.map |$mount| { ["disk ${mount}", {disk_partitions => $mount}] }, )), plugins => keys($profile::icinga2::objects::agent_checks::plugins), } include ::postgresql::server ::postgresql::server::db {$icinga2_db_database: user => $icinga2_db_username, password => postgresql_password($icinga2_db_username, $icinga2_db_password) } class {'::icinga2': confd => true, features => $features, constants => { 'ZoneName' => $zonename, }, } class { '::icinga2::feature::api': pki => 'puppet', accept_commands => true, zones => { $zonename => { endpoints => ['NodeName'], } }, } class { '::icinga2::feature::idopgsql': user => $icinga2_db_username, password => $icinga2_db_password, database => $icinga2_db_database, import_schema => true, require => Postgresql::Server::Db[$icinga2_db_database], } @@::icinga2::object::host {$::fqdn: address => ip_for_network($icinga2_network), display_name => $::fqdn, check_command => 'hostalive', vars => deep_merge($local_host_vars, $hiera_host_vars), target => "/etc/icinga2/zones.d/${zonename}/${::fqdn}.conf", } + ::icinga2::object::service {'check-deposit': + import => ['generic-service-check-e2e'], + apply => true, + check_command => 'check-deposit-cmd', + target => "/etc/icinga2/zones.d/${zonename}/${::fqdn}.conf", + } + ::Icinga2::Object::Host <<| |>> ::Icinga2::Object::Endpoint <<| |>> ::Icinga2::Object::Zone <<| |>> ::icinga2::object::zone { 'global-templates': global => true, } file {[ '/etc/icinga2/zones.d/global-templates', "/etc/icinga2/zones.d/${zonename}", ]: ensure => directory, owner => 'nagios', group => 'nagios', mode => '0755', tag => 'icinga2::config::file', recurse => true, purge => true, } file {'/etc/icinga2/conf.d': ensure => directory, owner => 'nagios', group => 'nagios', mode => '0755', purge => true, recurse => true, tag => 'icinga2::config::file', } } diff --git a/site-modules/profile/manifests/icinga2/objects/e2e_checks.pp b/site-modules/profile/manifests/icinga2/objects/e2e_checks.pp index bfc7e0e1..3b303e41 100644 --- a/site-modules/profile/manifests/icinga2/objects/e2e_checks.pp +++ b/site-modules/profile/manifests/icinga2/objects/e2e_checks.pp @@ -1,35 +1,39 @@ # swh's end-to-end checks on the icinga master class profile::icinga2::objects::e2e_checks { $checks_file = '/etc/icinga2/conf.d/e2e-checks.conf' $deposit_server = lookup('swh::deploy::deposit::e2e::server') $deposit_user = lookup('swh::deploy::deposit::e2e::user') $deposit_pass = lookup('swh::deploy::deposit::e2e::password') $deposit_collection = lookup('swh::deploy::deposit::e2e::collection') $deposit_poll_interval = lookup('swh::deploy::deposit::e2e::poll_interval') $deposit_archive = lookup('swh::deploy::deposit::e2e:archive') $deposit_metadata = lookup('swh::deploy::deposit::e2e:metadata') $packages = ["python3-swh.icingaplugins"] package {$packages: ensure => present } - ::icinga2::object::checkcommand {'check_deposit': + $template_file = '/etc/icinga2/conf.d/templates.conf' + + ::icinga2::object::checkcommand {'check-deposit-cmd': import => ['plugin-check-command'], command => [ "/usr/bin/swh", "icinga_plugins", "check-deposit", "--server", "${deposit_server}", "--user", "${deposit_user}", "--password", "${deposit_pass}", "--collection", "${deposit_collection}", "--poll-interval", "${deposit_poll_interval}", "single", "--archive", "${deposit_archive}", "--metadata", "${deposit_metadata}", ], + # XXX: Should probably be split into usual commands with arguments + # arguments => ... target => $checks_file, require => Package[$packages] } } diff --git a/site-modules/profile/manifests/icinga2/objects/templates.pp b/site-modules/profile/manifests/icinga2/objects/templates.pp index 8e646903..b776734d 100644 --- a/site-modules/profile/manifests/icinga2/objects/templates.pp +++ b/site-modules/profile/manifests/icinga2/objects/templates.pp @@ -1,60 +1,68 @@ # Icinga2 object template definitions class profile::icinga2::objects::templates { $template_file = '/etc/icinga2/conf.d/templates.conf' ::icinga2::object::host {'generic-host': template => true, max_check_attempts => 3, check_interval => '1m', retry_interval => '30s', check_command => 'hostalive', target => $template_file, } ::icinga2::object::service {'generic-service': template => true, max_check_attempts => 5, check_interval => '1m', retry_interval => '30s', target => $template_file, } ::icinga2::object::user {'generic-user': template => true, target => $template_file, } ::icinga2::object::notification {'host-notification': template => true, states => ['Up', 'Down'], types => [ 'Problem', 'Acknowledgement', 'Recovery', 'Custom', 'FlappingStart', 'FlappingEnd', 'DowntimeStart', 'DowntimeEnd', 'DowntimeRemoved', ], period => '24x7', target => $template_file, } ::icinga2::object::notification {'service-notification': template => true, states => ['OK', 'Warning', 'Critical', 'Unknown' ], types => [ 'Problem', 'Acknowledgement', 'Recovery', 'Custom', 'FlappingStart', 'FlappingEnd', 'DowntimeStart', 'DowntimeEnd', 'DowntimeRemoved', ], period => '24x7', target => $template_file, } each(['host', 'service']) |$type| { each(['irc', 'mail']) |$means| { ::icinga2::object::notification {"${means}-${type}-notification": template => true, import => ["${type}-notification"], command => "${means}-${type}-notification", target => $template_file, } } } + + ::icinga2::object::service {'generic-service-check-e2e': + template => true, + max_check_attempts => 5, + check_interval => '24h', + retry_interval => '30s', + target => $template_file, + } }