use better snmp register define
authorMarcel Haerry <haerry@puzzle.ch>
Mon, 27 Sep 2010 10:10:02 +0000 (12:10 +0200)
committerMarcel Haerry <haerry@puzzle.ch>
Mon, 27 Sep 2010 10:10:02 +0000 (12:10 +0200)
manifests/register/snmp.pp [new file with mode: 0644]
manifests/register_snmp.pp [deleted file]

diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp
new file mode 100644 (file)
index 0000000..c0d9279
--- /dev/null
@@ -0,0 +1,22 @@
+define munin::register::snmp (
+  $community = 'public',
+  $description = 'absent'
+)
+{
+    $fhost = $name
+    $munin_host_real = $fqdn
+    $client_type = 'snmp'
+    $config = [ 'use_node_name no' ]
+
+    exec { "munin_register_snmp_${fhost}":
+        command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} | sh",
+        unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null",
+    }
+
+    @@file { "munin_snmp_${fhost}":
+        ensure => present,
+        path => "/var/lib/puppet/modules/munin/nodes/${fhost}",
+        content => template("munin/client.erb"),
+        tag => 'munin',
+    }
+}
diff --git a/manifests/register_snmp.pp b/manifests/register_snmp.pp
deleted file mode 100644 (file)
index e74ba44..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# snmp_testplugin: the plugin we use to test if it's set
-define munin::register_snmp(
-    $snmpd_testplugin = 'load'
-)
-{
-       $munin_port_real = $munin_port ? { '' => 4949, default => $munin_port } 
-       $munin_host_real = $munin_host ? {
-               '' => '*',
-               'fqdn' => '*',
-               default => $munin_host
-    }
-    exec{"register_snmp_munin_for_${name}":
-        command => "munin-node-configure-snmp ${name} | sh",
-        unless => "test -e /etc/munin/plugins/snmp_${name}_${snmpd_testplugin}",
-    }
-    @@file { "munin_snmp_${name}": path => "/var/lib/puppet/modules/munin/nodes/${name}",
-        ensure => present,
-        content => template("munin/snmpclient.erb"),
-        tag => 'munin',
-    }
-}