]> gitweb.fluxo.info Git - puppet-nodo.git/commitdiff
Adding monitor class to wrap around nagios
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 20 Jan 2013 18:35:53 +0000 (16:35 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 20 Jan 2013 18:35:53 +0000 (16:35 -0200)
manifests/host.pp
manifests/init.pp
manifests/personal.pp
manifests/subsystems/monitor.pp [new file with mode: 0644]
manifests/vserver.pp

index fe1ca61104dfd51e52fbdd7dee6d58859d830311..cae28ce5e60f41ddfb193f74237b7e4b212d3c18 100644 (file)
@@ -17,14 +17,10 @@ class nodo::host inherits nodo {
   $vserver_vdirbase = "/var/vservers"
   include vserver::host
 
-  if $use_nagios != false {
-    if $use_nagios_fqdn == true {
-      include nagios::target::fqdn
-    }
-    else {
-      include nagios::target
-    }
-    nagios::service::ping { "$fqdn": }
+  # Monitoring
+  class { 'monitor':
+    type       => 'host',
+    use_nagios => extlookup('host_use_nagios', 'true'),
   }
 
   # Time configuration
index a3f32bf84f24fe44766b545f310b402f67a1dea3..2c08011d6fd38553e0d024e687934f8b3ce10517 100644 (file)
@@ -84,6 +84,7 @@ import "subsystems/resolver.pp"
 import "subsystems/domain.pp"
 import "subsystems/dhclient.pp"
 import "subsystems/mount.pp"
+import "subsystems/monitor.pp"
 import "subsystems/utils.pp"
 import "subsystems/utils/debian.pp"
 import "subsystems/utils/desktop.pp"
index 721836b83b9470cceb62d4715a1a23b3e06efba1..1626f0c32938eacfc9c72f9774408e5b470309e8 100644 (file)
@@ -1,10 +1,5 @@
 # personal computer
 class nodo::personal {
-
-  case $use_nagios {
-    '': { $use_nagios = false }
-  }
-
   include nodo::physical
   include utils::personal
   include pam
@@ -14,6 +9,12 @@ class nodo::personal {
     include gdm
   }
 
+  # Monitoring
+  class { 'monitor':
+    type       => 'personal',
+    use_nagios => extlookup('personal_use_nagios', 'false'),
+  }
+
   # Currently tor management just works for debian
   case $operatingsystem {
     debian: { 
diff --git a/manifests/subsystems/monitor.pp b/manifests/subsystems/monitor.pp
new file mode 100644 (file)
index 0000000..5be3509
--- /dev/null
@@ -0,0 +1,25 @@
+class monitor(
+  $type = 'vserver',
+  $use_nagios = true,
+) {
+
+  if $use_nagios != false {
+
+    if $type == 'vserver' {
+      include nagios::target::fqdn
+        nagios::service::ping { "$fqdn": }
+    }
+
+    if $type == 'host' or $type == 'personal' {
+      if extlookup('use_nagios_fqdn', false) == true {
+        include nagios::target::fqdn
+      }
+      else {
+        include nagios::target
+      }
+      nagios::service::ping { "$fqdn": }
+    }
+
+  }
+
+}
index fdd8ed26b18f36854e766ee997ff5a0db4cfa2b8..21bed2638791b7e4e8fd3015c0c0b5f9c4a7cc6c 100644 (file)
@@ -46,9 +46,9 @@ class nodo::vserver inherits nodo {
       }
 
       # Nagios configuration
-      if $use_nagios != false {
-        include nagios::target::fqdn
-        nagios::service::ping { "$fqdn": }
+      class { 'monitor':
+        type       => 'vserver',
+        use_nagios => extlookup('vserver_use_nagios', 'false'),
       }
     }
   }