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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
# client.pp - configure a munin node
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
class munin::client {
$munin_port_real = $munin_port ? { '' => 4949, default => $munin_port }
$munin_host_real = $munin_host ? {
'' => '*',
'fqdn' => '*',
default => $munin_host
}
case $operatingsystem {
darwin: { include munin::client::darwin }
debian: { include munin::client::debian }
ubuntu: { include munin::client::ubuntu }
centos: { include munin::client::centos }
gentoo: { include munin::client::gentoo }
default: { include munin::client::base }
}
}
define munin::register()
{
$munin_port_real = $munin_port ? { '' => 4949, default => $munin_port }
$munin_host_real = $munin_host ? {
'' => $fqdn,
'fqdn' => $fqdn,
default => $munin_host
}
@@file { "${NODESDIR}/${name}_${munin_port_real}":
ensure => present,
content => template("munin/defaultclient.erb"),
tag => 'munin',
}
}
define munin::register_snmp()
{
@@file { "munin_snmp_${name}": path => "${NODESDIR}/${name}",
ensure => present,
content => template("munin/snmpclient.erb"),
tag => 'munin',
}
}
class munin::client::base {
package { "munin-node": ensure => installed }
service { "munin-node":
ensure => running,
hasstatus => true,
hasrestart => true,
require => Package[munin-node],
}
file {
"/etc/munin/":
ensure => directory,
mode => 0755, owner => root, group => 0;
"/etc/munin/munin-node.conf":
content => template("munin/munin-node.conf.$operatingsystem.$lsbdistrelease"),
mode => 0644, owner => root, group => 0,
# this has to be installed before the package, so the postinst can
# boot the munin-node without failure!
before => Package["munin-node"],
}
munin::register { $fqdn: }
include munin::plugins::base
}
class munin::client::darwin {
file { "/usr/share/snmp/snmpd.conf":
mode => 744,
content => template("munin/darwin_snmpd.conf.erb"),
group => 0,
owner => root,
}
delete_matching_line{"startsnmpdno":
file => "/etc/hostconfig",
pattern => "SNMPSERVER=-NO-",
}
line { "startsnmpdyes":
file => "/etc/hostconfig",
line => "SNMPSERVER=-YES-",
notify => Exec["/sbin/SystemStarter start SNMP"],
}
exec{"/sbin/SystemStarter start SNMP":
noop => false,
}
munin::register_snmp { $fqdn: }
}
class munin::client::debian inherits munin::client::base {
# the plugin will need that
package { "iproute": ensure => installed }
Service["munin-node"]{
# sarge's munin-node init script has no status
hasstatus => $lsbdistcodename ? { sarge => false, default => true }
}
# workaround bug in munin_node_configure
plugin { "postfix_mailvolume": ensure => absent }
include munin::plugins::debian
}
class munin::client::ubuntu inherits munin::client::debian {}
class munin::client::gentoo inherits munin::client::base {
Package['munin-node'] {
name => 'munin',
category => 'net-analyzer',
}
include munin::plugins::gentoo
}
class munin::client::centos inherits munin::client::base {
include munin::plugins::centos
}
|