Alexandros Kosiaris has uploaded a new change for review. https://gerrit.wikimedia.org/r/315970
Change subject: monitoring: Export based on class icinga inclusion ...................................................................... monitoring: Export based on class icinga inclusion nstead of using the exported parameter, which exposes an internal detail to the user, detect the scope we are running on and decide whether we want to export or not the resource. Remove the exported parameter since it's now useless Make sure we use the corresponding files in the icinga.cfg configuration file Change-Id: I0137df84c89fcf78dc301075459bc0a1aa7ad6f3 --- M modules/icinga/templates/icinga.cfg.erb M modules/monitoring/manifests/host.pp M modules/monitoring/manifests/service.pp 3 files changed, 11 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/70/315970/1 diff --git a/modules/icinga/templates/icinga.cfg.erb b/modules/icinga/templates/icinga.cfg.erb index 6ec5252..dff6a84 100644 --- a/modules/icinga/templates/icinga.cfg.erb +++ b/modules/icinga/templates/icinga.cfg.erb @@ -36,6 +36,7 @@ cfg_file=/etc/icinga/contacts.cfg cfg_file=/etc/icinga/timeperiods.cfg cfg_file=/etc/icinga/notification_commands.cfg +# We use naggen2 for those cfg_file=/etc/icinga/puppet_hosts.cfg cfg_file=/etc/icinga/puppet_hostextinfo.cfg cfg_file=/etc/icinga/puppet_services.cfg @@ -48,6 +49,9 @@ # backwards compatibility with old nagios installation cfg_file=/etc/nagios/puppet_hostgroups.cfg cfg_file=/etc/nagios/puppet_servicegroups.cfg +# These are locally generated hosts (like routers, pdus). We do not use naggen2 for these +cfg_file=/etc/nagios/nagios_host.cfg +cfg_file=/etc/nagios/nagios_service.cfg # passive checks via nsca from fundraising systems cfg_file=/etc/icinga/nsca_frack.cfg diff --git a/modules/monitoring/manifests/host.pp b/modules/monitoring/manifests/host.pp index 585dab7..9d8779a 100644 --- a/modules/monitoring/manifests/host.pp +++ b/modules/monitoring/manifests/host.pp @@ -7,7 +7,6 @@ $group = undef, $ensure = present, $critical = false, - $exported = true, $contact_group = hiera('contactgroups', 'admins') ) { @@ -67,7 +66,9 @@ statusmap_image => $statusmap_image, } } - if $exported { + # This is a hack. We detect if we are running on the scope of an icinga + # host and avoid exporting the resource if yes + if defined(Class['icinga']) { create_resources('@@nagios_host', $host) } else { create_resources(nagios_host, $host) diff --git a/modules/monitoring/manifests/service.pp b/modules/monitoring/manifests/service.pp index 39a540b..8206421 100644 --- a/modules/monitoring/manifests/service.pp +++ b/modules/monitoring/manifests/service.pp @@ -7,7 +7,6 @@ $ensure = present, $critical = false, $passive = false, - $exported = true, $freshness = 36000, $normal_check_interval = 1, $retry_check_interval = 1, @@ -71,7 +70,7 @@ default => undef, } - # Export the nagios service instance + # the nagios service instance $service = { "${::hostname} ${title}" => { ensure => $ensure, @@ -95,7 +94,9 @@ freshness_threshold => $is_fresh, } } - if $exported { + # This is a hack. We detect if we are running on the scope of an icinga + # host and avoid exporting the resource if yes + if defined(Class['icinga']) { create_resources('@@nagios_service', $service) } else { create_resources(nagios_service, $service) -- To view, visit https://gerrit.wikimedia.org/r/315970 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0137df84c89fcf78dc301075459bc0a1aa7ad6f3 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Alexandros Kosiaris <akosia...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits