]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/munin-node/manifests/init.pp
(www) Add redirections for some old Refresh hacks
[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         "entropy":;
30         "forks":;
31         "interrupts":;
32         "iostat":;
33         "irqstats":;
34         "load":;
35         "memory":;
36         "ntp_offset":;
37         "ntp_states":;
38         "open_files":;
39         "open_inodes":;
40         "processes":;
41         "swap":;
42         "uptime":;
43         "vmstat":;
44     }
45
46     case $spamd {
47         "true": {
48               activate_munin_check { "spamassassin":; }
49         }
50     }
51
52     case $vsftpd {
53         "true": {
54               package { 
55                       "logtail": ensure => installed;
56               }
57               activate_munin_check {
58                       "vsftpd":;
59                       "ps_vsftpd": script => "ps_";
60               }
61         }
62     }
63
64     file {
65         "/etc/munin/munin-node.conf":
66             content => template("munin-node/munin-node.conf.erb"),
67             require => Package["munin-node"],
68             notify  => Exec["munin-node restart"];
69
70         "/etc/munin/plugin-conf.d/munin-node":
71             content => template("munin-node/munin-node.plugin.conf.erb"),
72             require => Package["munin-node"],
73             notify  => Exec["munin-node restart"];
74
75         "/etc/munin/plugins/df":
76             source  => "puppet:///modules/munin-node/df-wrap",
77             mode    => 555,
78             require => Package["munin-node"],
79             notify  => Exec["munin-node restart"]
80             ;
81         "/etc/munin/plugins/df_abs":
82             source  => "puppet:///modules/munin-node/df-wrap",
83             mode    => 555,
84             require => Package["munin-node"],
85             notify  => Exec["munin-node restart"]
86             ;
87         "/etc/munin/plugins/df_inode":
88             source  => "puppet:///modules/munin-node/df-wrap",
89             mode    => 555,
90             require => Package["munin-node"],
91             notify  => Exec["munin-node restart"]
92             ;
93     }
94
95     exec { "munin-node restart":
96         path        => "/etc/init.d:/usr/bin:/usr/sbin:/bin:/sbin",
97         refreshonly => true,
98     }
99     @ferm::rule { "dsa-munin-v4":
100             description     => "Allow munin from munin master",
101             rule            => "proto tcp mod state state (NEW) dport (munin) @subchain 'munin' { saddr (\$HOST_MUNIN_V4 \$HOST_NAGIOS_V4) ACCEPT; }",
102             notarule        => true,
103     }
104     @ferm::rule { "dsa-munin-v6":
105             description     => "Allow munin from munin master",
106             domain          => "ip6",
107             rule            => "proto tcp mod state state (NEW) dport (munin) @subchain 'munin' { saddr (\$HOST_MUNIN_V6 \$HOST_NAGIOS_V6) ACCEPT; }",
108             notarule        => true,
109     }
110 }
111
112 # vim:set et:
113 # vim:set sts=4 ts=4:
114 # vim:set shiftwidth=4: