]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/munin-node/manifests/init.pp
reshuffle things around
[dsa-puppet.git] / modules / munin-node / manifests / init.pp
1 define activate_munin_check($ensure=present, $script = none) {
2     case $script {
3         none: { $link = $name }
4         default: { $link = $script }
5     }
6
7     case $ensure {
8         present: {
9             file { "/etc/munin/plugins/$name":
10                      ensure => "/usr/share/munin/plugins/$link",
11                      notify => Exec["munin-node restart"];
12             }
13         }
14         default: {
15             file { "/etc/munin/plugins/$name":
16                      ensure => $ensure,
17                      notify => Exec["munin-node restart"];
18             }
19         }
20     }
21 }
22
23 class munin-node {
24
25     package { munin-node: ensure => installed }
26
27     activate_munin_check {
28         "cpu":;
29         "df":;
30         "df_abs":;
31         "df_inode":;
32         "entropy":;
33         "forks":;
34         "interrupts":;
35         "iostat":;
36         "irqstats":;
37         "load":;
38         "memory":;
39         "ntp_offset":;
40         "ntp_states":;
41         "open_files":;
42         "open_inodes":;
43         "processes":;
44         "swap":;
45         "uptime":;
46         "vmstat":;
47     }
48
49     case $spamd {
50         "true": {
51               activate_munin_check { "spamassassin":; }
52         }
53     }
54
55     case $vsftpd {
56         "true": {
57               include munin-node::vsftpd
58         }
59     }
60
61     file {
62         "/etc/munin/munin-node.conf":
63             source  => [ "puppet:///munin-node/per-host/$fqdn/munin-node.conf",
64                          "puppet:///munin-node/common/munin-node.conf" ],
65             require => Package["munin-node"],
66             notify  => Exec["munin-node restart"];
67
68         "/etc/munin/plugin-conf.d/munin-node":
69             content => template("munin-node/munin-node.plugin.conf.erb"),
70             require => Package["munin-node"],
71             notify  => Exec["munin-node restart"];
72     }
73
74     exec { "munin-node restart":
75         path        => "/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin",
76         refreshonly => true,
77     }
78    ferm::rule { "dsa-munin":
79            description     => "Allow munin from munin master",
80            rule            => "proto tcp mod state state (NEW) dport (munin) @subchain 'munin' { saddr (\$HOST_MUNIN) ACCEPT; }"
81    }
82 }
83