summaryrefslogtreecommitdiff
path: root/manifests/register/snmp.pp
blob: 3007b6764cbfc2e331c6e291c5a2e69351f2320b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
define munin::register::snmp (
  $community = 'public',
  $description = 'absent',
  $port = 'absent'
) {
  $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",
  }

  @@concat::fragment{ "munin_snmp_${fhost}":
    target => '/etc/munin/munin.conf',
    content => template("munin/client.erb"),
    tag => 'munin',
  }
}