Alexandros Kosiaris has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/343036 )

Change subject: Amend "Revert "nagios: Specify a parents host relationship""
......................................................................


Amend "Revert "nagios: Specify a parents host relationship""

Only merge this when we have our networking devices in icinga

This amends commit 0d4c9bbfd541e3e62781ecb68fabd47956f38a26 to fix a
minor bug.

Change-Id: I65abe9d32b7342a08002c9efdfcbb790f5f1e7c9
---
M modules/monitoring/manifests/host.pp
1 file changed, 14 insertions(+), 1 deletion(-)

Approvals:
  Alexandros Kosiaris: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/monitoring/manifests/host.pp 
b/modules/monitoring/manifests/host.pp
index f13e20a..a9f1190 100644
--- a/modules/monitoring/manifests/host.pp
+++ b/modules/monitoring/manifests/host.pp
@@ -32,7 +32,11 @@
         default => $contact_group,
     }
 
-    # Export the nagios host instance
+    # Define the nagios host instance
+    # The following if guard is there to ensure we only try to set per host
+    # attributes in the case the host exports it's configuration. Since this
+    # definition is also used for non-exported resources as well, this if guard
+    # is required
     if $title == $::hostname {
         $image = $::operatingsystem ? {
             'Ubuntu'  => 'ubuntu',
@@ -42,15 +46,24 @@
         $icon_image      = "vendors/${image}.png"
         $vrml_image      = "vendors/${image}.png"
         $statusmap_image = "vendors/${image}.gd2"
+        # TODO: Make this better by getting all LLDP peers on all physical 
(only!) interfaces
+        # map() would have been great for this.
+        if $facts['lldppeer_eth0'] {
+            $parents = $facts['lldppeer_eth0']
+        } else {
+            $parents = undef
+        }
     } else {
         $icon_image      = undef
         $vrml_image      = undef
         $statusmap_image = undef
+        $parents = undef
     }
     $host = {
         "${title}" => {
             ensure                => $ensure,
             host_name             => $title,
+            parents               => $parents,
             address               => $nagios_address,
             hostgroups            => $hostgroup,
             check_command         => 'check_ping!500,20%!2000,100%',

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I65abe9d32b7342a08002c9efdfcbb790f5f1e7c9
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Alexandros Kosiaris <akosia...@wikimedia.org>
Gerrit-Reviewer: Alexandros Kosiaris <akosia...@wikimedia.org>
Gerrit-Reviewer: Giuseppe Lavagetto <glavage...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to