blob: af8b44aab93c9f2688403a6c7dd647a77cd4f7a3 (
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
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
|
# plugin.pp - configure a specific munin plugin
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
# adapted and improved by admin(at)immerda.ch
define munin::plugin (
$ensure = "present",
$script_path_in = '',
$config = ''
) {
include munin::plugin::scriptpaths
$real_script_path = $script_path_in ? { '' => $munin::plugin::scriptpaths::script_path, default => $script_path_in }
$plugin_src = $ensure ? { "present" => $name, default => $ensure }
$plugin = "/etc/munin/plugins/${name}"
$plugin_conf = "/etc/munin/plugin-conf.d/${name}.conf"
include munin::plugins::setup
case $ensure {
"absent": {
file { $plugin: ensure => absent, }
}
default: {
file { $plugin:
ensure => "${real_script_path}/${plugin_src}",
require => $::kernel ? {
OpenBSD => File['/var/run/munin'],
default => Package['munin-node']
},
notify => Service['munin-node'];
}
if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){
File[$plugin]{
seltype => 'munin_etc_t',
}
}
}
}
case $config {
'': {
file { $plugin_conf: ensure => absent }
}
default: {
case $ensure {
absent: {
file { $plugin_conf: ensure => absent }
}
default: {
file { $plugin_conf:
content => "[${name}]\n$config\n",
mode => 0644, owner => root, group => 0,
}
}
}
}
}
}
|