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,6 +75,18 @@ class munin::node {
# #
define munin::plugin($config = "") { define munin::plugin($config = "") {
case $operatingsystem {
OpenBSD: {
file { "/usr/local/lib/munin/plugins/${name}":
ensure => present,
source => "puppet:///munin/plugins/${name}",
owner => root,
group => wheel,
mode => 0755,
require => Package["munin-node"],
}
}
default: {
file { "/usr/share/munin/plugins/${name}": file { "/usr/share/munin/plugins/${name}":
ensure => present, ensure => present,
source => "puppet:///munin/plugins/${name}", source => "puppet:///munin/plugins/${name}",
@ -70,6 +95,8 @@ define munin::plugin($config = "") {
mode => 0755, mode => 0755,
require => Package["munin-node"], require => Package["munin-node"],
} }
}
}
if ($config) { if ($config) {
file { "/etc/munin/plugin-conf.d/${config}": file { "/etc/munin/plugin-conf.d/${config}":
@ -78,22 +105,43 @@ 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}"],
},
} }
} }
case $operatingsystem {
OpenBSD: {
exec { "munin-enable-${name}":
command => "ln -s /usr/local/lib/munin/plugins/${name} /etc/munin/plugins/${name}",
path => "/bin:/usr/bin:/sbin:/usr/sbin",
user => root,
onlyif => [ "test ! -h /etc/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}": exec { "munin-enable-${name}":
command => "ln -s /usr/share/munin/plugins/${name} /etc/munin/plugins/${name}", command => "ln -s /usr/share/munin/plugins/${name} /etc/munin/plugins/${name}",
path => "/bin:/usr/bin:/sbin:/usr/sbin", path => "/bin:/usr/bin:/sbin:/usr/sbin",
user => root, user => root,
onlyif => [ "! test -h /etc/munin/plugins/${name}", onlyif => [ "test ! -h /etc/munin/plugins/${name}",
"/usr/share/munin/plugins/${name} autoconf", ], "/usr/share/munin/plugins/${name} autoconf", ],
notify => Service["munin-node"], notify => Service["munin-node"],
require => File["/usr/share/munin/plugins/${name}"], 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