Added support for OpenBSD nodes to munin module.

This commit is contained in:
Ossi Salmi 2009-09-11 19:59:35 +03:00 committed by Timo Mkinen
parent bd08225527
commit 1d260a4997
2 changed files with 70 additions and 18 deletions

View file

@ -13,11 +13,24 @@ class munin::node {
require => Package["munin-node"], require => Package["munin-node"],
} }
case $operatingsystem {
OpenBSD: {
Service["munin-node"] {
name => "munin-node",
binary => "/usr/local/sbin/munin-node",
start => "/usr/local/sbin/munin-node",
}
}
}
file { "/etc/munin/munin-node.conf": file { "/etc/munin/munin-node.conf":
ensure => present, ensure => present,
content => template("munin/munin-node.conf.erb"), content => template("munin/munin-node.conf.erb"),
owner => root, owner => root,
group => root, group => $operatingsystem ? {
OpenBSD => wheel,
default => root,
},
mode => 0644, mode => 0644,
require => Package["munin-node"], require => Package["munin-node"],
notify => Service["munin-node"], notify => Service["munin-node"],
@ -62,13 +75,27 @@ class munin::node {
# #
define munin::plugin($config = "") { define munin::plugin($config = "") {
file { "/usr/share/munin/plugins/${name}": case $operatingsystem {
ensure => present, OpenBSD: {
source => "puppet:///munin/plugins/${name}", file { "/usr/local/lib/munin/plugins/${name}":
owner => root, ensure => present,
group => root, source => "puppet:///munin/plugins/${name}",
mode => 0755, owner => root,
require => Package["munin-node"], group => wheel,
mode => 0755,
require => Package["munin-node"],
}
}
default: {
file { "/usr/share/munin/plugins/${name}":
ensure => present,
source => "puppet:///munin/plugins/${name}",
owner => root,
group => root,
mode => 0755,
require => Package["munin-node"],
}
}
} }
if ($config) { if ($config) {
@ -78,21 +105,42 @@ define munin::plugin($config = "") {
"puppet:///files/munin/plugin-conf/${config}", "puppet:///files/munin/plugin-conf/${config}",
"puppet:///munin/plugin-conf/${config}", ], "puppet:///munin/plugin-conf/${config}", ],
owner => root, owner => root,
group => root, group => $operatingsystem ? {
OpenBSD => wheel,
default => root,
},
mode => 0644, mode => 0644,
notify => Service["munin-node"], notify => Service["munin-node"],
require => File["/usr/share/munin/plugins/${name}"], require => $operatingsystem ? {
OpenBSD => File["/usr/local/lib/munin/plugins/${name}"],
default => File["/usr/share/munin/plugins/${name}"],
},
} }
} }
exec { "munin-enable-${name}": case $operatingsystem {
command => "ln -s /usr/share/munin/plugins/${name} /etc/munin/plugins/${name}", OpenBSD: {
path => "/bin:/usr/bin:/sbin:/usr/sbin", exec { "munin-enable-${name}":
user => root, command => "ln -s /usr/local/lib/munin/plugins/${name} /etc/munin/plugins/${name}",
onlyif => [ "! test -h /etc/munin/plugins/${name}", path => "/bin:/usr/bin:/sbin:/usr/sbin",
"/usr/share/munin/plugins/${name} autoconf", ], user => root,
notify => Service["munin-node"], onlyif => [ "test ! -h /etc/munin/plugins/${name}",
require => File["/usr/share/munin/plugins/${name}"], "/usr/local/lib/munin/plugins/${name} autoconf", ],
notify => Service["munin-node"],
require => File["/usr/local/lib/munin/plugins/${name}"],
}
}
default: {
exec { "munin-enable-${name}":
command => "ln -s /usr/share/munin/plugins/${name} /etc/munin/plugins/${name}",
path => "/bin:/usr/bin:/sbin:/usr/sbin",
user => root,
onlyif => [ "test ! -h /etc/munin/plugins/${name}",
"/usr/share/munin/plugins/${name} autoconf", ],
notify => Service["munin-node"],
require => File["/usr/share/munin/plugins/${name}"],
}
}
} }
} }

View file

@ -10,7 +10,11 @@ background 1
setseid 1 setseid 1
user root user root
<% if operatingsystem == "OpenBSD" -%>
group wheel
<% else -%>
group root group root
<% end -%>
setsid yes setsid yes
# Regexps for files to ignore # Regexps for files to ignore