summaryrefslogtreecommitdiffstats
path: root/modules/munin/manifests/node.pp
blob: d2ae67b19685e2273e1a8f0b19d59dcb704c27e4 (plain) (blame)
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
class munin::node {
  package { 'munin-node':
  }

  service { 'munin-node':
    ensure => running,
    enable => true,
    require => [
      Package['munin-node'],
      Exec['/usr/bin/systemctl daemon-reload'],
    ],
    subscribe => [
      File['/etc/munin/munin-node.conf'],
      File['/etc/systemd/system/munin-node.service.d/override.conf'],
    ];
  }

  file {
    '/etc/munin/munin-node.conf':
      content => template('munin/munin-node.conf'),
      require => Package['munin-node'];
    '/etc/systemd/system/munin-node.service.d':
      ensure => directory;
    '/etc/systemd/system/munin-node.service.d/override.conf':
      source => 'puppet:///modules/munin/override.conf',
      notify => Exec["/usr/bin/systemctl daemon-reload"],
      require => File["/etc/systemd/system/munin-node.service.d"];
  }

  # XXX backport a fix since the arch linux package is out of date
  # this can be removed once the arch package upgrades to at least 2.0.28
  exec { 'fix munin if plugin speed calculation':
    provider => shell,
    command => "sed -i 's/if \\[\\[ -n \"\$SPEED\" ]]; then/if [[ \"\$SPEED\" -gt 0 ]]; then/' /usr/lib/munin/plugins/if_",
    onlyif => "grep -qF 'if [[ -n \"\$SPEED\" ]]; then' /usr/lib/munin/plugins/if_",
    require => Package['munin-node'];
  }
}