]> gitweb.fluxo.info Git - puppet-nodo.git/commitdiff
Enhanced munin_node definition
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 19 Feb 2010 02:31:43 +0000 (00:31 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 19 Feb 2010 02:31:43 +0000 (00:31 -0200)
manifests/init.pp
manifests/munin.pp

index 50b05023a2078ceadf9da08d70719dde803b984b..8c44f99f9f6c51e322d3fcf4f7ba6c78292b1572 100644 (file)
@@ -182,12 +182,12 @@ class nodo::vserver inherits nodo {
   }
 
   # Apply munin configuration for this node
-  Munin_node <<| tag == $hostname |>>
+  Munin_node <<| title == $hostname |>>
 
   # We include munin configuration if it's not defined by
   # and exported resource.
   if !defined(munin::client) {
-    include munin::client
+    munin_node { "$hostname": }
   }
 
   # Define a vserver instance
@@ -224,8 +224,7 @@ class nodo::vserver inherits nodo {
 
     # Create a munin virtual resource to be realized in the node
     @@munin_node { "$name":
-      id  => $id,
-      tag => $name,
+      port => "49$id",
     }
 
     # Sound support
index 1795226f3687fd9d51e118c80dbf93dc753171b8..f0dac880bffdc92e36adc1006463b8e565ef2cb0 100644 (file)
@@ -1,6 +1,19 @@
-# Define a munin node with custom port
-define munin_node($id) {
-  # Use one port for each node
-  $munin_port = "49$id"
+# Define a munin node
+define munin_node($port = '4949') {
+
+  case $global_munin_allow {
+    '': { fail("Please set \$global_munin_allow in your site config") }
+  }
+
+  $munin_allow = $node_munin_allow ? {
+    ''      => $global_munin_allow,
+    default => $node_munin_allow,
+  }
+
+  $munin_port = $node_munin_port ? {
+    ''      => $port
+    default => $node_munin_port,
+  }
+
   include munin::client
 }