summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2008-10-01 19:54:20 +0000
committermh <mh@immerda.ch>2008-10-01 19:54:20 +0000
commit14c511f7f6791f56952bc312e5ff8cf4826bb14e (patch)
treec0d922a6b39c53f11e6a40485dfd5119eb1e1eab
parentb0c793fefc5f1fcfc3f4ac646803bb8aedfbc5d9 (diff)
tried to make munin-node installable and runable on openbsd
-rw-r--r--files/openbsd/package/munin_openbsd.tar.gzbin0 -> 97459 bytes
-rw-r--r--manifests/client.pp79
-rw-r--r--manifests/plugin.pp57
3 files changed, 99 insertions, 37 deletions
diff --git a/files/openbsd/package/munin_openbsd.tar.gz b/files/openbsd/package/munin_openbsd.tar.gz
new file mode 100644
index 0000000..76ae644
--- /dev/null
+++ b/files/openbsd/package/munin_openbsd.tar.gz
Binary files differ
diff --git a/manifests/client.pp b/manifests/client.pp
index 9a7b772..b9e0c0a 100644
--- a/manifests/client.pp
+++ b/manifests/client.pp
@@ -13,9 +13,9 @@ class munin::client {
}
case $operatingsystem {
+ openbsd: { include munin::client::openbsd }
darwin: { include munin::client::darwin }
- debian: { include munin::client::debian }
- ubuntu: { include munin::client::ubuntu }
+ debian,ubuntu: { include munin::client::debian }
centos: { include munin::client::centos }
gentoo: { include munin::client::gentoo }
default: { include munin::client::base }
@@ -48,15 +48,13 @@ define munin::register_snmp()
}
class munin::client::base {
- package { "munin-node": ensure => installed }
- service { "munin-node":
+ service { 'munin-node':
ensure => running,
enable => true,
hasstatus => true,
hasrestart => true,
- require => Package[munin-node],
}
- file {"/etc/munin/":
+ file {'/etc/munin/':
ensure => directory,
mode => 0755, owner => root, group => 0;
}
@@ -64,18 +62,53 @@ class munin::client::base {
'' => '127.0.0.1',
default => $munin_allow
}
- file {"/etc/munin/munin-node.conf":
- content => template("munin/munin-node.conf.$operatingsystem"),
- # this has to be installed before the package, so the postinst can
- # boot the munin-node without failure!
- before => Package["munin-node"],
- notify => Service['munin-node'],
- mode => 0644, owner => root, group => 0,
+ file {'/etc/munin/munin-node.conf':
+ content => template("munin/munin-node.conf.$operatingsystem"),
+ notify => Service['munin-node'],
+ mode => 0644, owner => root, group => 0,
}
munin::register { $fqdn: }
include munin::plugins::base
}
+# currently we install munin on openbsd by hand
+# :(
+class munin::openbsd inherits openbsd::base {
+ file{'/usr/src/munin_openbsd.tar.gz':
+ source => "puppet://$server/munin/openbsd/package/munin_openbsd.tar.gz",
+ owner => root, group => 0, mode => 0600;
+ }
+ package{ [ 'p5-Compress-Zlib', 'p5-Crypt-SSLeay', 'p5-HTML-Parser',
+ 'p5-HTML-Tagset', 'p5-HTTP-GHTTP', 'p5-LWP-UserAgent-Determined',
+ 'p5-Net-SSLeay', 'p5-Net-Server', 'p5-URI', 'p5-libwww', 'pcre', 'curl' ]:
+ ensure => installed,
+ before => File['/var/run/munin'],
+ }
+ exec{'extract_openbsd':
+ command => 'tar xzf /usr/src/munin_openbsd.tar.gz',
+ unless => 'test -d /opt/munin',
+ require => File['/usr/src/munin_openbsd.tar.gz'],
+ }
+ file{'/var/run/munin':
+ ensure => directory,
+ require => File['/usr/src/munin_openbsd.tar.gz'],
+ owner => root, group => 0, mode => 0755;
+ }
+ exec{'enable_munin_on_boot':
+ command => 'echo "if [ -x /opt/munin/sbin/munin-node ]; then echo -n \' munin\'; /opt/munin/sbin/munin-node; fi" >> /etc/rc.local',
+ unless => 'grep -q "if [ -x /opt/munin/sbin/munin-node ]; then echo -n \' munin\'; /opt/munin/sbin/munin-node; fi" >> /etc/rc.local',
+ require => File['/var/run/munin'],
+ }
+ Service['munin-node']{
+ restart => '/bin/kill -HUP `/bin/cat /var/run/munin/munin-node.pid`',
+ stopt => '/bin/kill `/bin/cat /var/run/munin/munin-node.pid`',
+ start => '/opt/munin/sbin/munin-node',
+ hasstatus => false,
+ hasrestart => false,
+ require => File['/var/run/munin'],
+ }
+}
+
class munin::client::darwin {
file { "/usr/share/snmp/snmpd.conf":
mode => 744,
@@ -98,7 +131,19 @@ class munin::client::darwin {
munin::register_snmp { $fqdn: }
}
-class munin::client::debian inherits munin::client::base {
+class munin::client::package inherits munin::client::base {
+ package { 'munin-node': ensure => installed }
+ Service['munin-node']{
+ require => Package[munin-node],
+ }
+ File['/etc/munin/munin-node.conf']{
+ # this has to be installed before the package, so the postinst can
+ # boot the munin-node without failure!
+ before => Package['munin-node'],
+ }
+}
+
+class munin::client::debian inherits munin::client::package {
# the plugin will need that
package { "iproute": ensure => installed }
@@ -114,9 +159,7 @@ class munin::client::debian inherits munin::client::base {
include munin::plugins::debian
}
-class munin::client::ubuntu inherits munin::client::debian {}
-
-class munin::client::gentoo inherits munin::client::base {
+class munin::client::gentoo inherits munin::client::package {
Package['munin-node'] {
name => 'munin',
category => 'net-analyzer',
@@ -126,6 +169,6 @@ class munin::client::gentoo inherits munin::client::base {
include munin::plugins::gentoo
}
-class munin::client::centos inherits munin::client::base {
+class munin::client::centos inherits munin::client::package {
include munin::plugins::centos
}
diff --git a/manifests/plugin.pp b/manifests/plugin.pp
index 741de30..4395cef 100644
--- a/manifests/plugin.pp
+++ b/manifests/plugin.pp
@@ -8,18 +8,11 @@
class munin::plugin::scriptpaths {
case $operatingsystem {
- gentoo: {
- $script_path = "/usr/libexec/munin/plugins"
- }
- debian: {
- $script_path = "/usr/share/munin/plugins"
- }
- centos: {
- $script_path = "/usr/share/munin/plugins"
- }
- default: {
- $script_path = "/usr/share/munin/plugins"
- }
+ gentoo: { $script_path = "/usr/libexec/munin/plugins" }
+ debian: { $script_path = "/usr/share/munin/plugins" }
+ centos: { $script_path = "/usr/share/munin/plugins" }
+ openbsd: { $script_path = "/opt/munin/lib/plugins/" }
+ default: { $script_path = "/usr/share/munin/plugins" }
}
}
@@ -45,10 +38,14 @@ define munin::plugin (
}
default: {
debug ( "munin_plugin: making $plugin using src: $plugin_src" )
+ case $kernel {
+ openbsd: { $basic_require = File['/var/run/munin'] }
+ default: { $basic_require = Package['munin-node'] }
+ }
if $require {
- $real_require = [ $require, Package['munin-node'] ]
+ $real_require = [ $require, $basic_require ]
} else {
- $real_require = Package['munin-node']
+ $real_require = $basic_require
}
file { $plugin:
ensure => "${real_script_path}/${plugin_src}",
@@ -118,13 +115,24 @@ define munin::plugin::deploy ($source = '', $ensure = 'present', $config = '') {
file { "munin_plugin_${name}":
path => "$munin::plugin::scriptpaths::script_path/${name}",
source => "puppet://$server/$real_source",
- require => Package['munin-node'],
mode => 0755, owner => root, group => 0;
}
+
+ case $kernel {
+ openbsd: { $basic_require = File['/var/run/munin'] }
+ default: { $basic_require = Package['munin-node'] }
+ }
if $require {
File["munin_plugin_${name}"]{
- require +> $require,
+ require => [ $basic_require, $require ],
+ }
+ } else {
+ File["munin_plugin_${name}"]{
+ require => $basic_require,
}
+ }
+ # register the plugin
+ if $require {
munin::plugin{$name: ensure => $ensure, config => $config, require => $require }
} else {
munin::plugin{$name: ensure => $ensure, config => $config }
@@ -135,20 +143,31 @@ define munin::plugin::deploy ($source = '', $ensure = 'present', $config = '') {
class munin::plugins::base {
file {
- [ "/etc/munin/plugins", "/etc/munin/plugin-conf.d" ]:
+ [ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]:
source => "puppet://$server/common/empty",
ignore => '\.ignore',
ensure => directory, checksum => mtime,
recurse => true, purge => true, force => true,
mode => 0755, owner => root, group => 0,
notify => Service['munin-node'];
- "/etc/munin/plugin-conf.d/munin-node":
+ '/etc/munin/plugin-conf.d/munin-node':
ensure => present,
mode => 0644, owner => root, group => 0,
notify => Service['munin-node'],
- before => Package['munin-node'];
}
case $kernel {
+ openbsd: {
+ File['/etc/munin/plugin-conf.d/munin-node']{
+ before => File['/var/run/munin'],
+ }
+ }
+ default: {
+ File['/etc/munin/plugin-conf.d/munin-node']{
+ before => Package['munin-node'],
+ }
+ }
+ }
+ case $kernel {
linux: {
case $vserver {
guest: { include munin::plugins::vserver }