summaryrefslogtreecommitdiff
path: root/manifests/client
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2016-03-16 22:03:36 +0100
committervarac <varacanero@zeromail.org>2016-03-16 22:03:36 +0100
commit6c633f8606e04aad29f40a3fc0fcfdcb4b293715 (patch)
tree63d7c8a54a643cc628b9b4f7a3b941d9f508c4ad /manifests/client
parent503e9296860e4d844a1ee391331996db87e0bfa6 (diff)
parent87dc315597e8ed27c2e0907615ede8a3f1521b7a (diff)
Merge remote-tracking branch 'shared/master' into leap_masterHEADmaster
Diffstat (limited to 'manifests/client')
-rw-r--r--manifests/client/base.pp48
-rw-r--r--manifests/client/centos.pp3
-rw-r--r--manifests/client/darwin.pp22
-rw-r--r--manifests/client/debian.pp14
-rw-r--r--manifests/client/gentoo.pp6
-rw-r--r--manifests/client/openbsd.pp46
-rw-r--r--manifests/client/package.pp12
-rw-r--r--manifests/client/params.pp19
8 files changed, 64 insertions, 106 deletions
diff --git a/manifests/client/base.pp b/manifests/client/base.pp
index 78398a9..8ee8b95 100644
--- a/manifests/client/base.pp
+++ b/manifests/client/base.pp
@@ -1,28 +1,44 @@
-class munin::client::base {
+# Install a basic munin client
+class munin::client::base inherits munin::client::params {
+ package { 'munin-node':
+ ensure => installed
+ }
service { 'munin-node':
- ensure => running,
- enable => true,
- hasstatus => true,
+ ensure => running,
+ enable => true,
+ hasstatus => true,
hasrestart => true,
+ require => Package[munin-node],
}
file {'/etc/munin':
ensure => directory,
- mode => 0755, owner => root, group => 0;
+ mode => '0755',
+ 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,
+ content => template("${module_name}/munin-node.conf.erb"),
+ # 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,
+ }
+ $host = $munin::host ? {
+ '*' => $::fqdn,
+ default => $munin::host
}
munin::register { $::fqdn:
- host => $munin::client::host ? {
- '*' => $::fqdn,
- default => $munin::client::host
- },
- port => $munin::client::port,
- use_ssh => $munin::client::use_ssh,
- config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'],
- export_tag => $munin::client::export_tag,
+ host => $host,
+ port => $munin::port,
+ use_ssh => $munin::use_ssh,
+ description => $munin::description,
+ group => $munin::munin_group,
+ config => [ 'use_node_name yes', 'load.load.warning 5',
+ 'load.load.critical 10'],
+ export_tag => $munin::export_tag,
}
include munin::plugins::base
}
diff --git a/manifests/client/centos.pp b/manifests/client/centos.pp
deleted file mode 100644
index 3a7151b..0000000
--- a/manifests/client/centos.pp
+++ /dev/null
@@ -1,3 +0,0 @@
-class munin::client::centos inherits munin::client::package {
- include munin::plugins::centos
-}
diff --git a/manifests/client/darwin.pp b/manifests/client/darwin.pp
deleted file mode 100644
index 264263d..0000000
--- a/manifests/client/darwin.pp
+++ /dev/null
@@ -1,22 +0,0 @@
-class munin::client::darwin {
- file { "/usr/share/snmp/snmpd.conf":
- mode => 744,
- content => template("munin/darwin_snmpd.conf.erb"),
- group => 0,
- owner => root,
- }
- line{"startsnmpdno":
- file => "/etc/hostconfig",
- line => "SNMPSERVER=-NO-",
- ensure => 'absent',
- }
- line { "startsnmpdyes":
- file => "/etc/hostconfig",
- line => "SNMPSERVER=-YES-",
- notify => Exec["/sbin/SystemStarter start SNMP"],
- }
- exec{"/sbin/SystemStarter start SNMP":
- noop => false,
- }
- munin::register::snmp { $::fqdn: }
-}
diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp
index e67ac26..49ee567 100644
--- a/manifests/client/debian.pp
+++ b/manifests/client/debian.pp
@@ -1,15 +1,9 @@
-class munin::client::debian inherits munin::client::package {
+# Install the munin client on debian
+class munin::client::debian inherits munin::client::base {
# the plugin will need that
- package { "iproute": ensure => installed }
+ ensure_packages(['iproute'])
- Service["munin-node"]{
- # sarge's munin-node init script has no status
- hasstatus => $::lsbdistcodename ? { sarge => false, default => true }
- }
- File["/etc/munin/munin-node.conf"]{
- content => template("munin/munin-node.conf.${::operatingsystem}.${::lsbdistcodename}"),
- }
# workaround bug in munin_node_configure
- plugin { "postfix_mailvolume": ensure => absent }
+ plugin { 'postfix_mailvolume': ensure => absent }
include munin::plugins::debian
}
diff --git a/manifests/client/gentoo.pp b/manifests/client/gentoo.pp
index e79f6b0..263fecd 100644
--- a/manifests/client/gentoo.pp
+++ b/manifests/client/gentoo.pp
@@ -1,8 +1,8 @@
-class munin::client::gentoo inherits munin::client::package {
+# install a munin client on gentoo
+class munin::client::gentoo inherits munin::client::base {
Package['munin-node'] {
- name => 'munin',
- category => 'net-analyzer',
+ name => 'net-analyzer/munin',
}
include munin::plugins::gentoo
diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp
index cd21abf..09fb24f 100644
--- a/manifests/client/openbsd.pp
+++ b/manifests/client/openbsd.pp
@@ -1,60 +1,26 @@
-# currently we install munin on openbsd by targz
-# :(
-
+# generate a few missing things on openbsd
class munin::client::openbsd inherits munin::client::base {
- if $::operatingsystemrelease == '4.3' {
- file{'/usr/src/munin_openbsd.tar.gz':
- source => "puppet:///modules/munin/openbsd/package/munin_openbsd.tar.gz",
- owner => root,
- group => 0,
- mode => '0600';
- }
- exec{'extract_openbsd':
- command => 'cd /;tar xzf /usr/src/munin_openbsd.tar.gz',
- unless => 'test -d /opt/munin',
- require => File['/usr/src/munin_openbsd.tar.gz'],
- before => File['/var/run/munin'],
- }
- package{'p5-Compress-Zlib':
- ensure => installed,
- before => File['/var/run/munin'],
- }
- } else {
- package{'munin-node':
- ensure => installed,
- }
- }
- package{ [ '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'],
- }
- file{[ '/var/run/munin', '/var/log/munin' ]:
+ file{[ '/var/run/munin', '/var/log/munin-node' ]:
ensure => directory,
owner => root,
group => 0,
mode => '0755';
}
- $bin_loc = $::operatingsystemrelease ? {
- '4.3' => '/opt/munin/sbin/munin-node',
- default => '/usr/local/sbin/munin-node'
- }
openbsd::rc_local{'munin-node':
- binary => $bin_loc,
+ binary => '/usr/local/sbin/munin-node',
require => File['/var/run/munin'],
}
Service['munin-node']{
restart => '/bin/kill -HUP `/bin/cat /var/run/munin/munin-node.pid`',
stop => '/bin/kill `/bin/cat /var/run/munin/munin-node.pid`',
- start => $bin_loc,
+ start => '/usr/local/sbin/munin-node',
status => 'test -e /var/run/munin/munin-node.pid && (ps ax | egrep -q "^ *$(cat /var/run/munin/munin-node.pid).*munin-node")',
hasstatus => true,
hasrestart => true,
- require => [ File['/var/run/munin'], File['/var/log/munin'] ],
+ require => [ File['/var/run/munin'], File['/var/log/munin-node'] ],
}
cron{'clean_munin_logfile':
- command => 'rm /var/log/munin/munin-node.log; kill -HUP `cat /var/run/munin/munin-node.pid`',
+ command => 'rm /var/log/munin-node/munin-node.log; kill -HUP `cat /var/run/munin/munin-node.pid`',
minute => 0,
hour => 2,
weekday => 0,
diff --git a/manifests/client/package.pp b/manifests/client/package.pp
deleted file mode 100644
index 206ccc8..0000000
--- a/manifests/client/package.pp
+++ /dev/null
@@ -1,12 +0,0 @@
-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'],
- }
-}
-
diff --git a/manifests/client/params.pp b/manifests/client/params.pp
new file mode 100644
index 0000000..4473912
--- /dev/null
+++ b/manifests/client/params.pp
@@ -0,0 +1,19 @@
+# Set the parameters for the munin client
+class munin::client::params {
+ $user = 'root'
+
+ case $::osfamily {
+ 'OpenBSD': {
+ $group = '0'
+ $log_file = '/var/log/munin-node/munin-node.log'
+ }
+ 'Debian': {
+ $group = 'root'
+ $log_file = '/var/log/munin/munin-node.log'
+ }
+ default: {
+ $group = 'root'
+ $log_file = '/var/log/munin-node/munin-node.log'
+ }
+ }
+}