From 334b4a3ba627ddf481d68f8f29c925895470de62 Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Mon, 27 Sep 2010 12:10:02 +0200 Subject: use better snmp register define --- manifests/register/snmp.pp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 manifests/register/snmp.pp (limited to 'manifests/register/snmp.pp') diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp new file mode 100644 index 0000000..c0d9279 --- /dev/null +++ b/manifests/register/snmp.pp @@ -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', + } +} -- cgit v1.2.3 From f3acecb57d7fde7760f2b74506589b9f4565947a Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Mon, 27 Sep 2010 12:30:08 +0200 Subject: use shell so we can actually pipe that command --- manifests/register/snmp.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/register/snmp.pp') diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index c0d9279..0c3ac5c 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -9,7 +9,7 @@ define munin::register::snmp ( $config = [ 'use_node_name no' ] exec { "munin_register_snmp_${fhost}": - command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} | sh", + command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --shell | sh", unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null", } -- cgit v1.2.3 From 9b0b698523987b7631478bcf7dc84acf5e0e719c Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Thu, 4 Aug 2011 10:48:57 +0200 Subject: move from concatenated_file to concat --- manifests/register/snmp.pp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'manifests/register/snmp.pp') diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index 0c3ac5c..5a1f42d 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -13,9 +13,8 @@ define munin::register::snmp ( unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null", } - @@file { "munin_snmp_${fhost}": - ensure => present, - path => "/var/lib/puppet/modules/munin/nodes/${fhost}", + @@concat::fragment{ "munin_snmp_${fhost}": + target => '/etc/munin/munin.conf', content => template("munin/client.erb"), tag => 'munin', } -- cgit v1.2.3 From 8e874720bf878a09a425d3323095202b1ca36846 Mon Sep 17 00:00:00 2001 From: Marcel Haerry Date: Thu, 4 Aug 2011 14:19:39 +0200 Subject: Also provide port for snmp nodes --- manifests/register/snmp.pp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'manifests/register/snmp.pp') diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index 5a1f42d..c45adb0 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -1,6 +1,7 @@ define munin::register::snmp ( $community = 'public', - $description = 'absent' + $description = 'absent', + $port = 'absent' ) { $fhost = $name @@ -8,6 +9,14 @@ define munin::register::snmp ( $client_type = 'snmp' $config = [ 'use_node_name no' ] + $munin_port_real = $port ? { + 'absent' => $munin_port ? { + '' => 4949, + default => $munin_port + }, + default => $port + } + exec { "munin_register_snmp_${fhost}": command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --shell | sh", unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null", -- cgit v1.2.3 From 9b161f0c61bbd30960e663eceef8f1b35f633507 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 5 Nov 2011 14:14:32 +0100 Subject: use hiera to configure munin node specific things --- manifests/register/snmp.pp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'manifests/register/snmp.pp') diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index c45adb0..a4d0d88 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -10,10 +10,7 @@ define munin::register::snmp ( $config = [ 'use_node_name no' ] $munin_port_real = $port ? { - 'absent' => $munin_port ? { - '' => 4949, - default => $munin_port - }, + 'absent' => hiera('munin_port','4949'), default => $port } -- cgit v1.2.3 From e2dfae5852ecdf3695a6af8ec48092ea24698390 Mon Sep 17 00:00:00 2001 From: "Christian G. Warden" Date: Thu, 2 Feb 2012 18:10:14 -0800 Subject: Fully qualify facter variables --- manifests/register/snmp.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/register/snmp.pp') diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index a4d0d88..acd1e03 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -5,7 +5,7 @@ define munin::register::snmp ( ) { $fhost = $name - $munin_host_real = $fqdn + $munin_host_real = $::fqdn $client_type = 'snmp' $config = [ 'use_node_name no' ] -- cgit v1.2.3 From 9fd1de5acd9064a0d67ca9d2c13a829a3f628f39 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 5 Jun 2012 19:39:49 -0300 Subject: new style for 2.7 --- manifests/register/snmp.pp | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'manifests/register/snmp.pp') diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index acd1e03..3007b67 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -2,26 +2,25 @@ define munin::register::snmp ( $community = 'public', $description = 'absent', $port = 'absent' -) -{ - $fhost = $name - $munin_host_real = $::fqdn - $client_type = 'snmp' - $config = [ 'use_node_name no' ] +) { + $fhost = $name + $munin_host_real = $::fqdn + $client_type = 'snmp' + $config = [ 'use_node_name no' ] - $munin_port_real = $port ? { - 'absent' => hiera('munin_port','4949'), - default => $port - } + $munin_port_real = $port ? { + 'absent' => hiera('munin_port','4949'), + default => $port + } - exec { "munin_register_snmp_${fhost}": - command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --shell | sh", - unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null", - } + exec { "munin_register_snmp_${fhost}": + command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --shell | sh", + unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null", + } - @@concat::fragment{ "munin_snmp_${fhost}": - target => '/etc/munin/munin.conf', - content => template("munin/client.erb"), - tag => 'munin', - } + @@concat::fragment{ "munin_snmp_${fhost}": + target => '/etc/munin/munin.conf', + content => template("munin/client.erb"), + tag => 'munin', + } } -- cgit v1.2.3 From c95f0b2fcf4f35b1a7ae3ad9c04600a32ab2bb43 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 13 Jun 2012 20:40:57 -0300 Subject: migrate away from hiera stuff --- manifests/register/snmp.pp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'manifests/register/snmp.pp') diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index 3007b67..78c3e91 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -1,18 +1,13 @@ define munin::register::snmp ( $community = 'public', $description = 'absent', - $port = 'absent' + $port = '4949', + $host = $::fqdn ) { $fhost = $name - $munin_host_real = $::fqdn $client_type = 'snmp' $config = [ 'use_node_name no' ] - $munin_port_real = $port ? { - 'absent' => hiera('munin_port','4949'), - default => $port - } - exec { "munin_register_snmp_${fhost}": command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --shell | sh", unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null", -- cgit v1.2.3