Alexandros Kosiaris has submitted this change and it was merged.

Change subject: Revert "monitoring: Export based on class icinga inclusion"
......................................................................


Revert "monitoring: Export based on class icinga inclusion"

This breaks somehow on other hosts, reverting while investigation is
ongoing
This reverts commit 3fa63cfb7845898906df8b64e912abac90245eb7.

Change-Id: Id4a9599ef677c2c5f87fd374f367ab787e711faa
---
M modules/icinga/templates/icinga.cfg.erb
M modules/monitoring/manifests/host.pp
M modules/monitoring/manifests/service.pp
3 files changed, 5 insertions(+), 11 deletions(-)

Approvals:
  Alexandros Kosiaris: Verified; Looks good to me, approved



diff --git a/modules/icinga/templates/icinga.cfg.erb 
b/modules/icinga/templates/icinga.cfg.erb
index dff6a84..6ec5252 100644
--- a/modules/icinga/templates/icinga.cfg.erb
+++ b/modules/icinga/templates/icinga.cfg.erb
@@ -36,7 +36,6 @@
 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
@@ -49,9 +48,6 @@
 # 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 9d8779a..585dab7 100644
--- a/modules/monitoring/manifests/host.pp
+++ b/modules/monitoring/manifests/host.pp
@@ -7,6 +7,7 @@
     $group         = undef,
     $ensure        = present,
     $critical      = false,
+    $exported      = true,
     $contact_group = hiera('contactgroups', 'admins')
     ) {
 
@@ -66,9 +67,7 @@
             statusmap_image       => $statusmap_image,
         }
     }
-    # 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']) {
+    if $exported {
         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 8206421..39a540b 100644
--- a/modules/monitoring/manifests/service.pp
+++ b/modules/monitoring/manifests/service.pp
@@ -7,6 +7,7 @@
     $ensure                = present,
     $critical              = false,
     $passive               = false,
+    $exported              = true,
     $freshness             = 36000,
     $normal_check_interval = 1,
     $retry_check_interval  = 1,
@@ -70,7 +71,7 @@
         default => undef,
     }
 
-    # the nagios service instance
+    # Export the nagios service instance
     $service = {
         "${::hostname} ${title}" => {
             ensure                 => $ensure,
@@ -94,9 +95,7 @@
             freshness_threshold    => $is_fresh,
         }
     }
-    # 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']) {
+    if $exported {
         create_resources('@@nagios_service', $service)
     } else {
         create_resources(nagios_service, $service)

-- 
To view, visit https://gerrit.wikimedia.org/r/316330
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id4a9599ef677c2c5f87fd374f367ab787e711faa
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Alexandros Kosiaris <akosia...@wikimedia.org>
Gerrit-Reviewer: Alexandros Kosiaris <akosia...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to