From dcaf67ef0f978447fa0183ddf07b458a8e21ab45 Mon Sep 17 00:00:00 2001 From: Sander Hoentjen Date: Mon, 25 Mar 2013 14:44:57 +0100 Subject: add comment about exec for puppet 3 compat --- README | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README b/README index 1e47d27..f712682 100644 --- a/README +++ b/README @@ -76,3 +76,5 @@ To use this module, follow these directions: For CentOS this is enabled in the default header config h. Per default (on CentOS) munin will send warnings and critical messages to root + + i. If you want to use host with cgi, you need to have specified a default $PATH for all execs: http://www.puppetcookbook.com/posts/set-global-exec-path.html -- cgit v1.2.3 From d6369efd46e00c31b6ee9a109014da9e8659e2c4 Mon Sep 17 00:00:00 2001 From: Sander Hoentjen Date: Mon, 25 Mar 2013 14:45:56 +0100 Subject: fix subscribe --- manifests/host/cgi.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/host/cgi.pp b/manifests/host/cgi.pp index 9980856..8a956bf 100644 --- a/manifests/host/cgi.pp +++ b/manifests/host/cgi.pp @@ -2,7 +2,7 @@ class munin::host::cgi { exec{'set_modes_for_cgi': command => 'chgrp apache /var/log/munin /var/log/munin/munin-graph.log && chmod g+w /var/log/munin /var/log/munin/munin-graph.log && find /var/www/html/munin/* -maxdepth 1 -type d -exec chgrp -R apache {} \; && find /var/www/html/munin/* -maxdepth 1 -type d -exec chmod -R g+w {} \;', refreshonly => true, - subscribe => File['/etc/munin/munin.conf.header'], + subscribe => Concat::Fragment['munin.conf.header'], } file{'/etc/logrotate.d/munin': -- cgit v1.2.3 From 8a956cc2f1ad97d06e9a267312e55260ecb29eac Mon Sep 17 00:00:00 2001 From: Sander Hoentjen Date: Mon, 25 Mar 2013 14:46:25 +0100 Subject: linting --- manifests/host/cgi.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/host/cgi.pp b/manifests/host/cgi.pp index 8a956bf..a19c432 100644 --- a/manifests/host/cgi.pp +++ b/manifests/host/cgi.pp @@ -1,6 +1,7 @@ class munin::host::cgi { exec{'set_modes_for_cgi': command => 'chgrp apache /var/log/munin /var/log/munin/munin-graph.log && chmod g+w /var/log/munin /var/log/munin/munin-graph.log && find /var/www/html/munin/* -maxdepth 1 -type d -exec chgrp -R apache {} \; && find /var/www/html/munin/* -maxdepth 1 -type d -exec chmod -R g+w {} \;', + command => 'chgrp apache /var/log/munin /var/log/munin/munin-graph.log && chmod g+w /var/log/munin /var/log/munin/munin-graph.log && find /var/www/html/munin/* -maxdepth 1 -type d -exec chgrp -R apache {} \; && find /var/www/html/munin/* -maxdepth 1 -type d -exec chmod -R g+w {} \;', refreshonly => true, subscribe => Concat::Fragment['munin.conf.header'], } -- cgit v1.2.3 From eb0c5f288815abf49b8a7f28979a2777938648c7 Mon Sep 17 00:00:00 2001 From: Sander Hoentjen Date: Mon, 25 Mar 2013 19:06:36 +0100 Subject: fix duplicate command introduced by previous merge --- manifests/host/cgi.pp | 1 - 1 file changed, 1 deletion(-) diff --git a/manifests/host/cgi.pp b/manifests/host/cgi.pp index a19c432..4c0d0c9 100644 --- a/manifests/host/cgi.pp +++ b/manifests/host/cgi.pp @@ -1,6 +1,5 @@ class munin::host::cgi { exec{'set_modes_for_cgi': - command => 'chgrp apache /var/log/munin /var/log/munin/munin-graph.log && chmod g+w /var/log/munin /var/log/munin/munin-graph.log && find /var/www/html/munin/* -maxdepth 1 -type d -exec chgrp -R apache {} \; && find /var/www/html/munin/* -maxdepth 1 -type d -exec chmod -R g+w {} \;', command => 'chgrp apache /var/log/munin /var/log/munin/munin-graph.log && chmod g+w /var/log/munin /var/log/munin/munin-graph.log && find /var/www/html/munin/* -maxdepth 1 -type d -exec chgrp -R apache {} \; && find /var/www/html/munin/* -maxdepth 1 -type d -exec chmod -R g+w {} \;', refreshonly => true, subscribe => Concat::Fragment['munin.conf.header'], -- cgit v1.2.3 From e9f80adaa87d5a6a906e406792629372ad15cc5f Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Mon, 6 May 2013 17:31:14 +0200 Subject: Make the CGI owner configurable --- manifests/host.pp | 5 ++++- manifests/host/cgi.pp | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/manifests/host.pp b/manifests/host.pp index 05dcb5e..0992d2b 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -4,6 +4,7 @@ class munin::host( $cgi_graphing = false, + $cgi_owner = 'apache', $export_tag = 'munin' ) { package {"munin": ensure => installed, } @@ -30,7 +31,9 @@ class munin::host( include munin::plugins::muninhost if $munin::host::cgi_graphing { - include munin::host::cgi + class {'munin::host::cgi': + owner => $cgi_owner, + } } # from time to time we cleanup hanging munin-runs diff --git a/manifests/host/cgi.pp b/manifests/host/cgi.pp index 4c0d0c9..6e5efcd 100644 --- a/manifests/host/cgi.pp +++ b/manifests/host/cgi.pp @@ -1,6 +1,8 @@ -class munin::host::cgi { +class munin::host::cgi( + $owner = 'apache' +) { exec{'set_modes_for_cgi': - command => 'chgrp apache /var/log/munin /var/log/munin/munin-graph.log && chmod g+w /var/log/munin /var/log/munin/munin-graph.log && find /var/www/html/munin/* -maxdepth 1 -type d -exec chgrp -R apache {} \; && find /var/www/html/munin/* -maxdepth 1 -type d -exec chmod -R g+w {} \;', + command => "chgrp ${owner} /var/log/munin /var/log/munin/munin-graph.log && chmod g+w /var/log/munin /var/log/munin/munin-graph.log && find /var/www/html/munin/* -maxdepth 1 -type d -exec chgrp -R ${owner} {} \; && find /var/www/html/munin/* -maxdepth 1 -type d -exec chmod -R g+w {} \;", refreshonly => true, subscribe => Concat::Fragment['munin.conf.header'], } -- cgit v1.2.3 From 2967c1c524242b26481985cf50b11821826f18d5 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 31 May 2013 21:01:32 +0200 Subject: update to latest upstream --- templates/munin-node.conf.default | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/templates/munin-node.conf.default b/templates/munin-node.conf.default index 9d7f32f..cb9cf43 100644 --- a/templates/munin-node.conf.default +++ b/templates/munin-node.conf.default @@ -15,6 +15,16 @@ setsid 1 user root group 0 +# This is the timeout for the whole transaction. +# Units are in sec. Default is 15 min +# +# global_timeout 900 + +# This is the timeout for each plugin. +# Units are in sec. Default is 1 min +# +# timeout 60 + # Regexps for files to ignore ignore_file [\#~]$ ignore_file DEADJOE$ -- cgit v1.2.3 From 02a8971459a201b9165909593c250122b0c06c1b Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Mon, 3 Jun 2013 14:24:20 +0200 Subject: Use @var style for puppet 3.2 compatibility --- templates/client.erb | 24 ++++++++++++------------ templates/munin-node.conf.default | 2 +- templates/site.conf | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/templates/client.erb b/templates/client.erb index ba03da5..83d5a64 100644 --- a/templates/client.erb +++ b/templates/client.erb @@ -5,20 +5,20 @@ %> ### Munin client from Puppet template -# Domain: <%= dom %> -# Registered on: <%= h %> -# Type: <%= client_type %> -<% if description != 'absent' -%> -# Description: <%= description.gsub!(/\n/, ' ') %> +# Domain: <%= @dom %> +# Registered on: <%= @h %> +# Type: <%= @client_type %> +<% if @description != 'absent' -%> +# Description: <%= @description.gsub!(/\n/, ' ') %> <% end -%> -[<%= fhost.downcase %>] -<% if use_ssh -%> - address ssh://<%= host %>/bin/nc localhost <%= port %> +[<%= @fhost.downcase %>] +<% if @use_ssh -%> + address ssh://<%= @host %>/bin/nc localhost <%= @port %> <% else -%> - address <%= host %> - port <%= port %> + address <%= @host %> + port <%= @port %> <% end -%> -<% if config -%><% config.each do |val| -%> - <%= val -%> +<% if @config -%><% @config.each do |val| -%> + <%= @val -%> <% end -%><% end -%> diff --git a/templates/munin-node.conf.default b/templates/munin-node.conf.default index 9d7f32f..cff7154 100644 --- a/templates/munin-node.conf.default +++ b/templates/munin-node.conf.default @@ -28,7 +28,7 @@ ignore_file \.pod$ # telnetting to localhost, port 4949 # #host_name localhost.localdomain -host_name <%= fqdn %> +host_name <%= @fqdn %> # A list of addresses that are allowed to connect. This must be a # regular expression, since Net::Server does not understand CIDR-style diff --git a/templates/site.conf b/templates/site.conf index 52ddb53..842bde0 100644 --- a/templates/site.conf +++ b/templates/site.conf @@ -1,5 +1,5 @@ - ServerName <%= name %> + ServerName <%= @name %> DocumentRoot /var/cache/munin/www/ order allow,deny -- cgit v1.2.3 From aa8da42f01d26e184ec110840723355953c42b00 Mon Sep 17 00:00:00 2001 From: Wouter Schoot Date: Mon, 24 Jun 2013 16:19:19 +0200 Subject: Changed include to ordering to prevent duplicate inclusions --- manifests/plugins/setup.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/plugins/setup.pp b/manifests/plugins/setup.pp index 197b657..96891d3 100644 --- a/manifests/plugins/setup.pp +++ b/manifests/plugins/setup.pp @@ -1,7 +1,7 @@ class munin::plugins::setup { # This is required for the munin-node service and package requirements below. - include munin::client + Class['munin::client'] -> Class['munin::plugins::setup'] file { [ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]: -- cgit v1.2.3 From aaf55c9ebfa0e34f63b2ca3c2b660e1d164026dd Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Mon, 6 May 2013 18:13:12 +0200 Subject: lintify --- manifests/client.pp | 4 ++-- manifests/client/base.pp | 26 ++++++++++++++++---------- manifests/client/centos.pp | 1 + manifests/client/darwin.pp | 29 +++++++++++++++-------------- manifests/client/debian.pp | 9 +++++---- manifests/client/gentoo.pp | 3 ++- manifests/client/openbsd.pp | 2 +- manifests/client/package.pp | 1 + manifests/host.pp | 18 +++++++++++------- manifests/host/cgi.pp | 9 ++++++--- manifests/plugin.pp | 2 +- manifests/plugin/deploy.pp | 2 +- manifests/plugin/scriptpaths.pp | 13 +++++++------ manifests/plugins/base.pp | 16 ++++++++++------ manifests/plugins/centos.pp | 5 ++++- manifests/plugins/debian.pp | 1 + manifests/plugins/djbdns.pp | 5 +++-- manifests/plugins/dom0.pp | 1 + manifests/plugins/gentoo.pp | 3 ++- manifests/plugins/interfaces.pp | 30 +++++++++++++----------------- manifests/plugins/kvm.pp | 1 + manifests/plugins/linux.pp | 7 ++++--- manifests/plugins/muninhost.pp | 3 ++- manifests/plugins/openbsd.pp | 5 +++-- manifests/plugins/physical.pp | 6 ++++-- manifests/plugins/selinux.pp | 1 + manifests/plugins/setup.pp | 5 +++-- manifests/plugins/vserver.pp | 4 ++-- manifests/register.pp | 3 ++- manifests/register/snmp.pp | 9 +++++---- manifests/remoteplugin.pp | 15 +++++++++------ manifests/snmp_collector.pp | 23 +++++++++++++---------- 32 files changed, 152 insertions(+), 110 deletions(-) diff --git a/manifests/client.pp b/manifests/client.pp index 2316bc9..4d70cac 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -22,8 +22,8 @@ class munin::client( } if $munin::client::manage_shorewall { class{'shorewall::rules::munin': - munin_port => $port, - munin_collector => delete($allow,'127.0.0.1'), + munin_port => $port, + munin_collector => delete($allow,'127.0.0.1'), collector_source => $shorewall_collector_source, } } diff --git a/manifests/client/base.pp b/manifests/client/base.pp index 78398a9..3c0ba89 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -1,24 +1,30 @@ +# Install a basic munin client class munin::client::base { service { 'munin-node': - ensure => running, - enable => true, - hasstatus => true, + ensure => running, + enable => true, + hasstatus => true, hasrestart => true, } 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, + notify => Service['munin-node'], + mode => '0644', + owner => root, + group => 0, + } + $host = $munin::client::host ? { + '*' => $::fqdn, + default => $munin::client::host } munin::register { $::fqdn: - host => $munin::client::host ? { - '*' => $::fqdn, - default => $munin::client::host - }, + host => $host, port => $munin::client::port, use_ssh => $munin::client::use_ssh, config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'], diff --git a/manifests/client/centos.pp b/manifests/client/centos.pp index 3a7151b..cd4f2f6 100644 --- a/manifests/client/centos.pp +++ b/manifests/client/centos.pp @@ -1,3 +1,4 @@ +# Install a munin client on centos class munin::client::centos inherits munin::client::package { include munin::plugins::centos } diff --git a/manifests/client/darwin.pp b/manifests/client/darwin.pp index 264263d..7639896 100644 --- a/manifests/client/darwin.pp +++ b/manifests/client/darwin.pp @@ -1,21 +1,22 @@ +# Install a munin client on darwin class munin::client::darwin { - file { "/usr/share/snmp/snmpd.conf": - mode => 744, - content => template("munin/darwin_snmpd.conf.erb"), - group => 0, - owner => root, + file { '/usr/share/snmp/snmpd.conf': + mode => '0744', + content => template('munin/darwin_snmpd.conf.erb'), + group => 0, + owner => root, } - line{"startsnmpdno": - file => "/etc/hostconfig", - line => "SNMPSERVER=-NO-", - ensure => 'absent', + line{'startsnmpdno': + ensure => absent, + file => '/etc/hostconfig', + line => 'SNMPSERVER=-NO-', } - line { "startsnmpdyes": - file => "/etc/hostconfig", - line => "SNMPSERVER=-YES-", - notify => Exec["/sbin/SystemStarter start SNMP"], + line { 'startsnmpdyes': + file => '/etc/hostconfig', + line => 'SNMPSERVER=-YES-', + notify => Exec['/sbin/SystemStarter start SNMP'], } - 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..3cfc3fc 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -1,15 +1,16 @@ +# Install the munin client on debian class munin::client::debian inherits munin::client::package { # the plugin will need that - package { "iproute": ensure => installed } + package { 'iproute': ensure => installed } - Service["munin-node"]{ + Service['munin-node']{ # sarge's munin-node init script has no status hasstatus => $::lsbdistcodename ? { sarge => false, default => true } } - File["/etc/munin/munin-node.conf"]{ + 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..186950b 100644 --- a/manifests/client/gentoo.pp +++ b/manifests/client/gentoo.pp @@ -1,7 +1,8 @@ +# install a munin client on gentoo class munin::client::gentoo inherits munin::client::package { Package['munin-node'] { - name => 'munin', + name => 'munin', category => 'net-analyzer', } diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp index cd21abf..e3c18d5 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -4,7 +4,7 @@ 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", + source => 'puppet:///modules/munin/openbsd/package/munin_openbsd.tar.gz', owner => root, group => 0, mode => '0600'; diff --git a/manifests/client/package.pp b/manifests/client/package.pp index 206ccc8..0958202 100644 --- a/manifests/client/package.pp +++ b/manifests/client/package.pp @@ -1,3 +1,4 @@ +# Install a munin client using packages class munin::client::package inherits munin::client::base { package { 'munin-node': ensure => installed } Service['munin-node']{ diff --git a/manifests/host.pp b/manifests/host.pp index 007c43a..e666c3d 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -7,7 +7,7 @@ class munin::host( $cgi_owner = 'os_default', $export_tag = 'munin' ) { - package {"munin": ensure => installed, } + package {'munin': ensure => installed, } include concat::setup Concat::Fragment <<| tag == $export_tag |>> @@ -17,15 +17,17 @@ class munin::host( source => [ "puppet:///modules/site_munin/config/host/${::fqdn}/munin.conf.header", "puppet:///modules/site_munin/config/host/munin.conf.header.${::operatingsystem}.${::lsbdistcodename}", "puppet:///modules/site_munin/config/host/munin.conf.header.${::operatingsystem}", - "puppet:///modules/site_munin/config/host/munin.conf.header", + 'puppet:///modules/site_munin/config/host/munin.conf.header', "puppet:///modules/munin/config/host/munin.conf.header.${::operatingsystem}.${::lsbdistcodename}", "puppet:///modules/munin/config/host/munin.conf.header.${::operatingsystem}", - "puppet:///modules/munin/config/host/munin.conf.header" ], - order => 05, + 'puppet:///modules/munin/config/host/munin.conf.header' ], + order => 05, } - concat{ "/etc/munin/munin.conf": - owner => root, group => 0, mode => 0644; + concat{ '/etc/munin/munin.conf': + owner => root, + group => 0, + mode => '0644', } include munin::plugins::muninhost @@ -39,7 +41,9 @@ class munin::host( # from time to time we cleanup hanging munin-runs file{'/etc/cron.d/munin_kill': content => "4,34 * * * * root if $(ps ax | grep -v grep | grep -q munin-run); then killall munin-run; fi\n", - owner => root, group => 0, mode => 0644; + owner => root, + group => 0, + mode => '0644', } if $munin::host::manage_shorewall { include shorewall::rules::out::munin diff --git a/manifests/host/cgi.pp b/manifests/host/cgi.pp index 1c0072d..5b0ecbb 100644 --- a/manifests/host/cgi.pp +++ b/manifests/host/cgi.pp @@ -1,3 +1,4 @@ +# Set up a munin host using CGI rendering class munin::host::cgi( $owner = 'os_default' ) { @@ -31,9 +32,11 @@ class munin::host::cgi( file{'/etc/logrotate.d/munin': source => [ "puppet:///modules/site_munin/config/host/${::fqdn}/logrotate", "puppet:///modules/site_munin/config/host/logrotate.${::operatingsystem}", - "puppet:///modules/site_munin/config/host/logrotate", + 'puppet:///modules/site_munin/config/host/logrotate', "puppet:///modules/munin/config/host/logrotate.${::operatingsystem}", - "puppet:///modules/munin/config/host/logrotate" ], - owner => root, group => 0, mode => 0644; + 'puppet:///modules/munin/config/host/logrotate' ], + owner => root, + group => 0, + mode => '0644', } } diff --git a/manifests/plugin.pp b/manifests/plugin.pp index ffe5452..60af877 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -26,7 +26,7 @@ define munin::plugin ( require => $dep, notify => Service['munin-node']; } - if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ + if (str2bool($::selinux) == true) and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ File[$plugin]{ seltype => 'munin_etc_t', } diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index cbf64fb..c514eed 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -23,7 +23,7 @@ define munin::plugin::deploy( mode => '0755'; } - if ($::selinux == 'true') and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ + if (str2bool($::selinux) == true) and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ File["munin_plugin_${name}"]{ seltype => $seltype, } diff --git a/manifests/plugin/scriptpaths.pp b/manifests/plugin/scriptpaths.pp index 2cad97b..f31f38d 100644 --- a/manifests/plugin/scriptpaths.pp +++ b/manifests/plugin/scriptpaths.pp @@ -1,12 +1,13 @@ +# Determine the script path for each OS 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" } + gentoo: { $script_path = '/usr/libexec/munin/plugins' } + debian: { $script_path = '/usr/share/munin/plugins' } + centos: { $script_path = '/usr/share/munin/plugins' } openbsd: { $script_path = $::operatingsystemrelease ? { - '4.3' => '/opt/munin/lib/plugins/', - default => '/usr/local/libexec/munin/plugins/' + '4.3' => '/opt/munin/lib/plugins/', + default => '/usr/local/libexec/munin/plugins/', } } - default: { $script_path = "/usr/share/munin/plugins" } + default: { $script_path = '/usr/share/munin/plugins' } } } diff --git a/manifests/plugins/base.pp b/manifests/plugins/base.pp index c6b88ed..33cd84d 100644 --- a/manifests/plugins/base.pp +++ b/manifests/plugins/base.pp @@ -1,29 +1,33 @@ +# A basic set of plugins class munin::plugins::base { # setup basic plugins munin::plugin { - [ df, cpu, interrupts, load, memory, netstat, open_files, - processes, swap, uptime, users, vmstat ]: + [ 'df', 'cpu', 'interrupts', 'load', 'memory', 'netstat', 'open_files', + 'processes', 'swap', 'uptime', 'users', 'vmstat' ]: ensure => present, } file{'/etc/munin/plugin-conf.d/df': content => "[df*]\nenv.exclude none unknown iso9660 squashfs udf romfs ramfs debugfs binfmt_misc rpc_pipefs fuse.gvfs-fuse-daemon\n", - require => Munin::Plugin[df], - owner => root, group => 0, mode => 0644; + require => Munin::Plugin['df'], + owner => 'root', + group => 0, + mode => '0644', } include munin::plugins::interfaces case $::kernel { openbsd: { include munin::plugins::openbsd } linux: { - case $vserver { + case $::vserver { guest: { include munin::plugins::vserver } default: { include munin::plugins::linux } } } } - + case $::virtual { physical: { include munin::plugins::physical } xen0: { include munin::plugins::dom0 } + default: { } } } diff --git a/manifests/plugins/centos.pp b/manifests/plugins/centos.pp index 60c706c..0bb7697 100644 --- a/manifests/plugins/centos.pp +++ b/manifests/plugins/centos.pp @@ -1,3 +1,6 @@ +# Install munin plugins for centos class munin::plugins::centos inherits munin::plugins::base { - munin::plugin { users: ensure => present; } + munin::plugin { 'users': + ensure => present, + } } diff --git a/manifests/plugins/debian.pp b/manifests/plugins/debian.pp index f756150..efa922b 100644 --- a/manifests/plugins/debian.pp +++ b/manifests/plugins/debian.pp @@ -1 +1,2 @@ +# Debian specific plugins class munin::plugins::debian { } diff --git a/manifests/plugins/djbdns.pp b/manifests/plugins/djbdns.pp index c0a5163..de3936b 100644 --- a/manifests/plugins/djbdns.pp +++ b/manifests/plugins/djbdns.pp @@ -1,3 +1,4 @@ -class munin::plugins::djbdns { - munin::plugin::deploy { "tinydns": } +# Set up the djbdns plugin +class munin::plugins::djbdns { + munin::plugin::deploy { 'tinydns': } } diff --git a/manifests/plugins/dom0.pp b/manifests/plugins/dom0.pp index 44995fc..98aee1d 100644 --- a/manifests/plugins/dom0.pp +++ b/manifests/plugins/dom0.pp @@ -1,3 +1,4 @@ +# Set up plugins for a Xen dom0 host class munin::plugins::dom0 { munin::plugin::deploy { [ 'xen', 'xen_cpu', 'xen_memory', 'xen_mem', diff --git a/manifests/plugins/gentoo.pp b/manifests/plugins/gentoo.pp index 27d4689..36f2370 100644 --- a/manifests/plugins/gentoo.pp +++ b/manifests/plugins/gentoo.pp @@ -1,4 +1,5 @@ -class munin::plugins::gentoo { +# Set up the plugins for a gentoo host +class munin::plugins::gentoo { munin::plugin::deploy { 'gentoo_lastupdated': config => "user portage\nenv.logfile /var/log/emerge.log\nenv.tail /usr/bin/tail\nenv.grep /bin/grep" } diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp index da89ed0..b92802b 100644 --- a/manifests/plugins/interfaces.pp +++ b/manifests/plugins/interfaces.pp @@ -1,25 +1,21 @@ # handle if_ and if_err_ plugins -class munin::plugins::interfaces { +class munin::plugins::interfaces { + + $if_err_plugin = $::operatingsystem ? { + 'openbsd' => 'if_errcoll_', + default => 'if_err_', + } # filter out many of the useless interfaces that show up $real_ifs = reject(split($::interfaces, ' |,'), 'eth\d+_\d+|sit0|virbr\d+_nic|vif\d+_\d+|veth\d+|__tmp\d+') - $ifs = regsubst($real_ifs, '(.+)', "if_\\1") + $ifs = regsubst($real_ifs, '(.+)', 'if_\1') + $if_errs = regsubst($real_ifs, '(.+)', "${if_err_plugin}\1") - munin::plugin { - $ifs: ensure => 'if_'; + munin::plugin { $ifs: + ensure => 'if_', } - case $::operatingsystem { - openbsd: { - $if_errs = regsubst($real_ifs, '(.+)', "if_errcoll_\\1") - munin::plugin{ - $if_errs: ensure => 'if_errcoll_'; - } - } - default: { - $if_errs = regsubst($real_ifs, '(.+)', "if_err_\\1") - munin::plugin{ - $if_errs: ensure => 'if_err_'; - } - } + + munin::plugin { $if_errs: + ensure => $if_err_plugin, } } diff --git a/manifests/plugins/kvm.pp b/manifests/plugins/kvm.pp index 7a1430f..650e5ef 100644 --- a/manifests/plugins/kvm.pp +++ b/manifests/plugins/kvm.pp @@ -1,3 +1,4 @@ +# Set up munin plugins for a KVM host class munin::plugins::kvm { munin::plugin::deploy { [ 'kvm_cpu', 'kvm_mem', 'kvm_net' ]:; diff --git a/manifests/plugins/linux.pp b/manifests/plugins/linux.pp index a73de63..57f2bba 100644 --- a/manifests/plugins/linux.pp +++ b/manifests/plugins/linux.pp @@ -1,8 +1,9 @@ -class munin::plugins::linux { +# Set up plugins for a linux host +class munin::plugins::linux { munin::plugin { - [ df_abs, forks, df_inode, irqstats, entropy, open_inodes ]: + [ 'df_abs', 'forks', 'df_inode', 'irqstats', 'entropy', 'open_inodes' ]: ensure => present; - acpi: + 'acpi': ensure => $::acpi_available; } } diff --git a/manifests/plugins/muninhost.pp b/manifests/plugins/muninhost.pp index e4fb87d..644adb6 100644 --- a/manifests/plugins/muninhost.pp +++ b/manifests/plugins/muninhost.pp @@ -1,3 +1,4 @@ -class munin::plugins::muninhost { +# Set up the plugins for a munin host +class munin::plugins::muninhost { munin::plugin { ['munin_update', 'munin_graph']: } } diff --git a/manifests/plugins/openbsd.pp b/manifests/plugins/openbsd.pp index b549994..c195a1d 100644 --- a/manifests/plugins/openbsd.pp +++ b/manifests/plugins/openbsd.pp @@ -1,6 +1,7 @@ -class munin::plugins::openbsd { +# Set up the plugins for an openbsd host +class munin::plugins::openbsd { munin::plugin { - [ memory_pools, memory_types ]: + [ 'memory_pools', 'memory_types' ]: ensure => present, } } diff --git a/manifests/plugins/physical.pp b/manifests/plugins/physical.pp index a1c27a7..b04845c 100644 --- a/manifests/plugins/physical.pp +++ b/manifests/plugins/physical.pp @@ -1,5 +1,7 @@ -class munin::plugins::physical { +# Set up the plugins for a physical machine +class munin::plugins::physical { case $::kernel { - linux: { munin::plugin { iostat: } } + linux: { munin::plugin { 'iostat': } } + default: {} } } diff --git a/manifests/plugins/selinux.pp b/manifests/plugins/selinux.pp index d094f35..9e03f0a 100644 --- a/manifests/plugins/selinux.pp +++ b/manifests/plugins/selinux.pp @@ -1,3 +1,4 @@ +# SELinux specific plugins class munin::plugins::selinux { munin::plugin{ [ 'selinux_avcstat' ]: } } diff --git a/manifests/plugins/setup.pp b/manifests/plugins/setup.pp index 197b657..e6210e9 100644 --- a/manifests/plugins/setup.pp +++ b/manifests/plugins/setup.pp @@ -1,3 +1,4 @@ +# Set up the munin plugins for a node class munin::plugins::setup { # This is required for the munin-node service and package requirements below. @@ -5,10 +6,10 @@ class munin::plugins::setup { file { [ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]: - ignore => 'snmp_*', ensure => directory, + ignore => 'snmp_*', checksum => mtime, - recurse => true, + recurse => true, purge => true, force => true, notify => Service['munin-node'], diff --git a/manifests/plugins/vserver.pp b/manifests/plugins/vserver.pp index e3eec05..5dc6431 100644 --- a/manifests/plugins/vserver.pp +++ b/manifests/plugins/vserver.pp @@ -1,7 +1,7 @@ +# vserver specific plugins class munin::plugins::vserver { munin::plugin { - [ netstat, processes ]: + [ 'netstat', 'processes' ]: ensure => present; } } - diff --git a/manifests/register.pp b/manifests/register.pp index 309c322..1f6d787 100644 --- a/manifests/register.pp +++ b/manifests/register.pp @@ -1,3 +1,4 @@ +# Register a munin client define munin::register ( $host = $::fqdn, $port = '4949', @@ -12,7 +13,7 @@ define munin::register ( @@concat::fragment{ "munin_client_${fhost}_${port}": target => '/etc/munin/munin.conf', - content => template("munin/client.erb"), + content => template('munin/client.erb'), tag => $export_tag, } } diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index 78c3e91..06bb00b 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -1,3 +1,4 @@ +# Register a munin node with snmp enabled define munin::register::snmp ( $community = 'public', $description = 'absent', @@ -10,12 +11,12 @@ define munin::register::snmp ( exec { "munin_register_snmp_${fhost}": command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --shell | sh", - unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null", + unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null", } @@concat::fragment{ "munin_snmp_${fhost}": - target => '/etc/munin/munin.conf', - content => template("munin/client.erb"), - tag => 'munin', + target => '/etc/munin/munin.conf', + content => template('munin/client.erb'), + tag => 'munin', } } diff --git a/manifests/remoteplugin.pp b/manifests/remoteplugin.pp index 603cb66..a2abf69 100644 --- a/manifests/remoteplugin.pp +++ b/manifests/remoteplugin.pp @@ -1,16 +1,19 @@ -define munin::remoteplugin($ensure = "present", $source, $config = '') { +# Configure a munin remote plugin +define munin::remoteplugin($ensure = 'present', $source, $config = '') { case $ensure { - "absent": { munin::plugin{ $name: ensure => absent } } + 'absent': { munin::plugin{ $name: ensure => absent } } default: { file { "/var/lib/puppet/modules/munin/plugins/${name}": source => $source, - mode => 0755, owner => root, group => 0; + mode => '0755', + owner => root, + group => 0, } munin::plugin { $name: - ensure => $ensure, - config => $config, - script_path_in => "/var/lib/puppet/modules/munin/plugins", + ensure => $ensure, + config => $config, + script_path_in => '/var/lib/puppet/modules/munin/plugins', } } } diff --git a/manifests/snmp_collector.pp b/manifests/snmp_collector.pp index 0f8318a..4ff3bf9 100644 --- a/manifests/snmp_collector.pp +++ b/manifests/snmp_collector.pp @@ -1,14 +1,17 @@ +# Set up munin as an SNMP collector class munin::snmp_collector{ - file { - "/var/lib/puppet/modules/munin/create_snmp_links": - source => "puppet:///modules/munin/create_snmp_links.sh", - mode => 755, owner => root, group => 0; - } + file { + '/var/lib/puppet/modules/munin/create_snmp_links': + source => 'puppet:///modules/munin/create_snmp_links.sh', + mode => '0755', + owner => root, + group => 0, + } - exec { "create_snmp_links": - command => "/var/lib/puppet/modules/munin/create_snmp_links /var/lib/puppet/modules/munin/nodes", - require => File["snmp_links"], - timeout => "2048", - schedule => daily + exec { 'create_snmp_links': + command => '/var/lib/puppet/modules/munin/create_snmp_links /var/lib/puppet/modules/munin/nodes', + require => File['snmp_links'], + timeout => '2048', + schedule => daily, } } -- cgit v1.2.3 From 42488b04b47ec3fd87f1d45ec3fa90b588545ca1 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Tue, 2 Jul 2013 19:22:35 +0200 Subject: Add basic testing infrastructure --- .fixtures.yml | 8 +++++ .gitignore | 3 ++ .travis.yml | 18 +++++++++++ Gemfile | 11 +++++++ Rakefile | 9 ++++++ spec/classes/munin_client_spec.rb | 14 +++++++++ spec/classes/munin_host_spec.rb | 14 +++++++++ spec/classes/munin_plugins_interfaces_spec.rb | 44 +++++++++++++++++++++++++++ spec/spec.opts | 1 + spec/spec_helper.rb | 9 ++++++ 10 files changed, 131 insertions(+) create mode 100644 .fixtures.yml create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 Gemfile create mode 100644 Rakefile create mode 100644 spec/classes/munin_client_spec.rb create mode 100644 spec/classes/munin_host_spec.rb create mode 100644 spec/classes/munin_plugins_interfaces_spec.rb create mode 100644 spec/spec.opts create mode 100644 spec/spec_helper.rb diff --git a/.fixtures.yml b/.fixtures.yml new file mode 100644 index 0000000..e05b8fd --- /dev/null +++ b/.fixtures.yml @@ -0,0 +1,8 @@ +fixtures: + repositories: + concat: "https://github.com/puppetlabs/puppetlabs-concat" + openbsd: "https://github.com/duritong/puppet-openbsd" + stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib" + + symlinks: + munin: "#{source_dir}" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6ce4053 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +Gemfile.lock +spec/fixtures/ +vendor/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..3e66a86 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,18 @@ +rvm: + - 1.8.7 + - 1.9.3 + - 2.0.0 +env: + - PUPPET_VERSION=2.6.0 + - PUPPET_VERSION=2.7.0 + - PUPPET_VERSION=3.2.0 +matrix: + exclude: + # No support for Ruby 1.9 before Puppet 2.7 + - rvm: 1.9.3 + env: PUPPET_VERSION=2.6.0 + # No support for Ruby 2.0 before Puppet 3.2 + - rvm: 2.0.0 + env: PUPPET_VERSION=2.6.0 + - rvm: 2.0.0 + env: PUPPET_VERSION=2.7.0 diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..ffc5ecc --- /dev/null +++ b/Gemfile @@ -0,0 +1,11 @@ +source 'https://rubygems.org' + +if ENV.key?('PUPPET_VERSION') + puppetversion = "~> #{ENV['PUPPET_VERSION']}" +else + puppetversion = ['>= 2.6'] +end + +gem 'puppet', puppetversion +gem 'puppet-lint', '>=0.3.2' +gem 'puppetlabs_spec_helper', '>=0.2.0' diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..0d1f018 --- /dev/null +++ b/Rakefile @@ -0,0 +1,9 @@ +require 'puppetlabs_spec_helper/rake_tasks' +require 'puppet-lint/tasks/puppet-lint' + +PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "vendor/**/*.pp"] +PuppetLint.configuration.log_format = '%{path}:%{linenumber}:%{KIND}: %{message}' +PuppetLint.configuration.send("disable_class_inherits_from_params_class") +PuppetLint.configuration.send("disable_80chars") + +task :default => [:spec, :lint] diff --git a/spec/classes/munin_client_spec.rb b/spec/classes/munin_client_spec.rb new file mode 100644 index 0000000..5438b20 --- /dev/null +++ b/spec/classes/munin_client_spec.rb @@ -0,0 +1,14 @@ +require 'spec_helper' + +describe 'munin::client' do + let :facts do + { + :operatingsystem => 'CentOS', + :interfaces => 'lo,eth0', + } + end + + it 'should compile' do + should include_class('munin::client') + end +end diff --git a/spec/classes/munin_host_spec.rb b/spec/classes/munin_host_spec.rb new file mode 100644 index 0000000..2216cc5 --- /dev/null +++ b/spec/classes/munin_host_spec.rb @@ -0,0 +1,14 @@ +require 'spec_helper' + +describe 'munin::host' do + let :facts do + { + :operatingsystem => 'CentOS', + :interfaces => 'lo,eth0', + } + end + + it 'should compile' do + should include_class('munin::host') + end +end diff --git a/spec/classes/munin_plugins_interfaces_spec.rb b/spec/classes/munin_plugins_interfaces_spec.rb new file mode 100644 index 0000000..95aa785 --- /dev/null +++ b/spec/classes/munin_plugins_interfaces_spec.rb @@ -0,0 +1,44 @@ +require 'spec_helper' + +describe 'munin::plugins::interfaces' do + context 'on CentOS' do + let :facts do + { + :operatingsystem => 'CentOS', + :interfaces => 'lo,eth0,sit0', + } + end + + it 'should compile' do + should include_class('munin::plugins::interfaces') + end + + it 'should create plugins for each interface' do + # lo + should contain_munin__plugin('if_lo').with_ensure('if_') + should contain_munin__plugin('if_err_lo').with_ensure('if_err_') + + # eth0 + should contain_munin__plugin('if_eth0').with_ensure('if_') + should contain_munin__plugin('if_err_eth0').with_ensure('if_err_') + end + + it 'should not create plugins for sit0' do + should_not contain_munin__plugin('if_sit0') + should_not contain_munin__plugin('if_err_sit0') + end + end + + context 'on OpenBSD' do + let :facts do + { + :operatingsystem => 'OpenBSD', + :interfaces => 'eth0', + } + end + + it 'should use if_errcoll_ instead of if_err_' do + should contain_munin__plugin('if_errcoll_eth0').with_ensure('if_errcoll_') + end + end +end diff --git a/spec/spec.opts b/spec/spec.opts new file mode 100644 index 0000000..d1bd681 --- /dev/null +++ b/spec/spec.opts @@ -0,0 +1 @@ +--format documentation --colour --backtrace diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..cffe80c --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,9 @@ +require 'puppetlabs_spec_helper/module_spec_helper' + +fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures')) + +RSpec.configure do |c| + c.module_path = File.join(fixture_path, 'modules') + c.manifest_dir = File.join(fixture_path, 'manifests') + c.mock_with :mocha +end -- cgit v1.2.3 From 41be4c9b05b95fc0326ec19ebae0fdffea151f7c Mon Sep 17 00:00:00 2001 From: Eric Badger Date: Mon, 19 Aug 2013 18:20:46 -0500 Subject: Use Facter::Util::Resolution.which instead of `which ...` If this plugin is synced to systems without the 'which' executable, backticked which will cause error messages. --- lib/facter/acpi_available.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/facter/acpi_available.rb b/lib/facter/acpi_available.rb index 9a0474f..dae057f 100644 --- a/lib/facter/acpi_available.rb +++ b/lib/facter/acpi_available.rb @@ -1,7 +1,7 @@ # return whether acpi is available -- used for deciding whether to install the munin plugin Facter.add("acpi_available") do setcode do - if not File.exist? `which acpi 2>/dev/null`.chomp or `acpi -t -B -A 2>/dev/null`.match(/\d/).nil? + if not Facter::Util::Resolution.which('acpi') or `acpi -t -B -A 2>/dev/null`.match(/\d/).nil? "absent" else "present" -- cgit v1.2.3 From a9e38121fdfce63a82da3b4d0177b9bdc485b1c9 Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Wed, 21 Aug 2013 17:33:24 +0200 Subject: README converted to MarkDown syntax --- README | 83 --------------------------------------------------------------- README.md | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 83 deletions(-) delete mode 100644 README create mode 100644 README.md diff --git a/README b/README deleted file mode 100644 index ef3c2fd..0000000 --- a/README +++ /dev/null @@ -1,83 +0,0 @@ -== Munin == - -Munin is a performance monitoring system which creates nice RRD graphs and has -a very easy plugin interface. The munin homepage is http://munin.projects.linpro.no/ - -To use this module, follow these directions: - -0. This module requires puppet 2.7 or newer. - -1. Install the "common", "concat" and "stdlib" modules -- the munin module - depends on functions that are defined and installed via these modules. - -2. You will need storedconfigs enabled in your puppet setup, to do that you need to - add a line to your puppet.conf in your [puppetmasterd] section which says: - - storeconfigs=true - - You may wish to immediately setup a mysql/pgsql database for your storedconfigs, as - the default method uses sqlite, and is not very efficient, to do that you need lines - such as the following below the storeconfigs=true line (adjust as needed): - - dbadapter=mysql - dbserver=localhost - dbuser=puppet - dbpassword=puppetspasswd - -3. Install the "munin" module: - - a. Your modules directory will need all the files included in this repository placed - under a directory called "munin" - - b. For every host you wish to gather munin statistics, add the class munin::client to that - node. You will want to set the class parameter 'allow' to be the IP(s) of the munin - collector, this defines what IP is permitted to connect to the node, for example: - - node foo { - class { 'munin::client': allow => '192.168.0.1'} - } - - for multiple munin nodes, you can pass an array: - - class { 'munin::client': allow => [ '192.168.0.1', '10.0.0.1' ] } - - c. In the node definition in your site.pp for your main munin host, add the following: - - class { 'munin::host': } - - If you want cgi graphing you can pass cgi_graphing => true. - (For CentOS this is enabled in the default header config) - for more information, see: http://munin.projects.linpro.no/wiki/CgiHowto - - d. If there are particular munin plugins you want to enable or configure, you define them - in the node definition, like follows: - - # Enable monitoring of disk stats in bytes - munin::plugin { 'df_abs': } - - # Use a non-standard plugin path to use custom plugins - munin::plugin { 'spamassassin': - ensure => present, - script_path => '/usr/local/share/munin-plugins', - } - - # For wildcard plugins (eg. ip_, snmp_, etc.), use the name variable to - # configure the plugin name, and the ensure parameter to indicate the base - # plugin name to which you want a symlink, for example: - munin::plugin { [ 'ip_192.168.0.1', 'ip_10.0.0.1' ]: - ensure => 'ip_' - } - - # Use a special config to pass parameters to the plugin - munin::plugin { - [ 'apache_accesses', 'apache_processes', 'apache_volume' ]: - ensure => present, - config => 'env.url http://127.0.0.1:80/server-status?auto' - } - - e. If you have Linux-Vservers configured, you will likely have multiple munin-node processes - competing for the default port 4949, for those nodes, set an alternate port for munin-node - to run on by putting something similar to the following class parameter: - - class { 'munin::client': allow => '192.168.0.1', port => '4948' } - diff --git a/README.md b/README.md new file mode 100644 index 0000000..1a46be2 --- /dev/null +++ b/README.md @@ -0,0 +1,82 @@ +# Munin + +Munin is a performance monitoring system which creates nice RRD graphs and has +a very easy plugin interface. The munin homepage is http://munin.projects.linpro.no/ + +To use this module, follow these directions: + +## Requirements + + * puppet 2.7 or newer + * install the `common`, `concat` and `stdlib` modules -- the munin module depends on functions that are defined and installed via these modules + * you will need storedconfigs enabled in your puppet setup, to do that you need to add a line to your `puppet.conf` in your `[puppetmasterd]` section which says: + + storeconfigs=true + + * You may wish to immediately setup a `mysql`/ `pgsql` database for your storedconfigs, as + the default method uses sqlite, and is not very efficient, to do that you need lines + such as the following below the `storeconfigs=true` line (adjust as needed): + + dbadapter=mysql + dbserver=localhost + dbuser=puppet + dbpassword=puppetspasswd + +## Usage + + a. Your modules directory will need all the files included in this repository placed + under a directory called "munin" + + b. For every host you wish to gather munin statistics, add the class munin::client to that + node. You will want to set the class parameter 'allow' to be the IP(s) of the munin + collector, this defines what IP is permitted to connect to the node, for example: + + node foo { + class { 'munin::client': allow => '192.168.0.1'} + } + + +for multiple munin nodes, you can pass an array: + + class { 'munin::client': allow => [ '192.168.0.1', '10.0.0.1' ] } + + c. In the node definition in your site.pp for your main munin host, add the following: + + class { 'munin::host': } + + If you want cgi graphing you can pass cgi_graphing => true. + (For CentOS this is enabled in the default header config) + for more information, see: http://munin.projects.linpro.no/wiki/CgiHowto + + d. If there are particular munin plugins you want to enable or configure, you define them + in the node definition, like follows: + + # Enable monitoring of disk stats in bytes + munin::plugin { 'df_abs': } + + # Use a non-standard plugin path to use custom plugins + munin::plugin { 'spamassassin': + ensure => present, + script_path => '/usr/local/share/munin-plugins', + } + + # For wildcard plugins (eg. ip_, snmp_, etc.), use the name variable to + # configure the plugin name, and the ensure parameter to indicate the base + # plugin name to which you want a symlink, for example: + munin::plugin { [ 'ip_192.168.0.1', 'ip_10.0.0.1' ]: + ensure => 'ip_' + } + + # Use a special config to pass parameters to the plugin + munin::plugin { + [ 'apache_accesses', 'apache_processes', 'apache_volume' ]: + ensure => present, + config => 'env.url http://127.0.0.1:80/server-status?auto' + } + + e. If you have Linux-Vservers configured, you will likely have multiple munin-node processes + competing for the default port 4949, for those nodes, set an alternate port for munin-node + to run on by putting something similar to the following class parameter: + + class { 'munin::client': allow => '192.168.0.1', port => '4948' } + -- cgit v1.2.3 From 8f8ef21afd6424fc7f6ecaabb968b8278073d430 Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Wed, 21 Aug 2013 17:35:46 +0200 Subject: lists formatting --- README.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1a46be2..d6347ee 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,8 @@ -# Munin +# Puppet-Munin Munin is a performance monitoring system which creates nice RRD graphs and has a very easy plugin interface. The munin homepage is http://munin.projects.linpro.no/ -To use this module, follow these directions: - ## Requirements * puppet 2.7 or newer @@ -24,10 +22,10 @@ To use this module, follow these directions: ## Usage - a. Your modules directory will need all the files included in this repository placed + 1. Your modules directory will need all the files included in this repository placed under a directory called "munin" - b. For every host you wish to gather munin statistics, add the class munin::client to that + 2. For every host you wish to gather munin statistics, add the class munin::client to that node. You will want to set the class parameter 'allow' to be the IP(s) of the munin collector, this defines what IP is permitted to connect to the node, for example: @@ -40,7 +38,7 @@ for multiple munin nodes, you can pass an array: class { 'munin::client': allow => [ '192.168.0.1', '10.0.0.1' ] } - c. In the node definition in your site.pp for your main munin host, add the following: + 3. In the node definition in your site.pp for your main munin host, add the following: class { 'munin::host': } @@ -48,7 +46,7 @@ for multiple munin nodes, you can pass an array: (For CentOS this is enabled in the default header config) for more information, see: http://munin.projects.linpro.no/wiki/CgiHowto - d. If there are particular munin plugins you want to enable or configure, you define them + 4. If there are particular munin plugins you want to enable or configure, you define them in the node definition, like follows: # Enable monitoring of disk stats in bytes @@ -74,7 +72,7 @@ for multiple munin nodes, you can pass an array: config => 'env.url http://127.0.0.1:80/server-status?auto' } - e. If you have Linux-Vservers configured, you will likely have multiple munin-node processes + 5. If you have Linux-Vservers configured, you will likely have multiple munin-node processes competing for the default port 4949, for those nodes, set an alternate port for munin-node to run on by putting something similar to the following class parameter: -- cgit v1.2.3 From 67af1c2b32e4557cc9b62d1b8046bb6c2b006319 Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Wed, 21 Aug 2013 17:38:02 +0200 Subject: fixed list numbering --- README.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d6347ee..74d82ba 100644 --- a/README.md +++ b/README.md @@ -26,15 +26,14 @@ a very easy plugin interface. The munin homepage is http://munin.projects.linpro under a directory called "munin" 2. For every host you wish to gather munin statistics, add the class munin::client to that - node. You will want to set the class parameter 'allow' to be the IP(s) of the munin + node. You will want to set the class parameter `allow` to be the IP(s) of the munin collector, this defines what IP is permitted to connect to the node, for example: node foo { class { 'munin::client': allow => '192.168.0.1'} } - -for multiple munin nodes, you can pass an array: + for multiple munin nodes, you can pass an array: class { 'munin::client': allow => [ '192.168.0.1', '10.0.0.1' ] } @@ -42,9 +41,7 @@ for multiple munin nodes, you can pass an array: class { 'munin::host': } - If you want cgi graphing you can pass cgi_graphing => true. - (For CentOS this is enabled in the default header config) - for more information, see: http://munin.projects.linpro.no/wiki/CgiHowto + If you want cgi graphing you can pass `cgi_graphing => true`. (For CentOS this is enabled in the default header config) for more information, see: http://munin.projects.linpro.no/wiki/CgiHowto 4. If there are particular munin plugins you want to enable or configure, you define them in the node definition, like follows: -- cgit v1.2.3 From cef87f9f10e48c11713e182ce8dcc367145f2ba9 Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Wed, 21 Aug 2013 17:59:45 +0200 Subject: added modulefile --- Modulefile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Modulefile diff --git a/Modulefile b/Modulefile new file mode 100644 index 0000000..99c61a1 --- /dev/null +++ b/Modulefile @@ -0,0 +1,14 @@ +name 'puppet-munin' +version '0.0.1' +source 'git://github.com/duritong/puppet-munin.git' +author 'duritong' +license 'Apache License, Version 2.0' +summary 'Puppet module for Munin monitoring' +description 'Munin is a performance monitoring system which creates nice RRD graphs and has a very easy plugin interface' +project_page 'https://github.com/duritong/puppet-munin' + +## Add dependencies, if any: +# dependency 'username/name', '>= 1.2.0' +dependency 'ripienaar/concat', '>= 0.2.0' +dependency 'DavidSchmitt/common', '>= 1.0.0' +dependency 'puppetlabs/stdlib', '>= 3.2.0' -- cgit v1.2.3 From eed532c8bbf4a6ed63b53a03b91ebf26ff14e7a0 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 25 Aug 2013 13:05:37 +0200 Subject: there isn't anymore any dependency on the common module --- Modulefile | 1 - README.md | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Modulefile b/Modulefile index 99c61a1..07fdbd7 100644 --- a/Modulefile +++ b/Modulefile @@ -10,5 +10,4 @@ project_page 'https://github.com/duritong/puppet-munin' ## Add dependencies, if any: # dependency 'username/name', '>= 1.2.0' dependency 'ripienaar/concat', '>= 0.2.0' -dependency 'DavidSchmitt/common', '>= 1.0.0' dependency 'puppetlabs/stdlib', '>= 3.2.0' diff --git a/README.md b/README.md index 74d82ba..0ab9c86 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ a very easy plugin interface. The munin homepage is http://munin.projects.linpro ## Requirements * puppet 2.7 or newer - * install the `common`, `concat` and `stdlib` modules -- the munin module depends on functions that are defined and installed via these modules + * install the `concat` and `stdlib` modules -- the munin module depends on functions that are defined and installed via these modules * you will need storedconfigs enabled in your puppet setup, to do that you need to add a line to your `puppet.conf` in your `[puppetmasterd]` section which says: storeconfigs=true -- cgit v1.2.3 From ec1fdda96d0cc52e4c6ea32913518da240c5af69 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 26 Aug 2013 00:10:27 +0200 Subject: correct name --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 07fdbd7..7590eed 100644 --- a/Modulefile +++ b/Modulefile @@ -1,4 +1,4 @@ -name 'puppet-munin' +name 'duritong-munin' version '0.0.1' source 'git://github.com/duritong/puppet-munin.git' author 'duritong' -- cgit v1.2.3 From 5a2711037a2fc016666ca75e5fbec69d5009b9d8 Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Tue, 3 Sep 2013 23:41:07 +0200 Subject: plugin::deploy added to README --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0ab9c86..71b935e 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ a very easy plugin interface. The munin homepage is http://munin.projects.linpro * puppet 2.7 or newer * install the `concat` and `stdlib` modules -- the munin module depends on functions that are defined and installed via these modules * you will need storedconfigs enabled in your puppet setup, to do that you need to add a line to your `puppet.conf` in your `[puppetmasterd]` section which says: - + storeconfigs=true * You may wish to immediately setup a `mysql`/ `pgsql` database for your storedconfigs, as @@ -75,3 +75,11 @@ a very easy plugin interface. The munin homepage is http://munin.projects.linpro class { 'munin::client': allow => '192.168.0.1', port => '4948' } + 6. For deploying plugins which are not available at client, you can fetch them from puppet + master using `munin::plugin::deploy`. + + munin::plugin::deploy { 'redis': + source => 'munin/plugins/redis/redis_', + } + + In this case the file on master would be located in `/etc/puppet/modules/munin/files/plugins/redis/redis_` \ No newline at end of file -- cgit v1.2.3 From e6a975eb0ab7ef99479344b553ac2431555f5747 Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Thu, 5 Sep 2013 10:01:44 +0200 Subject: mentioned modulepath where puppet searches for plugins to deploy --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 71b935e..9e4602e 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,9 @@ a very easy plugin interface. The munin homepage is http://munin.projects.linpro munin::plugin::deploy { 'redis': source => 'munin/plugins/redis/redis_', + config => '' # pass parameters to plugin } - In this case the file on master would be located in `/etc/puppet/modules/munin/files/plugins/redis/redis_` \ No newline at end of file + In this example the file on master would be located in `{modulepath}/munin/files/plugins/redis/redis_`. + Module path is specified in `puppet.conf`, you can find out your `{modulepath}` easily by tying + in console `puppet config print modulepath`. \ No newline at end of file -- cgit v1.2.3 From fde1a77a12501f25a47a2d247a2391d0859fd86d Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Thu, 19 Sep 2013 10:07:18 +0200 Subject: config header for ubuntu --- files/config/host/munin.conf.header.Ubuntu | 75 ++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 files/config/host/munin.conf.header.Ubuntu diff --git a/files/config/host/munin.conf.header.Ubuntu b/files/config/host/munin.conf.header.Ubuntu new file mode 100644 index 0000000..771d50d --- /dev/null +++ b/files/config/host/munin.conf.header.Ubuntu @@ -0,0 +1,75 @@ +# Example configuration file for Munin, generated by 'make build' + +# The next three variables specifies where the location of the RRD +# databases, the HTML output, and the logs, severally. They all +# must be writable by the user running munin-cron. +dbdir /var/lib/munin +htmldir /var/cache/munin/www +logdir /var/log/munin +rundir /var/run/munin + +# Where to look for the HTML templates +tmpldir /etc/munin/templates + +# Make graphs show values per minute instead of per second +#graph_period minute + +# Drop somejuser@fnord.comm and anotheruser@blibb.comm an email everytime +# something changes (OK -> WARNING, CRITICAL -> OK, etc) +#contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm +#contact.anotheruser.command mail -s "Munin notification" anotheruser@blibb.comm +# +# For those with Nagios, the following might come in handy. In addition, +# the services must be defined in the Nagios server as well. +#contact.nagios.command /usr/sbin/send_nsca -H nagios.host.com -c /etc/send_nsca.cfg + +#contacts me +#contact.me.command mail -s "Munin notification ${var:group} :: ${var:host} :: ${var:graph_title}" root +#contact.me.always_send warning critical + +# a simple host tree +#[localhost] +# address 127.0.0.1 +# use_node_name yes + +# +# A more complex example of a host tree +# +## First our "normal" host. +# [fii.foo.com] +# address foo +# +## Then our other host... +# [fay.foo.com] +# address fay +# +## Then we want totals... +# [foo.com;Totals] #Force it into the "foo.com"-domain... +# update no # Turn off data-fetching for this "host". +# +# # The graph "load1". We want to see the loads of both machines... +# # "fii=fii.foo.com:load.load" means "label=machine:graph.field" +# load1.graph_title Loads side by side +# load1.graph_order fii=fii.foo.com:load.load fay=fay.foo.com:load.load +# +# # The graph "load2". Now we want them stacked on top of each other. +# load2.graph_title Loads on top of each other +# load2.dummy_field.stack fii=fii.foo.com:load.load fay=fay.foo.com:load.load +# load2.dummy_field.draw AREA # We want area instead the default LINE2. +# load2.dummy_field.label dummy # This is needed. Silly, really. +# +# # The graph "load3". Now we want them summarised into one field +# load3.graph_title Loads summarised +# load3.combined_loads.sum fii.foo.com:load.load fay.foo.com:load.load +# load3.combined_loads.label Combined loads # Must be set, as this is +# # not a dummy field! +# +## ...and on a side note, I want them listen in another order (default is +## alphabetically) +# +# # Since [foo.com] would be interpreted as a host in the domain "com", we +# # specify that this is a domain by adding a semicolon. +# [foo.com;] +# node_order Totals fii.foo.com fay.foo.com +# + -- cgit v1.2.3 From 2f2627cd49c93f7455b2e6294e11e16be99a27ac Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Sat, 7 Sep 2013 10:20:18 +0200 Subject: readme reformatted into sections Conflicts: README.md --- README.md | 123 +++++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 70 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index 9e4602e..b7f75fc 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ a very easy plugin interface. The munin homepage is http://munin.projects.linpro ## Requirements * puppet 2.7 or newer - * install the `concat` and `stdlib` modules -- the munin module depends on functions that are defined and installed via these modules + * install the `concat` and `stdlib` modules - the munin module depends on functions that are defined and installed via these modules * you will need storedconfigs enabled in your puppet setup, to do that you need to add a line to your `puppet.conf` in your `[puppetmasterd]` section which says: storeconfigs=true @@ -22,67 +22,84 @@ a very easy plugin interface. The munin homepage is http://munin.projects.linpro ## Usage - 1. Your modules directory will need all the files included in this repository placed - under a directory called "munin" +Your modules directory will need all the files included in this repository placed under a directory called `munin`. - 2. For every host you wish to gather munin statistics, add the class munin::client to that - node. You will want to set the class parameter `allow` to be the IP(s) of the munin - collector, this defines what IP is permitted to connect to the node, for example: +### Master configuration - node foo { - class { 'munin::client': allow => '192.168.0.1'} - } +In the node definition in your site.pp for your main munin host, add the following: - for multiple munin nodes, you can pass an array: + class { 'munin::host': } - class { 'munin::client': allow => [ '192.168.0.1', '10.0.0.1' ] } +If you want cgi graphing you can pass `cgi_graphing => true`. (For CentOS this is enabled in the default header config) for more information, see: http://munin.projects.linpro.no/wiki/CgiHowto + +### Client configuration + +For every host you wish to gather munin statistics, add the class `munin::client` to that +node. You will want to set the class parameter `allow` to be the IP(s) of the munin +collector, this defines what IP is permitted to connect to the node, for example: + + node foo { + class { 'munin::client': allow => '192.168.0.1'} + } + +for multiple munin nodes, you can pass an array: + + class { 'munin::client': allow => [ '192.168.0.1', '10.0.0.1' ] } 3. In the node definition in your site.pp for your main munin host, add the following: - class { 'munin::host': } - - If you want cgi graphing you can pass `cgi_graphing => true`. (For CentOS this is enabled in the default header config) for more information, see: http://munin.projects.linpro.no/wiki/CgiHowto +### Local plugins - 4. If there are particular munin plugins you want to enable or configure, you define them - in the node definition, like follows: +If there are particular munin plugins you want to enable or configure, you define them +in the node definition, like follows: - # Enable monitoring of disk stats in bytes - munin::plugin { 'df_abs': } + # Enable monitoring of disk stats in bytes + munin::plugin { 'df_abs': } - # Use a non-standard plugin path to use custom plugins - munin::plugin { 'spamassassin': - ensure => present, - script_path => '/usr/local/share/munin-plugins', - } + # Use a non-standard plugin path to use custom plugins + munin::plugin { 'spamassassin': + ensure => present, + script_path => '/usr/local/share/munin-plugins', + } - # For wildcard plugins (eg. ip_, snmp_, etc.), use the name variable to - # configure the plugin name, and the ensure parameter to indicate the base - # plugin name to which you want a symlink, for example: - munin::plugin { [ 'ip_192.168.0.1', 'ip_10.0.0.1' ]: - ensure => 'ip_' - } + # For wildcard plugins (eg. ip_, snmp_, etc.), use the name variable to + # configure the plugin name, and the ensure parameter to indicate the base + # plugin name to which you want a symlink, for example: + munin::plugin { [ 'ip_192.168.0.1', 'ip_10.0.0.1' ]: + ensure => 'ip_' + } - # Use a special config to pass parameters to the plugin - munin::plugin { - [ 'apache_accesses', 'apache_processes', 'apache_volume' ]: - ensure => present, - config => 'env.url http://127.0.0.1:80/server-status?auto' - } - - 5. If you have Linux-Vservers configured, you will likely have multiple munin-node processes - competing for the default port 4949, for those nodes, set an alternate port for munin-node - to run on by putting something similar to the following class parameter: - - class { 'munin::client': allow => '192.168.0.1', port => '4948' } - - 6. For deploying plugins which are not available at client, you can fetch them from puppet - master using `munin::plugin::deploy`. - - munin::plugin::deploy { 'redis': - source => 'munin/plugins/redis/redis_', - config => '' # pass parameters to plugin - } - - In this example the file on master would be located in `{modulepath}/munin/files/plugins/redis/redis_`. - Module path is specified in `puppet.conf`, you can find out your `{modulepath}` easily by tying - in console `puppet config print modulepath`. \ No newline at end of file + # Use a special config to pass parameters to the plugin + munin::plugin { + [ 'apache_accesses', 'apache_processes', 'apache_volume' ]: + ensure => present, + config => 'env.url http://127.0.0.1:80/server-status?auto' + } + +Note: The plugin must be installed at the client. For listing available plugins run as root `munin-node-configure --suggest` + +### External plugins + +For deploying plugins which are not available at client, you can fetch them from puppet +master using `munin::plugin::deploy`. + + munin::plugin::deploy { 'redis': + source => 'munin/plugins/redis/redis_', + config => '' # pass parameters to plugin + } + +In this example the file on master would be located in: + + {modulepath}/munin/files/plugins/redis/redis_ + +Module path is specified in `puppet.conf`, you can find out your `{modulepath}` easily by tying +in console `puppet config print modulepath`. + + +### Multiple munin instances + +If you have Linux-Vservers configured, you will likely have multiple munin-node processes +competing for the default port 4949, for those nodes, set an alternate port for munin-node +to run on by putting something similar to the following class parameter: + + class { 'munin::client': allow => '192.168.0.1', port => '4948' } -- cgit v1.2.3 From 7cd45bebbf2eea216bbc34765e68bcb36b540593 Mon Sep 17 00:00:00 2001 From: Kondrashov Ilia Date: Sat, 5 Oct 2013 21:03:53 +0400 Subject: Correct script_path_in param name --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b7f75fc..420277e 100644 --- a/README.md +++ b/README.md @@ -58,8 +58,8 @@ in the node definition, like follows: # Use a non-standard plugin path to use custom plugins munin::plugin { 'spamassassin': - ensure => present, - script_path => '/usr/local/share/munin-plugins', + ensure => present, + script_path_in => '/usr/local/share/munin-plugins', } # For wildcard plugins (eg. ip_, snmp_, etc.), use the name variable to -- cgit v1.2.3 From 9c2c7140876bbe20a9871543ba28b7522acdb213 Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Sat, 12 Oct 2013 16:45:19 +0200 Subject: testing infrastructure --- .fixtures.yml | 8 -------- .gitignore | 2 ++ Gemfile | 5 +++++ Puppetfile | 3 +++ Puppetfile.lock | 8 ++++++++ Rakefile | 12 ++++++++++++ spec/spec_helper_system.rb | 26 ++++++++++++++++++++++++++ 7 files changed, 56 insertions(+), 8 deletions(-) delete mode 100644 .fixtures.yml create mode 100644 Puppetfile create mode 100644 Puppetfile.lock create mode 100644 spec/spec_helper_system.rb diff --git a/.fixtures.yml b/.fixtures.yml deleted file mode 100644 index e05b8fd..0000000 --- a/.fixtures.yml +++ /dev/null @@ -1,8 +0,0 @@ -fixtures: - repositories: - concat: "https://github.com/puppetlabs/puppetlabs-concat" - openbsd: "https://github.com/duritong/puppet-openbsd" - stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib" - - symlinks: - munin: "#{source_dir}" diff --git a/.gitignore b/.gitignore index 6ce4053..9ef9ca4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ Gemfile.lock spec/fixtures/ vendor/ +.tmp/* +.librarian/* diff --git a/Gemfile b/Gemfile index ffc5ecc..d5495b8 100644 --- a/Gemfile +++ b/Gemfile @@ -9,3 +9,8 @@ end gem 'puppet', puppetversion gem 'puppet-lint', '>=0.3.2' gem 'puppetlabs_spec_helper', '>=0.2.0' +gem 'rake', '>=0.9.2.2' +gem 'librarian-puppet', '>=0.9.10' +gem 'rspec-system-puppet', :require => false +gem 'serverspec', :require => false +gem 'rspec-system-serverspec', :require => false diff --git a/Puppetfile b/Puppetfile new file mode 100644 index 0000000..03b0752 --- /dev/null +++ b/Puppetfile @@ -0,0 +1,3 @@ +forge 'http://forge.puppetlabs.com' + +mod 'puppetlabs/stdlib', '>=0.1.6' diff --git a/Puppetfile.lock b/Puppetfile.lock new file mode 100644 index 0000000..d949104 --- /dev/null +++ b/Puppetfile.lock @@ -0,0 +1,8 @@ +FORGE + remote: http://forge.puppetlabs.com + specs: + puppetlabs/stdlib (4.1.0) + +DEPENDENCIES + puppetlabs/stdlib (>= 0.1.6) + diff --git a/Rakefile b/Rakefile index 0d1f018..c0bab20 100644 --- a/Rakefile +++ b/Rakefile @@ -1,9 +1,21 @@ +require 'bundler' +Bundler.require(:rake) + require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-lint/tasks/puppet-lint' +require 'rspec-system/rake_task' PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "vendor/**/*.pp"] PuppetLint.configuration.log_format = '%{path}:%{linenumber}:%{KIND}: %{message}' PuppetLint.configuration.send("disable_class_inherits_from_params_class") PuppetLint.configuration.send("disable_80chars") +# use librarian-puppet to manage fixtures instead of .fixtures.yml +# offers more possibilities like explicit version management, forge downloads,... +task :librarian_spec_prep do + sh "librarian-puppet install --path=spec/fixtures/modules/" +end +task :spec_prep => :librarian_spec_prep + + task :default => [:spec, :lint] diff --git a/spec/spec_helper_system.rb b/spec/spec_helper_system.rb new file mode 100644 index 0000000..462d2a1 --- /dev/null +++ b/spec/spec_helper_system.rb @@ -0,0 +1,26 @@ +require 'rspec-system/spec_helper' +require 'rspec-system-puppet/helpers' +require 'rspec-system-serverspec/helpers' +include Serverspec::Helper::RSpecSystem +include Serverspec::Helper::DetectOS +include RSpecSystemPuppet::Helpers + +RSpec.configure do |c| + # Project root + proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) + + # Enable colour + c.tty = true + + c.include RSpecSystemPuppet::Helpers + + # This is where we 'setup' the nodes before running our tests + c.before :suite do + # Install puppet + puppet_install + + # Install modules and dependencies + puppet_module_install(:source => proj_root, :module_name => 'munin') + shell('puppet module install puppetlabs-stdlib') + end +end -- cgit v1.2.3 From b729e3903ded13e07501fc9b55766d21de206ae8 Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Sat, 12 Oct 2013 18:29:11 +0200 Subject: basic munin::client specs --- .rspec | 3 +++ Puppetfile | 1 + Puppetfile.lock | 2 ++ spec/classes/munin_client_spec.rb | 47 ++++++++++++++++++++++++++++++++++----- spec/spec.opts | 1 - spec/spec_helper_system.rb | 1 + 6 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 .rspec delete mode 100644 spec/spec.opts diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..e0b06e8 --- /dev/null +++ b/.rspec @@ -0,0 +1,3 @@ +--format documentation +--color +#--backtrace diff --git a/Puppetfile b/Puppetfile index 03b0752..60d1d14 100644 --- a/Puppetfile +++ b/Puppetfile @@ -1,3 +1,4 @@ forge 'http://forge.puppetlabs.com' mod 'puppetlabs/stdlib', '>=0.1.6' +mod 'puppetlabs/concat' \ No newline at end of file diff --git a/Puppetfile.lock b/Puppetfile.lock index d949104..0689d41 100644 --- a/Puppetfile.lock +++ b/Puppetfile.lock @@ -1,8 +1,10 @@ FORGE remote: http://forge.puppetlabs.com specs: + puppetlabs/concat (1.0.0-rc1) puppetlabs/stdlib (4.1.0) DEPENDENCIES + puppetlabs/concat (>= 0) puppetlabs/stdlib (>= 0.1.6) diff --git a/spec/classes/munin_client_spec.rb b/spec/classes/munin_client_spec.rb index 5438b20..a5539b3 100644 --- a/spec/classes/munin_client_spec.rb +++ b/spec/classes/munin_client_spec.rb @@ -1,14 +1,49 @@ require 'spec_helper' describe 'munin::client' do - let :facts do - { - :operatingsystem => 'CentOS', + shared_examples 'debian' do |os, codename| + let(:facts) {{ + :operatingsystem => os, + :osfamily => 'Debian', + :lsbdistcodename => codename, + }} + it { should contain_package('munin-node') } + it { should contain_package('iproute') } + it { should contain_file('/etc/munin/munin-node.conf') } + end + + shared_examples 'redhat' do |os, codename| + let(:facts) {{ + :operatingsystem => os, + :osfamily => 'RedHat', + :lsbdistcodename => codename, :interfaces => 'lo,eth0', - } + }} + it { should contain_package('munin-node') } + it { should contain_file('/etc/munin/munin-node.conf') } + end + + context 'on debian-like system' do + it_behaves_like 'debian', 'Debian', 'squeeze' + it_behaves_like 'debian', 'Debian', 'wheezy' + it_behaves_like 'debian', 'Ubuntu', 'precise' end - it 'should compile' do - should include_class('munin::client') + context 'on redhat-like system' do + it_behaves_like 'redhat', 'CentOS', '6' + # not supported yet + # it_behaves_like 'redhat', 'RedHat', '6' end + + context 'gentoo' do + let(:facts) {{ + :operatingsystem => 'Gentoo', + :osfamily => 'Gentoo', + :lsbdistcodename => '', + :interfaces => 'lo,eth0', + }} + it { should contain_package('munin-node') } + it { should contain_file('/etc/munin/munin-node.conf') } + end + end diff --git a/spec/spec.opts b/spec/spec.opts deleted file mode 100644 index d1bd681..0000000 --- a/spec/spec.opts +++ /dev/null @@ -1 +0,0 @@ ---format documentation --colour --backtrace diff --git a/spec/spec_helper_system.rb b/spec/spec_helper_system.rb index 462d2a1..9adfea9 100644 --- a/spec/spec_helper_system.rb +++ b/spec/spec_helper_system.rb @@ -22,5 +22,6 @@ RSpec.configure do |c| # Install modules and dependencies puppet_module_install(:source => proj_root, :module_name => 'munin') shell('puppet module install puppetlabs-stdlib') + shell('puppet module install puppetlabs-concat') end end -- cgit v1.2.3 From 342ea7aa15a54c33ec4a12cf10b7b1a0c9811dba Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Sun, 13 Oct 2013 18:14:45 +0200 Subject: extended tests, first group should pass --- .travis.yml | 1 + spec/classes/munin_client_spec.rb | 14 ++++++++------ spec/classes/munin_host_spec.rb | 23 +++++++++++++++-------- spec/spec_helper.rb | 6 +++++- 4 files changed, 29 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3e66a86..330677c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ rvm: - 1.8.7 - 1.9.3 - 2.0.0 +script: 'rake spec' env: - PUPPET_VERSION=2.6.0 - PUPPET_VERSION=2.7.0 diff --git a/spec/classes/munin_client_spec.rb b/spec/classes/munin_client_spec.rb index a5539b3..ebf8d73 100644 --- a/spec/classes/munin_client_spec.rb +++ b/spec/classes/munin_client_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe 'munin::client' do - shared_examples 'debian' do |os, codename| + shared_examples 'debian-client' do |os, codename| let(:facts) {{ :operatingsystem => os, :osfamily => 'Debian', @@ -10,9 +10,10 @@ describe 'munin::client' do it { should contain_package('munin-node') } it { should contain_package('iproute') } it { should contain_file('/etc/munin/munin-node.conf') } + it { should include_class('munin::client::debian') } end - shared_examples 'redhat' do |os, codename| + shared_examples 'redhat-client' do |os, codename| let(:facts) {{ :operatingsystem => os, :osfamily => 'RedHat', @@ -24,13 +25,13 @@ describe 'munin::client' do end context 'on debian-like system' do - it_behaves_like 'debian', 'Debian', 'squeeze' - it_behaves_like 'debian', 'Debian', 'wheezy' - it_behaves_like 'debian', 'Ubuntu', 'precise' + it_behaves_like 'debian-client', 'Debian', 'squeeze' + it_behaves_like 'debian-client', 'Debian', 'wheezy' + it_behaves_like 'debian-client', 'Ubuntu', 'precise' end context 'on redhat-like system' do - it_behaves_like 'redhat', 'CentOS', '6' + it_behaves_like 'redhat-client', 'CentOS', '6' # not supported yet # it_behaves_like 'redhat', 'RedHat', '6' end @@ -44,6 +45,7 @@ describe 'munin::client' do }} it { should contain_package('munin-node') } it { should contain_file('/etc/munin/munin-node.conf') } + it { should include_class('munin::client::gentoo') } end end diff --git a/spec/classes/munin_host_spec.rb b/spec/classes/munin_host_spec.rb index 2216cc5..ccfcee6 100644 --- a/spec/classes/munin_host_spec.rb +++ b/spec/classes/munin_host_spec.rb @@ -1,14 +1,21 @@ require 'spec_helper' describe 'munin::host' do - let :facts do - { - :operatingsystem => 'CentOS', - :interfaces => 'lo,eth0', - } + shared_examples 'debian-host' do |os, codename| + let(:facts) {{ + :operatingsystem => os, + :osfamily => 'Debian', + :lsbdistcodename => codename, + :concat_basedir => '/var/lib/puppet/concat', + }} + it { should contain_package('munin') } + it { should contain_file('/etc/munin/munin.conf') } end - it 'should compile' do - should include_class('munin::host') - end +# context 'on debian-like system' do +# it_behaves_like 'debian-host', 'Debian', 'squeeze' +# it_behaves_like 'debian', 'Debian', 'wheezy' +# it_behaves_like 'debian', 'Ubuntu', 'precise' +# end + end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index cffe80c..7269ae5 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,9 +1,13 @@ require 'puppetlabs_spec_helper/module_spec_helper' +require 'rspec-puppet' + fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures')) RSpec.configure do |c| c.module_path = File.join(fixture_path, 'modules') c.manifest_dir = File.join(fixture_path, 'manifests') - c.mock_with :mocha end + +Puppet::Util::Log.level = :warning +Puppet::Util::Log.newdestination(:console) -- cgit v1.2.3 From 1bc94a452f234321c903110f1b5999cdb928a6d9 Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Sun, 13 Oct 2013 18:21:07 +0200 Subject: travis integration --- .travis.yml | 2 +- script/bootstrap | 3 +++ script/cibuild | 9 +++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100755 script/bootstrap create mode 100755 script/cibuild diff --git a/.travis.yml b/.travis.yml index 330677c..41039c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ rvm: - 1.8.7 - 1.9.3 - 2.0.0 -script: 'rake spec' +script: './script/cibuild' env: - PUPPET_VERSION=2.6.0 - PUPPET_VERSION=2.7.0 diff --git a/script/bootstrap b/script/bootstrap new file mode 100755 index 0000000..0695797 --- /dev/null +++ b/script/bootstrap @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +bundle install --path vendor/gems --local diff --git a/script/cibuild b/script/cibuild new file mode 100755 index 0000000..d1c8c06 --- /dev/null +++ b/script/cibuild @@ -0,0 +1,9 @@ +#!/usr/bin/env sh + +set -e + +[ -z "${PUPPET_VERSION}" ] && script/bootstrap + +bundle exec rspec + +bundle exec puppet-lint --with-filename --fail-on-warnings manifests -- cgit v1.2.3 From b4453fb9b9619cf930d26d58d77ef3229ff16313 Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Sun, 13 Oct 2013 18:28:26 +0200 Subject: added fixtures file --- .fixtures.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .fixtures.yml diff --git a/.fixtures.yml b/.fixtures.yml new file mode 100644 index 0000000..42dee4e --- /dev/null +++ b/.fixtures.yml @@ -0,0 +1,8 @@ +fixtures: + repositories: + concat: "https://github.com/puppetlabs/puppetlabs-concat" + stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib" + + symlinks: + munin: "#{source_dir}" + -- cgit v1.2.3 From ee44760c3633c35eba23261e5ed5594b512f0d65 Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Sun, 13 Oct 2013 18:35:30 +0200 Subject: removed fixtures file, librarian is much better --- .fixtures.yml | 8 -------- .travis.yml | 2 +- script/bootstrap | 3 --- script/cibuild | 9 --------- 4 files changed, 1 insertion(+), 21 deletions(-) delete mode 100644 .fixtures.yml delete mode 100755 script/bootstrap delete mode 100755 script/cibuild diff --git a/.fixtures.yml b/.fixtures.yml deleted file mode 100644 index 42dee4e..0000000 --- a/.fixtures.yml +++ /dev/null @@ -1,8 +0,0 @@ -fixtures: - repositories: - concat: "https://github.com/puppetlabs/puppetlabs-concat" - stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib" - - symlinks: - munin: "#{source_dir}" - diff --git a/.travis.yml b/.travis.yml index 41039c1..330677c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ rvm: - 1.8.7 - 1.9.3 - 2.0.0 -script: './script/cibuild' +script: 'rake spec' env: - PUPPET_VERSION=2.6.0 - PUPPET_VERSION=2.7.0 diff --git a/script/bootstrap b/script/bootstrap deleted file mode 100755 index 0695797..0000000 --- a/script/bootstrap +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env sh - -bundle install --path vendor/gems --local diff --git a/script/cibuild b/script/cibuild deleted file mode 100755 index d1c8c06..0000000 --- a/script/cibuild +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env sh - -set -e - -[ -z "${PUPPET_VERSION}" ] && script/bootstrap - -bundle exec rspec - -bundle exec puppet-lint --with-filename --fail-on-warnings manifests -- cgit v1.2.3 From c5f36700d044fbdf61b17e105bddd2147ff22f29 Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Sun, 13 Oct 2013 18:42:41 +0200 Subject: debugging travis and librarian --- Rakefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index c0bab20..6b92f24 100644 --- a/Rakefile +++ b/Rakefile @@ -13,7 +13,9 @@ PuppetLint.configuration.send("disable_80chars") # use librarian-puppet to manage fixtures instead of .fixtures.yml # offers more possibilities like explicit version management, forge downloads,... task :librarian_spec_prep do - sh "librarian-puppet install --path=spec/fixtures/modules/" + sh "librarian-puppet install --path=spec/fixtures/modules/" + sh 'ls -laF spec/fixtures/modules' + sh 'ls -laF spec/fixtures/modules/munin/manifests' end task :spec_prep => :librarian_spec_prep -- cgit v1.2.3 From dcea01c89c802c4055e2e99a4ed17576a4c5581b Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Sun, 13 Oct 2013 19:00:48 +0200 Subject: linking current directory to fixtures --- Rakefile | 5 ++++- spec/spec_helper.rb | 2 -- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index 6b92f24..3bc7abd 100644 --- a/Rakefile +++ b/Rakefile @@ -14,8 +14,11 @@ PuppetLint.configuration.send("disable_80chars") # offers more possibilities like explicit version management, forge downloads,... task :librarian_spec_prep do sh "librarian-puppet install --path=spec/fixtures/modules/" + pwd = `pwd`.strip + unless File.directory?("#{pwd}/spec/fixtures/modules/munin") + sh "ln -s #{pwd} #{pwd}/spec/fixtures/modules/munin" + end sh 'ls -laF spec/fixtures/modules' - sh 'ls -laF spec/fixtures/modules/munin/manifests' end task :spec_prep => :librarian_spec_prep diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 7269ae5..70ab1fb 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,5 @@ require 'puppetlabs_spec_helper/module_spec_helper' -require 'rspec-puppet' - fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures')) RSpec.configure do |c| -- cgit v1.2.3 From 26224742940b06335bca3cb8f5e09d0c0a5cabef Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Sun, 13 Oct 2013 20:24:20 +0200 Subject: Class[] -> Class[] requirement replaced by an anchor --- Rakefile | 1 - manifests/client.pp | 38 ++++++++++++++++++++++++++++++++------ manifests/plugins/setup.pp | 5 ++--- 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/Rakefile b/Rakefile index 3bc7abd..e9e821a 100644 --- a/Rakefile +++ b/Rakefile @@ -18,7 +18,6 @@ task :librarian_spec_prep do unless File.directory?("#{pwd}/spec/fixtures/modules/munin") sh "ln -s #{pwd} #{pwd}/spec/fixtures/modules/munin" end - sh 'ls -laF spec/fixtures/modules' end task :spec_prep => :librarian_spec_prep diff --git a/manifests/client.pp b/manifests/client.pp index 4d70cac..c33ec0d 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -12,13 +12,39 @@ class munin::client( $shorewall_collector_source = 'net', $export_tag = 'munin' ) { + anchor { 'munin::client::installed': } + case $::operatingsystem { - openbsd: { include munin::client::openbsd } - darwin: { include munin::client::darwin } - debian,ubuntu: { include munin::client::debian } - gentoo: { include munin::client::gentoo } - centos: { include munin::client::package } - default: { include munin::client::base } + openbsd: { + class { 'munin::client::openbsd': + before => Anchor['munin::client::installed'] + } + } + darwin: { + class { 'munin::client::darwin': + before => Anchor['munin::client::installed'] + } + } + debian,ubuntu: { + class { 'munin::client::debian': + before => Anchor['munin::client::installed'] + } + } + gentoo: { + class { 'munin::client::gentoo': + before => Anchor['munin::client::installed'] + } + } + centos: { + class { 'munin::client::package': + before => Anchor['munin::client::installed'] + } + } + default: { + class { 'munin::client::base': + before => Anchor['munin::client::installed'] + } + } } if $munin::client::manage_shorewall { class{'shorewall::rules::munin': diff --git a/manifests/plugins/setup.pp b/manifests/plugins/setup.pp index e0826f0..e1a57d9 100644 --- a/manifests/plugins/setup.pp +++ b/manifests/plugins/setup.pp @@ -1,12 +1,10 @@ # Set up the munin plugins for a node class munin::plugins::setup { - # This is required for the munin-node service and package requirements below. - Class['munin::client'] -> Class['munin::plugins::setup'] - file { [ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]: ensure => directory, + require => Anchor['munin::client::installed'], ignore => 'snmp_*', checksum => mtime, recurse => true, @@ -18,6 +16,7 @@ class munin::plugins::setup { mode => '0755'; '/etc/munin/plugin-conf.d/munin-node': ensure => present, + require => Anchor['munin::client::installed'], notify => Service['munin-node'], owner => root, group => 0, -- cgit v1.2.3 From 7be20b4d90918dce2404d5957fc6a2b77e082caf Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Sun, 13 Oct 2013 20:30:33 +0200 Subject: munin host specs --- spec/classes/munin_client_spec.rb | 1 - spec/classes/munin_host_spec.rb | 26 +++++++++++++++++++++----- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/spec/classes/munin_client_spec.rb b/spec/classes/munin_client_spec.rb index ebf8d73..9a92cef 100644 --- a/spec/classes/munin_client_spec.rb +++ b/spec/classes/munin_client_spec.rb @@ -18,7 +18,6 @@ describe 'munin::client' do :operatingsystem => os, :osfamily => 'RedHat', :lsbdistcodename => codename, - :interfaces => 'lo,eth0', }} it { should contain_package('munin-node') } it { should contain_file('/etc/munin/munin-node.conf') } diff --git a/spec/classes/munin_host_spec.rb b/spec/classes/munin_host_spec.rb index ccfcee6..461ced5 100644 --- a/spec/classes/munin_host_spec.rb +++ b/spec/classes/munin_host_spec.rb @@ -10,12 +10,28 @@ describe 'munin::host' do }} it { should contain_package('munin') } it { should contain_file('/etc/munin/munin.conf') } + it { should include_class('munin::host') } end -# context 'on debian-like system' do -# it_behaves_like 'debian-host', 'Debian', 'squeeze' -# it_behaves_like 'debian', 'Debian', 'wheezy' -# it_behaves_like 'debian', 'Ubuntu', 'precise' -# end + shared_examples 'redhat-host' do |os, codename| + let(:facts) {{ + :operatingsystem => os, + :osfamily => 'RedHat', + :lsbdistcodename => codename, + :concat_basedir => '/var/lib/puppet/concat', + }} + it { should contain_package('munin') } + it { should contain_file('/etc/munin/munin.conf') } + it { should include_class('munin::host') } + end + context 'on debian-like system' do + it_behaves_like 'debian-host', 'Debian', 'squeeze' + it_behaves_like 'debian-host', 'Debian', 'wheezy' + it_behaves_like 'debian-host', 'Ubuntu', 'precise' + end + + context 'on redhat-like system' do + it_behaves_like 'redhat-host', 'CentOS', '6' + end end -- cgit v1.2.3 From 949474630dd6daf44a1da3820fa67c99a387e2b4 Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Sun, 13 Oct 2013 20:32:54 +0200 Subject: disabled testing of puppet 2.6 --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 330677c..bd4225e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,9 @@ rvm: - 2.0.0 script: 'rake spec' env: - - PUPPET_VERSION=2.6.0 - PUPPET_VERSION=2.7.0 + - PUPPET_VERSION=3.0.0 + - PUPPET_VERSION=3.1.0 - PUPPET_VERSION=3.2.0 matrix: exclude: -- cgit v1.2.3 From b38f8b003efd9babe298029309c7ace0cc0a7e7c Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Sun, 13 Oct 2013 20:40:55 +0200 Subject: disabled building on ruby 2.0 before puppet 3.2 --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index bd4225e..e27b2f5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,9 @@ matrix: - rvm: 1.9.3 env: PUPPET_VERSION=2.6.0 # No support for Ruby 2.0 before Puppet 3.2 - - rvm: 2.0.0 - env: PUPPET_VERSION=2.6.0 - rvm: 2.0.0 env: PUPPET_VERSION=2.7.0 + - rvm: 2.0.0 + env: PUPPET_VERSION=3.0.0 + - rvm: 2.0.0 + env: PUPPET_VERSION=3.1.0 -- cgit v1.2.3 From 8a1540cedc4d5726bb9511d9fa291b56414746ca Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Mon, 14 Oct 2013 11:23:32 +0200 Subject: enable travis-ci integration --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 420277e..9c5474f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Puppet-Munin +[![Build Status](https://travis-ci.org/duritong/puppet-munin.png?branch=master)](https://travis-ci.org/duritong/puppet-munin) + Munin is a performance monitoring system which creates nice RRD graphs and has a very easy plugin interface. The munin homepage is http://munin.projects.linpro.no/ -- cgit v1.2.3 From 31b6f9e487090b9d1dd944a3bd5c78de6bc141f6 Mon Sep 17 00:00:00 2001 From: duritong Date: Wed, 23 Oct 2013 18:40:06 +0200 Subject: minor cleanup --- .rspec | 1 - 1 file changed, 1 deletion(-) diff --git a/.rspec b/.rspec index e0b06e8..8c18f1a 100644 --- a/.rspec +++ b/.rspec @@ -1,3 +1,2 @@ --format documentation --color -#--backtrace -- cgit v1.2.3 From 6856c8bb3f11073a47ab705d0e2012a0c90acae3 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 3 Nov 2013 17:18:40 +0100 Subject: some doc --- manifests/client.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/client.pp b/manifests/client.pp index c33ec0d..f91436f 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -1,8 +1,8 @@ -# client.pp - configure a munin node # Copyright (C) 2007 David Schmitt # See LICENSE for the full license granted to you. # Adapted and improved by admin(at)immerda.ch +# configure a munin node class munin::client( $allow = [ '127.0.0.1' ], $host = '*', -- cgit v1.2.3 From d2a2cb77b9a9ca5deddecdec3d14ac763388929e Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 3 Nov 2013 17:46:46 +0100 Subject: cleanup openbsd manual installation + remove unnecessary files The manual OpenBSD installation is now so old and not needed anymore. --- files/openbsd/package/munin_openbsd.tar.gz | Bin 116174 -> 0 bytes manifests/client.pp | 2 +- manifests/client/base.pp | 15 ++++++++--- manifests/client/centos.pp | 4 --- manifests/client/debian.pp | 13 +++++++--- manifests/client/gentoo.pp | 2 +- manifests/client/openbsd.pp | 40 +++-------------------------- manifests/client/package.pp | 13 ---------- manifests/plugins/centos.pp | 6 ----- 9 files changed, 26 insertions(+), 69 deletions(-) delete mode 100644 files/openbsd/package/munin_openbsd.tar.gz delete mode 100644 manifests/client/centos.pp delete mode 100644 manifests/client/package.pp delete mode 100644 manifests/plugins/centos.pp diff --git a/files/openbsd/package/munin_openbsd.tar.gz b/files/openbsd/package/munin_openbsd.tar.gz deleted file mode 100644 index 17ace1d..0000000 Binary files a/files/openbsd/package/munin_openbsd.tar.gz and /dev/null differ diff --git a/manifests/client.pp b/manifests/client.pp index f91436f..b7cd5d4 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -36,7 +36,7 @@ class munin::client( } } centos: { - class { 'munin::client::package': + class { 'munin::client::base': before => Anchor['munin::client::installed'] } } diff --git a/manifests/client/base.pp b/manifests/client/base.pp index 3c0ba89..e81028d 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -1,10 +1,14 @@ # Install a basic munin client class munin::client::base { + package { 'munin-node': + ensure => installed + } service { 'munin-node': - ensure => running, - enable => true, - hasstatus => true, - hasrestart => true, + ensure => running, + enable => true, + hasstatus => true, + hasrestart => true, + require => Package[munin-node], } file {'/etc/munin': ensure => directory, @@ -14,6 +18,9 @@ class munin::client::base { } 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, diff --git a/manifests/client/centos.pp b/manifests/client/centos.pp deleted file mode 100644 index cd4f2f6..0000000 --- a/manifests/client/centos.pp +++ /dev/null @@ -1,4 +0,0 @@ -# Install a munin client on centos -class munin::client::centos inherits munin::client::package { - include munin::plugins::centos -} diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp index 3cfc3fc..f94356a 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -1,11 +1,18 @@ # Install the munin client on debian -class munin::client::debian inherits munin::client::package { +class munin::client::debian inherits munin::client::base { # the plugin will need that - package { 'iproute': ensure => installed } + package { 'iproute': + ensure => installed + } + + $hasstatus = $::lsbdistcodename ? { + sarge => false, + default => true + } Service['munin-node']{ # sarge's munin-node init script has no status - hasstatus => $::lsbdistcodename ? { sarge => false, default => true } + hasstatus => $hasstatus } File['/etc/munin/munin-node.conf']{ content => template("munin/munin-node.conf.${::operatingsystem}.${::lsbdistcodename}"), diff --git a/manifests/client/gentoo.pp b/manifests/client/gentoo.pp index 186950b..fde592f 100644 --- a/manifests/client/gentoo.pp +++ b/manifests/client/gentoo.pp @@ -1,5 +1,5 @@ # install a munin client on gentoo -class munin::client::gentoo inherits munin::client::package { +class munin::client::gentoo inherits munin::client::base { Package['munin-node'] { name => 'munin', diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp index e3c18d5..5ced4c4 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -1,53 +1,19 @@ -# 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' ]: 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, diff --git a/manifests/client/package.pp b/manifests/client/package.pp deleted file mode 100644 index 0958202..0000000 --- a/manifests/client/package.pp +++ /dev/null @@ -1,13 +0,0 @@ -# Install a munin client using packages -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/plugins/centos.pp b/manifests/plugins/centos.pp deleted file mode 100644 index 0bb7697..0000000 --- a/manifests/plugins/centos.pp +++ /dev/null @@ -1,6 +0,0 @@ -# Install munin plugins for centos -class munin::plugins::centos inherits munin::plugins::base { - munin::plugin { 'users': - ensure => present, - } -} -- cgit v1.2.3 From 03c50709169ee38cd5d759c461389b2a476fcc64 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 3 Nov 2013 17:52:36 +0100 Subject: use rather the stdlib prefix function than the good old regsubst hack --- manifests/plugins/interfaces.pp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp index b92802b..b795bc0 100644 --- a/manifests/plugins/interfaces.pp +++ b/manifests/plugins/interfaces.pp @@ -1,15 +1,16 @@ # handle if_ and if_err_ plugins class munin::plugins::interfaces { + # filter out many of the useless interfaces that show up + $real_ifs = reject(split($::interfaces, ' |,'), 'eth\d+_\d+|sit0|virbr\d+_nic|vif\d+_\d+|veth\d+|__tmp\d+') + + $ifs = prefix($real_ifs, 'if_') + $if_err_plugin = $::operatingsystem ? { 'openbsd' => 'if_errcoll_', default => 'if_err_', } - - # filter out many of the useless interfaces that show up - $real_ifs = reject(split($::interfaces, ' |,'), 'eth\d+_\d+|sit0|virbr\d+_nic|vif\d+_\d+|veth\d+|__tmp\d+') - $ifs = regsubst($real_ifs, '(.+)', 'if_\1') - $if_errs = regsubst($real_ifs, '(.+)', "${if_err_plugin}\1") + $if_errs = prefix($real_ifs, $if_err_plugin) munin::plugin { $ifs: ensure => 'if_', -- cgit v1.2.3 From ad37140f6123c0e85cfbeb23dee5b3ea3c324701 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 3 Nov 2013 17:55:54 +0100 Subject: remove anchor dependency - fixed #26 given that all os are using package installation now, we can replace the anchor with the package dependency. It also caused a dependency cycle as the anchor was for the whole class and not only the package installation. --- manifests/client.pp | 37 ++++++------------------------------- manifests/plugins/setup.pp | 4 ++-- 2 files changed, 8 insertions(+), 33 deletions(-) diff --git a/manifests/client.pp b/manifests/client.pp index b7cd5d4..2d4c82b 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -12,39 +12,14 @@ class munin::client( $shorewall_collector_source = 'net', $export_tag = 'munin' ) { - anchor { 'munin::client::installed': } case $::operatingsystem { - openbsd: { - class { 'munin::client::openbsd': - before => Anchor['munin::client::installed'] - } - } - darwin: { - class { 'munin::client::darwin': - before => Anchor['munin::client::installed'] - } - } - debian,ubuntu: { - class { 'munin::client::debian': - before => Anchor['munin::client::installed'] - } - } - gentoo: { - class { 'munin::client::gentoo': - before => Anchor['munin::client::installed'] - } - } - centos: { - class { 'munin::client::base': - before => Anchor['munin::client::installed'] - } - } - default: { - class { 'munin::client::base': - before => Anchor['munin::client::installed'] - } - } + openbsd: { include munin::client::openbsd } + darwin: { include munin::client::darwin } + debian,ubuntu: { include munin::client::debian } + gentoo: { include munin::client::gentoo } + centos: { include munin::client::base } + default: { include munin::client::base } } if $munin::client::manage_shorewall { class{'shorewall::rules::munin': diff --git a/manifests/plugins/setup.pp b/manifests/plugins/setup.pp index e1a57d9..23222ec 100644 --- a/manifests/plugins/setup.pp +++ b/manifests/plugins/setup.pp @@ -4,7 +4,7 @@ class munin::plugins::setup { file { [ '/etc/munin/plugins', '/etc/munin/plugin-conf.d' ]: ensure => directory, - require => Anchor['munin::client::installed'], + require => Package['munin-node'], ignore => 'snmp_*', checksum => mtime, recurse => true, @@ -16,7 +16,7 @@ class munin::plugins::setup { mode => '0755'; '/etc/munin/plugin-conf.d/munin-node': ensure => present, - require => Anchor['munin::client::installed'], + require => Package['munin-node'], notify => Service['munin-node'], owner => root, group => 0, -- cgit v1.2.3 From 3064a5d5a6251f84cf4d115be1711266faf7ed13 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 3 Nov 2013 18:21:57 +0100 Subject: fix #26 - do not manage files of a plugin if it should be absent The directories are recursively managed and will purge these files anyway and trigger a proper restart. Like that we can safe a few resources in our catalog. --- manifests/plugin.pp | 74 ++++++++++++++++----------------------- manifests/plugin/scriptpaths.pp | 5 +-- spec/defines/munin_plugin_spec.rb | 40 +++++++++++++++++++++ 3 files changed, 72 insertions(+), 47 deletions(-) create mode 100644 spec/defines/munin_plugin_spec.rb diff --git a/manifests/plugin.pp b/manifests/plugin.pp index 60af877..ef82f90 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -1,55 +1,43 @@ # configure a specific munin plugin +# +# We only manage the plugin if it is not set to absent. +# A plugin (or its config) that should be removed should +# be purged by the recursively managed plugins- or +# config-directory. So we can safe a few resources being +# managed. define munin::plugin ( $ensure = 'present', $script_path_in = '', - $config = '' + $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" + if $ensure != 'absent' { + include munin::plugin::scriptpaths + include munin::plugins::setup + $real_script_path = $script_path_in ? { + '' => $munin::plugin::scriptpaths::script_path, + default => $script_path_in + } + $plugin_src = $ensure ? { + 'present' => $name, + default => $ensure + } - include munin::plugins::setup - case $ensure { - 'absent': { - file { $plugin: ensure => absent, } + file { "/etc/munin/plugins/${name}": + ensure => link, + target =>"${real_script_path}/${plugin_src}", + notify => Service['munin-node']; } - default: { - $dep = $::kernel ? { - OpenBSD => File['/var/run/munin'], - default => Package['munin-node'] - } - file { $plugin: - ensure => "${real_script_path}/${plugin_src}", - require => $dep, - notify => Service['munin-node']; + if (str2bool($::selinux) == true) and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ + File["/etc/munin/plugins/${name}"]{ + seltype => 'munin_etc_t', } - if (str2bool($::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", - owner => root, - group => 0, - mode => '0640', - } - } + if $config != '' { + file { "/etc/munin/plugin-conf.d/${name}.conf": + content => "[${name}]\n${config}\n", + owner => root, + group => 0, + mode => '0640', } } } diff --git a/manifests/plugin/scriptpaths.pp b/manifests/plugin/scriptpaths.pp index f31f38d..62dd77b 100644 --- a/manifests/plugin/scriptpaths.pp +++ b/manifests/plugin/scriptpaths.pp @@ -4,10 +4,7 @@ class munin::plugin::scriptpaths { gentoo: { $script_path = '/usr/libexec/munin/plugins' } debian: { $script_path = '/usr/share/munin/plugins' } centos: { $script_path = '/usr/share/munin/plugins' } - openbsd: { $script_path = $::operatingsystemrelease ? { - '4.3' => '/opt/munin/lib/plugins/', - default => '/usr/local/libexec/munin/plugins/', - } } + openbsd: { $script_path = '/usr/local/libexec/munin/plugins/' } default: { $script_path = '/usr/share/munin/plugins' } } } diff --git a/spec/defines/munin_plugin_spec.rb b/spec/defines/munin_plugin_spec.rb new file mode 100644 index 0000000..3d7e9e3 --- /dev/null +++ b/spec/defines/munin_plugin_spec.rb @@ -0,0 +1,40 @@ +require 'spec_helper' + +describe 'munin::plugin' do + let(:title) { 'users' } + let(:facts) do + { :operatingsystem => 'CentOS' } + end + context 'present' do + it { should contain_file('/etc/munin/plugins/users').with( + :ensure => 'link', + :target => '/usr/share/munin/plugins/users' + ) } + it { should_not contain_file('/etc/munin/plugin-conf.d/users.conf') } + end + + context 'present and config' do + let(:params) do + { :config => 'env.user root' } + end + it { should contain_file('/etc/munin/plugins/users').with( + :ensure => 'link', + :target => '/usr/share/munin/plugins/users', + :notify => 'Service[munin-node]' + ) } + it { should contain_file('/etc/munin/plugin-conf.d/users.conf').with( + :content => "[users]\nenv.user root\n", + :owner => 'root', + :group => 0, + :mode => '0640' + ) } + end + + context 'absent' do + let(:params) do + { :ensure => 'absent' } + end + it { should_not contain_file('/etc/munin/plugins/users') } + it { should_not contain_file('/etc/munin/plugin-conf.d/users.conf') } + end +end -- cgit v1.2.3 From d92912ba27c1234e6f6072a3b922beabbd28dd98 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 3 Nov 2013 18:28:30 +0100 Subject: remove unnecessary dependencies --- manifests/plugins/setup.pp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/manifests/plugins/setup.pp b/manifests/plugins/setup.pp index 23222ec..a3f3b22 100644 --- a/manifests/plugins/setup.pp +++ b/manifests/plugins/setup.pp @@ -16,22 +16,9 @@ class munin::plugins::setup { mode => '0755'; '/etc/munin/plugin-conf.d/munin-node': ensure => present, - require => Package['munin-node'], notify => Service['munin-node'], owner => root, group => 0, mode => '0640'; } - 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'], - } - } - } } -- cgit v1.2.3 From a161f0cd19a4e099bc8bb4bb3e01898c9c5f2ee7 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 3 Nov 2013 18:43:23 +0100 Subject: add a few more intelligent plugins for linux hosts --- manifests/plugins/linux.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manifests/plugins/linux.pp b/manifests/plugins/linux.pp index 57f2bba..354d23c 100644 --- a/manifests/plugins/linux.pp +++ b/manifests/plugins/linux.pp @@ -1,7 +1,8 @@ # Set up plugins for a linux host class munin::plugins::linux { munin::plugin { - [ 'df_abs', 'forks', 'df_inode', 'irqstats', 'entropy', 'open_inodes' ]: + [ 'df_abs', 'forks', 'df_inode', 'irqstats', 'entropy', 'open_inodes', + 'diskstats', 'proc_pri', 'threads', ]: ensure => present; 'acpi': ensure => $::acpi_available; -- cgit v1.2.3 From 161e5cb4722ec22dff7f367fcf5460364e598497 Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Mon, 18 Nov 2013 22:27:46 +0100 Subject: use rather ensure_packages --- manifests/client/debian.pp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp index f94356a..63a0e14 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -1,9 +1,7 @@ # 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']) $hasstatus = $::lsbdistcodename ? { sarge => false, -- cgit v1.2.3 From db5a0032698b55f2a4403d55312e81ea2d127ea6 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Wed, 20 Nov 2013 14:14:11 +0100 Subject: Add CloudLinux support --- templates/munin-node.conf.CloudLinux | 1 + 1 file changed, 1 insertion(+) create mode 120000 templates/munin-node.conf.CloudLinux diff --git a/templates/munin-node.conf.CloudLinux b/templates/munin-node.conf.CloudLinux new file mode 120000 index 0000000..082b30c --- /dev/null +++ b/templates/munin-node.conf.CloudLinux @@ -0,0 +1 @@ +munin-node.conf.default \ No newline at end of file -- cgit v1.2.3 From 057658ba93e2562c596dfa5607836679631be916 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Tue, 2 Jul 2013 22:49:02 +0200 Subject: Unify OS specific munin-conf.conf In essence all munin-node.conf files contained the same template, besides a few values. By moving all to a single template, maintenance burden is reduced. To ensure all values are still present in the templates, tests are added. --- manifests/client/base.pp | 4 +- manifests/client/debian.pp | 3 -- manifests/client/params.pp | 19 +++++++ spec/classes/munin_client_base_spec.rb | 86 ++++++++++++++++++++++++++++++++ templates/munin-node.conf.CentOS | 1 - templates/munin-node.conf.CentOS. | 1 - templates/munin-node.conf.CentOS.5 | 1 - templates/munin-node.conf.Debian | 1 - templates/munin-node.conf.Debian.etch | 39 --------------- templates/munin-node.conf.Debian.feisty | 1 - templates/munin-node.conf.Debian.gutsy | 1 - templates/munin-node.conf.Debian.hardy | 1 - templates/munin-node.conf.Debian.lenny | 39 --------------- templates/munin-node.conf.Debian.lucid | 1 - templates/munin-node.conf.Debian.sarge | 1 - templates/munin-node.conf.Debian.sid | 1 - templates/munin-node.conf.Debian.squeeze | 1 - templates/munin-node.conf.Debian.wheezy | 57 --------------------- templates/munin-node.conf.Gentoo | 1 - templates/munin-node.conf.Gentoo. | 1 - templates/munin-node.conf.OpenBSD | 59 ---------------------- templates/munin-node.conf.Ubuntu | 39 --------------- templates/munin-node.conf.Ubuntu.precise | 1 - templates/munin-node.conf.Ubuntu.quantal | 1 - templates/munin-node.conf.default | 69 ------------------------- templates/munin-node.conf.erb | 62 +++++++++++++++++++++++ templates/site.conf | 9 ---- 27 files changed, 169 insertions(+), 331 deletions(-) create mode 100644 manifests/client/params.pp create mode 100644 spec/classes/munin_client_base_spec.rb delete mode 120000 templates/munin-node.conf.CentOS delete mode 120000 templates/munin-node.conf.CentOS. delete mode 120000 templates/munin-node.conf.CentOS.5 delete mode 120000 templates/munin-node.conf.Debian delete mode 100644 templates/munin-node.conf.Debian.etch delete mode 120000 templates/munin-node.conf.Debian.feisty delete mode 120000 templates/munin-node.conf.Debian.gutsy delete mode 120000 templates/munin-node.conf.Debian.hardy delete mode 100644 templates/munin-node.conf.Debian.lenny delete mode 120000 templates/munin-node.conf.Debian.lucid delete mode 120000 templates/munin-node.conf.Debian.sarge delete mode 120000 templates/munin-node.conf.Debian.sid delete mode 120000 templates/munin-node.conf.Debian.squeeze delete mode 100644 templates/munin-node.conf.Debian.wheezy delete mode 120000 templates/munin-node.conf.Gentoo delete mode 120000 templates/munin-node.conf.Gentoo. delete mode 100644 templates/munin-node.conf.OpenBSD delete mode 100644 templates/munin-node.conf.Ubuntu delete mode 120000 templates/munin-node.conf.Ubuntu.precise delete mode 120000 templates/munin-node.conf.Ubuntu.quantal delete mode 100644 templates/munin-node.conf.default create mode 100644 templates/munin-node.conf.erb delete mode 100644 templates/site.conf diff --git a/manifests/client/base.pp b/manifests/client/base.pp index e81028d..71531fa 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -1,5 +1,5 @@ # Install a basic munin client -class munin::client::base { +class munin::client::base inherits munin::client::params { package { 'munin-node': ensure => installed } @@ -17,7 +17,7 @@ class munin::client::base { group => 0, } file {'/etc/munin/munin-node.conf': - content => template("munin/munin-node.conf.${::operatingsystem}"), + 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'], diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp index 63a0e14..f1bbb3c 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -12,9 +12,6 @@ class munin::client::debian inherits munin::client::base { # sarge's munin-node init script has no status hasstatus => $hasstatus } - 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 } include munin::plugins::debian diff --git a/manifests/client/params.pp b/manifests/client/params.pp new file mode 100644 index 0000000..14d3749 --- /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 $::operatingsystem { + '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' + } + } +} diff --git a/spec/classes/munin_client_base_spec.rb b/spec/classes/munin_client_base_spec.rb new file mode 100644 index 0000000..1b3d936 --- /dev/null +++ b/spec/classes/munin_client_base_spec.rb @@ -0,0 +1,86 @@ +require 'spec_helper' + +describe 'munin::client::base' do + let :default_facts do + { + :fqdn => 'munin-node.example.org', + } + end + + let :pre_condition do + 'include munin::client' + end + + context 'on Debian' do + let :facts do + { :operatingsystem => 'Debian' }.merge(default_facts) + end + + it 'should compile' do + should include_class('munin::client::base') + end + + it 'should set up munin-node' do + should contain_service('munin-node').with({ + :ensure => 'running', + :enable => true, + :hasstatus => true, + :hasrestart => true, + }) + + should contain_file('/etc/munin').with({ + :ensure => 'directory', + :mode => '0755', + :owner => 'root', + :group => 0, + }) + + should contain_file('/etc/munin/munin-node.conf'). + with_content(/^host_name munin-node.example.org$/). + with_content(/^allow \^127\\\.0\\\.0\\\.1\$$/). + with_content(/^host \*$/). + with_content(/^port 4949$/) + + should contain_munin__register('munin-node.example.org').with({ + :host => 'munin-node.example.org', + :port => '4949', + :use_ssh => false, + :config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'], + :export_tag => 'munin', + }) + + should contain_class('munin::plugins::base') + end + + it 'should contain the Debian specific values' do + should contain_file('/etc/munin/munin-node.conf'). + with_content(/^log_file \/var\/log\/munin\/munin-node.log$/). + with_content(/^group root$/) + end + end + + context 'on CentOS' do + let :facts do + { :operatingsystem => 'CentOS' }.merge(default_facts) + end + + it 'should contain the CentOS specific values' do + should contain_file('/etc/munin/munin-node.conf'). + with_content(/^log_file \/var\/log\/munin-node\/munin-node.log$/). + with_content(/^group root$/) + end + end + + # Disabled because the required openbsd module is not in the requirements + context 'on OpenBSD', :if => false do + let :facts do + { :operatingsystem => 'OpenBSD' }.merge(default_facts) + end + + it 'should contain the config OpenBSD specific values' do + should contain_file('/etc/munin/munin-node.conf'). + with_content(/^log_file \/var\/log\/munin-node\/munin-node.log$/). + with_content(/^group 0$/) + end + end +end diff --git a/templates/munin-node.conf.CentOS b/templates/munin-node.conf.CentOS deleted file mode 120000 index 082b30c..0000000 --- a/templates/munin-node.conf.CentOS +++ /dev/null @@ -1 +0,0 @@ -munin-node.conf.default \ No newline at end of file diff --git a/templates/munin-node.conf.CentOS. b/templates/munin-node.conf.CentOS. deleted file mode 120000 index 082b30c..0000000 --- a/templates/munin-node.conf.CentOS. +++ /dev/null @@ -1 +0,0 @@ -munin-node.conf.default \ No newline at end of file diff --git a/templates/munin-node.conf.CentOS.5 b/templates/munin-node.conf.CentOS.5 deleted file mode 120000 index 082b30c..0000000 --- a/templates/munin-node.conf.CentOS.5 +++ /dev/null @@ -1 +0,0 @@ -munin-node.conf.default \ No newline at end of file diff --git a/templates/munin-node.conf.Debian b/templates/munin-node.conf.Debian deleted file mode 120000 index e0646b9..0000000 --- a/templates/munin-node.conf.Debian +++ /dev/null @@ -1 +0,0 @@ -munin-node.conf.Debian.etch \ No newline at end of file diff --git a/templates/munin-node.conf.Debian.etch b/templates/munin-node.conf.Debian.etch deleted file mode 100644 index 9763772..0000000 --- a/templates/munin-node.conf.Debian.etch +++ /dev/null @@ -1,39 +0,0 @@ -########## -########## Managed by puppet -########## - -log_level 4 -log_file /var/log/munin/munin-node.log -pid_file /var/run/munin/munin-node.pid -background 1 -setseid 1 - -# Which host/port to bind to; -host <%= scope.lookupvar('munin::client::host') %> -port <%= scope.lookupvar('munin::client::port') %> -user root -group root -setsid yes - -# Regexps for files to ignore - -ignore_file ~$ -ignore_file \.bak$ -ignore_file %$ -ignore_file \.dpkg-(tmp|new|old|dist)$ -ignore_file \.rpm(save|new)$ - -# Set this if the client doesn't report the correct hostname when -# telnetting to localhost, port 4949 -# -#host_name localhost.localdomain -host_name <%= scope.lookupvar('::fqdn') %> - -# A list of addresses that are allowed to connect. This must be a -# regular expression, due to brain damage in Net::Server, which -# doesn't understand CIDR-style network notation. You may repeat -# the allow line as many times as you'd like -<% scope.lookupvar('munin::client::allow').each do |allow| -%> -allow <%= "^#{Regexp.escape(allow)}$" %> -<% end -%> - diff --git a/templates/munin-node.conf.Debian.feisty b/templates/munin-node.conf.Debian.feisty deleted file mode 120000 index e0646b9..0000000 --- a/templates/munin-node.conf.Debian.feisty +++ /dev/null @@ -1 +0,0 @@ -munin-node.conf.Debian.etch \ No newline at end of file diff --git a/templates/munin-node.conf.Debian.gutsy b/templates/munin-node.conf.Debian.gutsy deleted file mode 120000 index e0646b9..0000000 --- a/templates/munin-node.conf.Debian.gutsy +++ /dev/null @@ -1 +0,0 @@ -munin-node.conf.Debian.etch \ No newline at end of file diff --git a/templates/munin-node.conf.Debian.hardy b/templates/munin-node.conf.Debian.hardy deleted file mode 120000 index e0646b9..0000000 --- a/templates/munin-node.conf.Debian.hardy +++ /dev/null @@ -1 +0,0 @@ -munin-node.conf.Debian.etch \ No newline at end of file diff --git a/templates/munin-node.conf.Debian.lenny b/templates/munin-node.conf.Debian.lenny deleted file mode 100644 index 9763772..0000000 --- a/templates/munin-node.conf.Debian.lenny +++ /dev/null @@ -1,39 +0,0 @@ -########## -########## Managed by puppet -########## - -log_level 4 -log_file /var/log/munin/munin-node.log -pid_file /var/run/munin/munin-node.pid -background 1 -setseid 1 - -# Which host/port to bind to; -host <%= scope.lookupvar('munin::client::host') %> -port <%= scope.lookupvar('munin::client::port') %> -user root -group root -setsid yes - -# Regexps for files to ignore - -ignore_file ~$ -ignore_file \.bak$ -ignore_file %$ -ignore_file \.dpkg-(tmp|new|old|dist)$ -ignore_file \.rpm(save|new)$ - -# Set this if the client doesn't report the correct hostname when -# telnetting to localhost, port 4949 -# -#host_name localhost.localdomain -host_name <%= scope.lookupvar('::fqdn') %> - -# A list of addresses that are allowed to connect. This must be a -# regular expression, due to brain damage in Net::Server, which -# doesn't understand CIDR-style network notation. You may repeat -# the allow line as many times as you'd like -<% scope.lookupvar('munin::client::allow').each do |allow| -%> -allow <%= "^#{Regexp.escape(allow)}$" %> -<% end -%> - diff --git a/templates/munin-node.conf.Debian.lucid b/templates/munin-node.conf.Debian.lucid deleted file mode 120000 index e0646b9..0000000 --- a/templates/munin-node.conf.Debian.lucid +++ /dev/null @@ -1 +0,0 @@ -munin-node.conf.Debian.etch \ No newline at end of file diff --git a/templates/munin-node.conf.Debian.sarge b/templates/munin-node.conf.Debian.sarge deleted file mode 120000 index e0646b9..0000000 --- a/templates/munin-node.conf.Debian.sarge +++ /dev/null @@ -1 +0,0 @@ -munin-node.conf.Debian.etch \ No newline at end of file diff --git a/templates/munin-node.conf.Debian.sid b/templates/munin-node.conf.Debian.sid deleted file mode 120000 index 6b8d690..0000000 --- a/templates/munin-node.conf.Debian.sid +++ /dev/null @@ -1 +0,0 @@ -munin-node.conf.Debian.lenny \ No newline at end of file diff --git a/templates/munin-node.conf.Debian.squeeze b/templates/munin-node.conf.Debian.squeeze deleted file mode 120000 index 6b8d690..0000000 --- a/templates/munin-node.conf.Debian.squeeze +++ /dev/null @@ -1 +0,0 @@ -munin-node.conf.Debian.lenny \ No newline at end of file diff --git a/templates/munin-node.conf.Debian.wheezy b/templates/munin-node.conf.Debian.wheezy deleted file mode 100644 index fe6f27f..0000000 --- a/templates/munin-node.conf.Debian.wheezy +++ /dev/null @@ -1,57 +0,0 @@ -########## -########## Managed by puppet -########## - -log_level 4 -log_file /var/log/munin/munin-node.log -pid_file /var/run/munin/munin-node.pid - -background 1 -setsid 1 - -user root -group root - -# Regexps for files to ignore - -ignore_file ~$ -#ignore_file [#~]$ # FIX doesn't work. '#' starts a comment -ignore_file DEADJOE$ -ignore_file \.bak$ -ignore_file %$ -ignore_file \.dpkg-(tmp|new|old|dist)$ -ignore_file \.rpm(save|new)$ -ignore_file \.pod$ - -# Set this if the client doesn't report the correct hostname when -# telnetting to localhost, port 4949 -# -#host_name localhost.localdomain -host_name <%= scope.lookupvar('::fqdn') %> - -# A list of addresses that are allowed to connect. This must be a -# regular expression, since Net::Server does not understand CIDR-style -# network notation unless the perl module Net::CIDR is installed. You -# may repeat the allow line as many times as you'd like - -<% scope.lookupvar('munin::client::allow').each do |allow| -%> -allow <%= "^#{Regexp.escape(allow)}$" %> -<% end -%> - -# If you have installed the Net::CIDR perl module, you can use one or more -# cidr_allow and cidr_deny address/mask patterns. A connecting client must -# match any cidr_allow, and not match any cidr_deny. Note that a netmask -# *must* be provided, even if it's /32 -# -# Example: -# -# cidr_allow 127.0.0.1/32 -# cidr_allow 192.0.2.0/24 -# cidr_deny 192.0.2.42/32 - -# Which address to bind to; -host <%= scope.lookupvar('munin::client::host') %> - -# And which port -port <%= scope.lookupvar('munin::client::port') %> - diff --git a/templates/munin-node.conf.Gentoo b/templates/munin-node.conf.Gentoo deleted file mode 120000 index 082b30c..0000000 --- a/templates/munin-node.conf.Gentoo +++ /dev/null @@ -1 +0,0 @@ -munin-node.conf.default \ No newline at end of file diff --git a/templates/munin-node.conf.Gentoo. b/templates/munin-node.conf.Gentoo. deleted file mode 120000 index fd16e50..0000000 --- a/templates/munin-node.conf.Gentoo. +++ /dev/null @@ -1 +0,0 @@ -munin-node.conf.Gentoo \ No newline at end of file diff --git a/templates/munin-node.conf.OpenBSD b/templates/munin-node.conf.OpenBSD deleted file mode 100644 index 14b658e..0000000 --- a/templates/munin-node.conf.OpenBSD +++ /dev/null @@ -1,59 +0,0 @@ -########## -########## Managed by puppet -########## -# -# Example config-file for munin-node -# - -log_level 4 -log_file /var/log/munin/munin-node.log -pid_file /var/run/munin/munin-node.pid - -background 1 -setsid 1 - -user root -group 0 - -# Regexps for files to ignore -ignore_file ~$ -ignore_file DEADJOE$ -ignore_file \.bak$ -ignore_file %$ -ignore_file \.dpkg-(tmp|new|old|dist)$ -ignore_file \.rpm(save|new)$ -ignore_file \.pod$ - -# Set this if the client doesn't report the correct hostname when -# telnetting to localhost, port 4949 -# -#host_name localhost.localdomain -host_name <%= scope.lookupvar('::fqdn') %> - -# A list of addresses that are allowed to connect. This must be a -# regular expression, since Net::Server does not understand CIDR-style -# network notation unless the perl module Net::CIDR is installed. You -# may repeat the allow line as many times as you'd like - -<% scope.lookupvar('munin::client::allow').each do |allow| -%> -allow <%= "^#{Regexp.escape(allow)}$" %> -<% end -%> - -# If you have installed the Net::CIDR perl module, you can use one or more -# cidr_allow and cidr_deny address/mask patterns. A connecting client must -# match any cidr_allow, and not match any cidr_deny. Note that a netmask -# *must* be provided, even if it's /32 -# -# Example: -# -# cidr_allow 127.0.0.1/32 -# cidr_allow 192.0.2.0/24 -# cidr_deny 192.0.2.42/32 - -# Which address to bind to; -host <%= scope.lookupvar('munin::client::host') %> -# host 127.0.0.1 - -# And which port -port <%= scope.lookupvar('munin::client::port') %> - diff --git a/templates/munin-node.conf.Ubuntu b/templates/munin-node.conf.Ubuntu deleted file mode 100644 index 9763772..0000000 --- a/templates/munin-node.conf.Ubuntu +++ /dev/null @@ -1,39 +0,0 @@ -########## -########## Managed by puppet -########## - -log_level 4 -log_file /var/log/munin/munin-node.log -pid_file /var/run/munin/munin-node.pid -background 1 -setseid 1 - -# Which host/port to bind to; -host <%= scope.lookupvar('munin::client::host') %> -port <%= scope.lookupvar('munin::client::port') %> -user root -group root -setsid yes - -# Regexps for files to ignore - -ignore_file ~$ -ignore_file \.bak$ -ignore_file %$ -ignore_file \.dpkg-(tmp|new|old|dist)$ -ignore_file \.rpm(save|new)$ - -# Set this if the client doesn't report the correct hostname when -# telnetting to localhost, port 4949 -# -#host_name localhost.localdomain -host_name <%= scope.lookupvar('::fqdn') %> - -# A list of addresses that are allowed to connect. This must be a -# regular expression, due to brain damage in Net::Server, which -# doesn't understand CIDR-style network notation. You may repeat -# the allow line as many times as you'd like -<% scope.lookupvar('munin::client::allow').each do |allow| -%> -allow <%= "^#{Regexp.escape(allow)}$" %> -<% end -%> - diff --git a/templates/munin-node.conf.Ubuntu.precise b/templates/munin-node.conf.Ubuntu.precise deleted file mode 120000 index d8fcb24..0000000 --- a/templates/munin-node.conf.Ubuntu.precise +++ /dev/null @@ -1 +0,0 @@ -munin-node.conf.Ubuntu \ No newline at end of file diff --git a/templates/munin-node.conf.Ubuntu.quantal b/templates/munin-node.conf.Ubuntu.quantal deleted file mode 120000 index d8fcb24..0000000 --- a/templates/munin-node.conf.Ubuntu.quantal +++ /dev/null @@ -1 +0,0 @@ -munin-node.conf.Ubuntu \ No newline at end of file diff --git a/templates/munin-node.conf.default b/templates/munin-node.conf.default deleted file mode 100644 index dc7c4fc..0000000 --- a/templates/munin-node.conf.default +++ /dev/null @@ -1,69 +0,0 @@ -########## -########## Managed by puppet -########## -# -# Example config-file for munin-node -# - -log_level 4 -log_file /var/log/munin-node/munin-node.log -pid_file /var/run/munin/munin-node.pid - -background 1 -setsid 1 - -user root -group 0 - -# This is the timeout for the whole transaction. -# Units are in sec. Default is 15 min -# -# global_timeout 900 - -# This is the timeout for each plugin. -# Units are in sec. Default is 1 min -# -# timeout 60 - -# Regexps for files to ignore -ignore_file [\#~]$ -ignore_file DEADJOE$ -ignore_file \.bak$ -ignore_file %$ -ignore_file \.dpkg-(tmp|new|old|dist)$ -ignore_file \.rpm(save|new)$ -ignore_file \.pod$ - -# Set this if the client doesn't report the correct hostname when -# telnetting to localhost, port 4949 -# -#host_name localhost.localdomain -host_name <%= @fqdn %> - -# A list of addresses that are allowed to connect. This must be a -# regular expression, since Net::Server does not understand CIDR-style -# network notation unless the perl module Net::CIDR is installed. You -# may repeat the allow line as many times as you'd like - -<% scope.lookupvar('munin::client::allow').each do |allow| -%> -allow <%= "^#{Regexp.escape(allow)}$" %> -<% end -%> - -# If you have installed the Net::CIDR perl module, you can use one or more -# cidr_allow and cidr_deny address/mask patterns. A connecting client must -# match any cidr_allow, and not match any cidr_deny. Note that a netmask -# *must* be provided, even if it's /32 -# -# Example: -# -# cidr_allow 127.0.0.1/32 -# cidr_allow 192.0.2.0/24 -# cidr_deny 192.0.2.42/32 - -# Which address to bind to; -host <%= scope.lookupvar('munin::client::host') %> -# host 127.0.0.1 - -# And which port -port <%= scope.lookupvar('munin::client::port') %> - diff --git a/templates/munin-node.conf.erb b/templates/munin-node.conf.erb new file mode 100644 index 0000000..5e015d2 --- /dev/null +++ b/templates/munin-node.conf.erb @@ -0,0 +1,62 @@ +########## +########## Managed by puppet +########## + +log_level 4 +log_file <%= @log_file %> +pid_file /var/run/munin/munin-node.pid + +background 1 +setsid 1 + +user <%= @user %> +group <%= @group %> + +# This is the timeout for the whole transaction. +# Units are in sec. Default is 15 min +# +# global_timeout 900 + +# This is the timeout for each plugin. +# Units are in sec. Default is 1 min +# +# timeout 60 + +# Regexps for files to ignore +ignore_file [\#~]$ +ignore_file DEADJOE$ +ignore_file \.bak$ +ignore_file %$ +ignore_file \.dpkg-(tmp|new|old|dist)$ +ignore_file \.rpm(save|new)$ +ignore_file \.pod$ + +# Set this if the client doesn't report the correct hostname when +# telnetting to localhost, port 4949 +# +host_name <%= scope.lookupvar('::fqdn') %> + +# A list of addresses that are allowed to connect. This must be a +# regular expression, since Net::Server does not understand CIDR-style +# network notation unless the perl module Net::CIDR is installed. You +# may repeat the allow line as many times as you'd like +<% scope.lookupvar('munin::client::allow').each do |allow| -%> +allow <%= "^#{Regexp.escape(allow)}$" %> +<% end -%> + +# If you have installed the Net::CIDR perl module, you can use one or more +# cidr_allow and cidr_deny address/mask patterns. A connecting client must +# match any cidr_allow, and not match any cidr_deny. Note that a netmask +# *must* be provided, even if it's /32 +# +# Example: +# +# cidr_allow 127.0.0.1/32 +# cidr_allow 192.0.2.0/24 +# cidr_deny 192.0.2.42/32 + +# Which address to bind to; +host <%= scope.lookupvar('munin::client::host') %> + +# And which port +port <%= scope.lookupvar('munin::client::port') %> diff --git a/templates/site.conf b/templates/site.conf deleted file mode 100644 index 842bde0..0000000 --- a/templates/site.conf +++ /dev/null @@ -1,9 +0,0 @@ - - ServerName <%= @name %> - DocumentRoot /var/cache/munin/www/ - - order allow,deny - Allow from all - - - -- cgit v1.2.3 From 9bee8a31f2305dda884aeab3caf3bf91cd8603ba Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Tue, 2 Jul 2013 23:07:00 +0200 Subject: Unify logrotate files into templates --- files/config/host/logrotate.CentOS | 35 ----------------------- files/config/host/logrotate.Debian | 35 ----------------------- manifests/host/cgi.pp | 12 +++----- spec/classes/munin_host_cgi_spec.rb | 57 +++++++++++++++++++++++++++++++++++++ templates/logrotate.conf.erb | 35 +++++++++++++++++++++++ 5 files changed, 96 insertions(+), 78 deletions(-) delete mode 100644 files/config/host/logrotate.CentOS delete mode 100644 files/config/host/logrotate.Debian create mode 100644 spec/classes/munin_host_cgi_spec.rb create mode 100644 templates/logrotate.conf.erb diff --git a/files/config/host/logrotate.CentOS b/files/config/host/logrotate.CentOS deleted file mode 100644 index 411de3f..0000000 --- a/files/config/host/logrotate.CentOS +++ /dev/null @@ -1,35 +0,0 @@ -/var/log/munin/munin-update.log { - daily - missingok - rotate 7 - compress - notifempty - create 640 munin adm -} - -/var/log/munin/munin-graph.log { - daily - missingok - rotate 7 - compress - notifempty - create 660 munin apache -} - -/var/log/munin/munin-html.log { - daily - missingok - rotate 7 - compress - notifempty - create 640 munin adm -} - -/var/log/munin/munin-limits.log { - daily - missingok - rotate 7 - compress - notifempty - create 640 munin adm -} diff --git a/files/config/host/logrotate.Debian b/files/config/host/logrotate.Debian deleted file mode 100644 index 732c871..0000000 --- a/files/config/host/logrotate.Debian +++ /dev/null @@ -1,35 +0,0 @@ -/var/log/munin/munin-update.log { - daily - missingok - rotate 7 - compress - notifempty - create 640 munin adm -} - -/var/log/munin/munin-graph.log { - daily - missingok - rotate 7 - compress - notifempty - create 660 munin www-data -} - -/var/log/munin/munin-html.log { - daily - missingok - rotate 7 - compress - notifempty - create 640 munin adm -} - -/var/log/munin/munin-limits.log { - daily - missingok - rotate 7 - compress - notifempty - create 640 munin adm -} diff --git a/manifests/host/cgi.pp b/manifests/host/cgi.pp index 5b0ecbb..9951a48 100644 --- a/manifests/host/cgi.pp +++ b/manifests/host/cgi.pp @@ -30,13 +30,9 @@ class munin::host::cgi( } file{'/etc/logrotate.d/munin': - source => [ "puppet:///modules/site_munin/config/host/${::fqdn}/logrotate", - "puppet:///modules/site_munin/config/host/logrotate.${::operatingsystem}", - 'puppet:///modules/site_munin/config/host/logrotate', - "puppet:///modules/munin/config/host/logrotate.${::operatingsystem}", - 'puppet:///modules/munin/config/host/logrotate' ], - owner => root, - group => 0, - mode => '0644', + content => template("${module_name}/logrotate.conf.erb"), + owner => root, + group => 0, + mode => '0644', } } diff --git a/spec/classes/munin_host_cgi_spec.rb b/spec/classes/munin_host_cgi_spec.rb new file mode 100644 index 0000000..301f964 --- /dev/null +++ b/spec/classes/munin_host_cgi_spec.rb @@ -0,0 +1,57 @@ +require 'spec_helper' + +describe 'munin::host::cgi' do + #let :pre_condition do + # 'include munin::client' + #end + + context 'on Debian' do + let :facts do + { :operatingsystem => 'Debian' } + end + + it 'should compile' do + should include_class('munin::host::cgi') + end + + it 'should exec set_modes_for_cgi' do + should contain_exec('set_modes_for_cgi').with({ + :command => 'chgrp www-data /var/log/munin /var/log/munin/munin-graph.log && chmod g+w /var/log/munin /var/log/munin/munin-graph.log && find /var/www/munin/* -maxdepth 1 -type d -exec chgrp -R www-data {} \; && find /var/www/munin/* -maxdepth 1 -type d -exec chmod -R g+w {} \;', + :refreshonly => true, + :subscribe => 'Concat::Fragment[munin.conf.header]', + }) + end + + it 'should contain logrotate.conf' do + should contain_file('/etc/logrotate.d/munin').with({ + :content => /^ create 660 munin www-data$/, + :group => 0, + :mode => '0644', + :owner => 'root', + }) + end + end + + context 'on CentOS' do + let :facts do + { :operatingsystem => 'CentOS' } + end + + it 'should exec set_modes_for_cgi' do + should contain_exec('set_modes_for_cgi').with({ + :command => 'chgrp apache /var/log/munin /var/log/munin/munin-graph.log && chmod g+w /var/log/munin /var/log/munin/munin-graph.log && find /var/www/html/munin/* -maxdepth 1 -type d -exec chgrp -R apache {} \; && find /var/www/html/munin/* -maxdepth 1 -type d -exec chmod -R g+w {} \;', + :refreshonly => true, + :subscribe => 'Concat::Fragment[munin.conf.header]', + }) + end + + it 'should contain logrotate.conf' do + should contain_file('/etc/logrotate.d/munin').with({ + :content => /^ create 660 munin apache$/, + :group => 0, + :mode => '0644', + :owner => 'root', + }) + end + end +end diff --git a/templates/logrotate.conf.erb b/templates/logrotate.conf.erb new file mode 100644 index 0000000..0e3e6ca --- /dev/null +++ b/templates/logrotate.conf.erb @@ -0,0 +1,35 @@ +/var/log/munin/munin-update.log { + daily + missingok + rotate 7 + compress + notifempty + create 640 munin adm +} + +/var/log/munin/munin-graph.log { + daily + missingok + rotate 7 + compress + notifempty + create 660 munin <%= @apache_user %> +} + +/var/log/munin/munin-html.log { + daily + missingok + rotate 7 + compress + notifempty + create 640 munin adm +} + +/var/log/munin/munin-limits.log { + daily + missingok + rotate 7 + compress + notifempty + create 640 munin adm +} -- cgit v1.2.3 From 151b37a22ee5822101aa316d0c0620ad535c80d1 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Tue, 2 Jul 2013 23:09:29 +0200 Subject: Remove useless files --- files/config/host/munin.conf.header.Debian.sid | 75 ---------------------- files/config/host/munin.conf.header.Debian.squeeze | 75 ---------------------- files/config/host/munin.conf.header.Debian.wheezy | 75 ---------------------- files/empty/.ignore | 1 - files/modules_dir/.ignore | 0 5 files changed, 226 deletions(-) delete mode 100644 files/config/host/munin.conf.header.Debian.sid delete mode 100644 files/config/host/munin.conf.header.Debian.squeeze delete mode 100644 files/config/host/munin.conf.header.Debian.wheezy delete mode 100644 files/empty/.ignore delete mode 100644 files/modules_dir/.ignore diff --git a/files/config/host/munin.conf.header.Debian.sid b/files/config/host/munin.conf.header.Debian.sid deleted file mode 100644 index 771d50d..0000000 --- a/files/config/host/munin.conf.header.Debian.sid +++ /dev/null @@ -1,75 +0,0 @@ -# Example configuration file for Munin, generated by 'make build' - -# The next three variables specifies where the location of the RRD -# databases, the HTML output, and the logs, severally. They all -# must be writable by the user running munin-cron. -dbdir /var/lib/munin -htmldir /var/cache/munin/www -logdir /var/log/munin -rundir /var/run/munin - -# Where to look for the HTML templates -tmpldir /etc/munin/templates - -# Make graphs show values per minute instead of per second -#graph_period minute - -# Drop somejuser@fnord.comm and anotheruser@blibb.comm an email everytime -# something changes (OK -> WARNING, CRITICAL -> OK, etc) -#contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm -#contact.anotheruser.command mail -s "Munin notification" anotheruser@blibb.comm -# -# For those with Nagios, the following might come in handy. In addition, -# the services must be defined in the Nagios server as well. -#contact.nagios.command /usr/sbin/send_nsca -H nagios.host.com -c /etc/send_nsca.cfg - -#contacts me -#contact.me.command mail -s "Munin notification ${var:group} :: ${var:host} :: ${var:graph_title}" root -#contact.me.always_send warning critical - -# a simple host tree -#[localhost] -# address 127.0.0.1 -# use_node_name yes - -# -# A more complex example of a host tree -# -## First our "normal" host. -# [fii.foo.com] -# address foo -# -## Then our other host... -# [fay.foo.com] -# address fay -# -## Then we want totals... -# [foo.com;Totals] #Force it into the "foo.com"-domain... -# update no # Turn off data-fetching for this "host". -# -# # The graph "load1". We want to see the loads of both machines... -# # "fii=fii.foo.com:load.load" means "label=machine:graph.field" -# load1.graph_title Loads side by side -# load1.graph_order fii=fii.foo.com:load.load fay=fay.foo.com:load.load -# -# # The graph "load2". Now we want them stacked on top of each other. -# load2.graph_title Loads on top of each other -# load2.dummy_field.stack fii=fii.foo.com:load.load fay=fay.foo.com:load.load -# load2.dummy_field.draw AREA # We want area instead the default LINE2. -# load2.dummy_field.label dummy # This is needed. Silly, really. -# -# # The graph "load3". Now we want them summarised into one field -# load3.graph_title Loads summarised -# load3.combined_loads.sum fii.foo.com:load.load fay.foo.com:load.load -# load3.combined_loads.label Combined loads # Must be set, as this is -# # not a dummy field! -# -## ...and on a side note, I want them listen in another order (default is -## alphabetically) -# -# # Since [foo.com] would be interpreted as a host in the domain "com", we -# # specify that this is a domain by adding a semicolon. -# [foo.com;] -# node_order Totals fii.foo.com fay.foo.com -# - diff --git a/files/config/host/munin.conf.header.Debian.squeeze b/files/config/host/munin.conf.header.Debian.squeeze deleted file mode 100644 index 771d50d..0000000 --- a/files/config/host/munin.conf.header.Debian.squeeze +++ /dev/null @@ -1,75 +0,0 @@ -# Example configuration file for Munin, generated by 'make build' - -# The next three variables specifies where the location of the RRD -# databases, the HTML output, and the logs, severally. They all -# must be writable by the user running munin-cron. -dbdir /var/lib/munin -htmldir /var/cache/munin/www -logdir /var/log/munin -rundir /var/run/munin - -# Where to look for the HTML templates -tmpldir /etc/munin/templates - -# Make graphs show values per minute instead of per second -#graph_period minute - -# Drop somejuser@fnord.comm and anotheruser@blibb.comm an email everytime -# something changes (OK -> WARNING, CRITICAL -> OK, etc) -#contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm -#contact.anotheruser.command mail -s "Munin notification" anotheruser@blibb.comm -# -# For those with Nagios, the following might come in handy. In addition, -# the services must be defined in the Nagios server as well. -#contact.nagios.command /usr/sbin/send_nsca -H nagios.host.com -c /etc/send_nsca.cfg - -#contacts me -#contact.me.command mail -s "Munin notification ${var:group} :: ${var:host} :: ${var:graph_title}" root -#contact.me.always_send warning critical - -# a simple host tree -#[localhost] -# address 127.0.0.1 -# use_node_name yes - -# -# A more complex example of a host tree -# -## First our "normal" host. -# [fii.foo.com] -# address foo -# -## Then our other host... -# [fay.foo.com] -# address fay -# -## Then we want totals... -# [foo.com;Totals] #Force it into the "foo.com"-domain... -# update no # Turn off data-fetching for this "host". -# -# # The graph "load1". We want to see the loads of both machines... -# # "fii=fii.foo.com:load.load" means "label=machine:graph.field" -# load1.graph_title Loads side by side -# load1.graph_order fii=fii.foo.com:load.load fay=fay.foo.com:load.load -# -# # The graph "load2". Now we want them stacked on top of each other. -# load2.graph_title Loads on top of each other -# load2.dummy_field.stack fii=fii.foo.com:load.load fay=fay.foo.com:load.load -# load2.dummy_field.draw AREA # We want area instead the default LINE2. -# load2.dummy_field.label dummy # This is needed. Silly, really. -# -# # The graph "load3". Now we want them summarised into one field -# load3.graph_title Loads summarised -# load3.combined_loads.sum fii.foo.com:load.load fay.foo.com:load.load -# load3.combined_loads.label Combined loads # Must be set, as this is -# # not a dummy field! -# -## ...and on a side note, I want them listen in another order (default is -## alphabetically) -# -# # Since [foo.com] would be interpreted as a host in the domain "com", we -# # specify that this is a domain by adding a semicolon. -# [foo.com;] -# node_order Totals fii.foo.com fay.foo.com -# - diff --git a/files/config/host/munin.conf.header.Debian.wheezy b/files/config/host/munin.conf.header.Debian.wheezy deleted file mode 100644 index 771d50d..0000000 --- a/files/config/host/munin.conf.header.Debian.wheezy +++ /dev/null @@ -1,75 +0,0 @@ -# Example configuration file for Munin, generated by 'make build' - -# The next three variables specifies where the location of the RRD -# databases, the HTML output, and the logs, severally. They all -# must be writable by the user running munin-cron. -dbdir /var/lib/munin -htmldir /var/cache/munin/www -logdir /var/log/munin -rundir /var/run/munin - -# Where to look for the HTML templates -tmpldir /etc/munin/templates - -# Make graphs show values per minute instead of per second -#graph_period minute - -# Drop somejuser@fnord.comm and anotheruser@blibb.comm an email everytime -# something changes (OK -> WARNING, CRITICAL -> OK, etc) -#contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm -#contact.anotheruser.command mail -s "Munin notification" anotheruser@blibb.comm -# -# For those with Nagios, the following might come in handy. In addition, -# the services must be defined in the Nagios server as well. -#contact.nagios.command /usr/sbin/send_nsca -H nagios.host.com -c /etc/send_nsca.cfg - -#contacts me -#contact.me.command mail -s "Munin notification ${var:group} :: ${var:host} :: ${var:graph_title}" root -#contact.me.always_send warning critical - -# a simple host tree -#[localhost] -# address 127.0.0.1 -# use_node_name yes - -# -# A more complex example of a host tree -# -## First our "normal" host. -# [fii.foo.com] -# address foo -# -## Then our other host... -# [fay.foo.com] -# address fay -# -## Then we want totals... -# [foo.com;Totals] #Force it into the "foo.com"-domain... -# update no # Turn off data-fetching for this "host". -# -# # The graph "load1". We want to see the loads of both machines... -# # "fii=fii.foo.com:load.load" means "label=machine:graph.field" -# load1.graph_title Loads side by side -# load1.graph_order fii=fii.foo.com:load.load fay=fay.foo.com:load.load -# -# # The graph "load2". Now we want them stacked on top of each other. -# load2.graph_title Loads on top of each other -# load2.dummy_field.stack fii=fii.foo.com:load.load fay=fay.foo.com:load.load -# load2.dummy_field.draw AREA # We want area instead the default LINE2. -# load2.dummy_field.label dummy # This is needed. Silly, really. -# -# # The graph "load3". Now we want them summarised into one field -# load3.graph_title Loads summarised -# load3.combined_loads.sum fii.foo.com:load.load fay.foo.com:load.load -# load3.combined_loads.label Combined loads # Must be set, as this is -# # not a dummy field! -# -## ...and on a side note, I want them listen in another order (default is -## alphabetically) -# -# # Since [foo.com] would be interpreted as a host in the domain "com", we -# # specify that this is a domain by adding a semicolon. -# [foo.com;] -# node_order Totals fii.foo.com fay.foo.com -# - diff --git a/files/empty/.ignore b/files/empty/.ignore deleted file mode 100644 index 91162ec..0000000 --- a/files/empty/.ignore +++ /dev/null @@ -1 +0,0 @@ -# just used for git diff --git a/files/modules_dir/.ignore b/files/modules_dir/.ignore deleted file mode 100644 index e69de29..0000000 -- cgit v1.2.3 From 91f339a550dbb677fbcb633cd828b0878fee33be Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 25 Jan 2014 15:34:13 +0100 Subject: add openbsd module as dependency --- Puppetfile | 3 ++- Puppetfile.lock | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Puppetfile b/Puppetfile index 60d1d14..39f742e 100644 --- a/Puppetfile +++ b/Puppetfile @@ -1,4 +1,5 @@ forge 'http://forge.puppetlabs.com' mod 'puppetlabs/stdlib', '>=0.1.6' -mod 'puppetlabs/concat' \ No newline at end of file +mod 'puppetlabs/concat' +mod 'openbsd', :git => "git://github.com/duritong/puppet-openbsd.git" diff --git a/Puppetfile.lock b/Puppetfile.lock index 0689d41..2c74da4 100644 --- a/Puppetfile.lock +++ b/Puppetfile.lock @@ -4,7 +4,15 @@ FORGE puppetlabs/concat (1.0.0-rc1) puppetlabs/stdlib (4.1.0) +GIT + remote: git://github.com/duritong/puppet-openbsd.git + ref: master + sha: a6cce1fe5262b59538835d3b9166cc754b8e550d + specs: + openbsd (0.0.1) + DEPENDENCIES + openbsd (>= 0) puppetlabs/concat (>= 0) puppetlabs/stdlib (>= 0.1.6) -- cgit v1.2.3 From 95e838291d238ae1489287669fec21ddb0d7df1b Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 25 Jan 2014 16:00:13 +0100 Subject: try to fix travis and add new puppet version --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e27b2f5..9b9750e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,12 +2,13 @@ rvm: - 1.8.7 - 1.9.3 - 2.0.0 -script: 'rake spec' +script: 'bundle exec rake spec' env: - PUPPET_VERSION=2.7.0 - PUPPET_VERSION=3.0.0 - PUPPET_VERSION=3.1.0 - PUPPET_VERSION=3.2.0 + - PUPPET_VERSION=3.4.2 matrix: exclude: # No support for Ruby 1.9 before Puppet 2.7 -- cgit v1.2.3 From 2f43fe5b01cc6a9f240f705d52a60e78db17cd7e Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 25 Jan 2014 16:08:44 +0100 Subject: don't commit the lockfile we like to test against latest --- .gitignore | 2 +- Puppetfile.lock | 18 ------------------ 2 files changed, 1 insertion(+), 19 deletions(-) delete mode 100644 Puppetfile.lock diff --git a/.gitignore b/.gitignore index 9ef9ca4..c6cdc29 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ -Gemfile.lock spec/fixtures/ vendor/ .tmp/* .librarian/* +*.lock diff --git a/Puppetfile.lock b/Puppetfile.lock deleted file mode 100644 index 2c74da4..0000000 --- a/Puppetfile.lock +++ /dev/null @@ -1,18 +0,0 @@ -FORGE - remote: http://forge.puppetlabs.com - specs: - puppetlabs/concat (1.0.0-rc1) - puppetlabs/stdlib (4.1.0) - -GIT - remote: git://github.com/duritong/puppet-openbsd.git - ref: master - sha: a6cce1fe5262b59538835d3b9166cc754b8e550d - specs: - openbsd (0.0.1) - -DEPENDENCIES - openbsd (>= 0) - puppetlabs/concat (>= 0) - puppetlabs/stdlib (>= 0.1.6) - -- cgit v1.2.3 From a6f6aedf0fed0ee53b29850264c7769215ec590f Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 25 Jan 2014 16:16:40 +0100 Subject: only test latest versions --- .travis.yml | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9b9750e..4b26c23 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,20 +4,10 @@ rvm: - 2.0.0 script: 'bundle exec rake spec' env: - - PUPPET_VERSION=2.7.0 - - PUPPET_VERSION=3.0.0 - - PUPPET_VERSION=3.1.0 - - PUPPET_VERSION=3.2.0 + - PUPPET_VERSION=2.7.25 - PUPPET_VERSION=3.4.2 matrix: exclude: - # No support for Ruby 1.9 before Puppet 2.7 - - rvm: 1.9.3 - env: PUPPET_VERSION=2.6.0 # No support for Ruby 2.0 before Puppet 3.2 - rvm: 2.0.0 - env: PUPPET_VERSION=2.7.0 - - rvm: 2.0.0 - env: PUPPET_VERSION=3.0.0 - - rvm: 2.0.0 - env: PUPPET_VERSION=3.1.0 + env: PUPPET_VERSION=2.7.25 -- cgit v1.2.3 From c08b0ee68847c5e7017bb04c47f7f85b796ea0b9 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 28 Jan 2014 21:28:15 +0100 Subject: remove obsolete link --- templates/munin-node.conf.CloudLinux | 1 - 1 file changed, 1 deletion(-) delete mode 120000 templates/munin-node.conf.CloudLinux diff --git a/templates/munin-node.conf.CloudLinux b/templates/munin-node.conf.CloudLinux deleted file mode 120000 index 082b30c..0000000 --- a/templates/munin-node.conf.CloudLinux +++ /dev/null @@ -1 +0,0 @@ -munin-node.conf.default \ No newline at end of file -- cgit v1.2.3 From fc4d4d204b2eb3e8f1848fc46f6f4cfc7584f84e Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 29 Jan 2014 23:26:56 +0100 Subject: comment a regexp that is not yet supported by all deployed munin versions --- templates/munin-node.conf.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/munin-node.conf.erb b/templates/munin-node.conf.erb index 5e015d2..4448002 100644 --- a/templates/munin-node.conf.erb +++ b/templates/munin-node.conf.erb @@ -23,7 +23,7 @@ group <%= @group %> # timeout 60 # Regexps for files to ignore -ignore_file [\#~]$ +#ignore_file [\#~]$ ignore_file DEADJOE$ ignore_file \.bak$ ignore_file %$ -- cgit v1.2.3 From 99e32a12d401828e71c13309bf21460086f77e0e Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 29 Jan 2014 23:32:52 +0100 Subject: unify logdir --- manifests/client/openbsd.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp index 5ced4c4..64ea588 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -1,6 +1,6 @@ # generate a few missing things on openbsd class munin::client::openbsd inherits munin::client::base { - file{[ '/var/run/munin', '/var/log/munin' ]: + file{[ '/var/run/munin', '/var/log/munin-node' ]: ensure => directory, owner => root, group => 0, @@ -17,10 +17,10 @@ class munin::client::openbsd inherits munin::client::base { 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-munin'] ], } 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, -- cgit v1.2.3 From 0ebbe54879941e886dc1519b7dfdc69f614975ad Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 29 Jan 2014 23:37:11 +0100 Subject: correct dependency --- manifests/client/openbsd.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/client/openbsd.pp b/manifests/client/openbsd.pp index 64ea588..09fb24f 100644 --- a/manifests/client/openbsd.pp +++ b/manifests/client/openbsd.pp @@ -17,7 +17,7 @@ class munin::client::openbsd inherits munin::client::base { 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-munin'] ], + require => [ File['/var/run/munin'], File['/var/log/munin-node'] ], } cron{'clean_munin_logfile': command => 'rm /var/log/munin-node/munin-node.log; kill -HUP `cat /var/run/munin/munin-node.pid`', -- cgit v1.2.3 From 695d81c81cd152b5dd7333d0eae2bd6df108a41e Mon Sep 17 00:00:00 2001 From: Arjen Heidinga Date: Fri, 31 Jan 2014 09:52:10 +0100 Subject: Add support for setting the descryption and group support --- manifests/client.pp | 14 ++++++++------ manifests/client/base.pp | 12 +++++++----- manifests/client/params.pp | 2 +- manifests/register.pp | 3 ++- templates/client.erb | 4 ++-- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/manifests/client.pp b/manifests/client.pp index 2d4c82b..6614709 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -4,13 +4,15 @@ # configure a munin node class munin::client( - $allow = [ '127.0.0.1' ], - $host = '*', - $port = '4949', - $use_ssh = false, - $manage_shorewall = false, + $allow = [ '127.0.0.1' ], + $host = '*', + $port = '4949', + $use_ssh = false, + $manage_shorewall = false, $shorewall_collector_source = 'net', - $export_tag = 'munin' + $export_tag = 'munin', + $description = 'absent', + $munin_group = 'absent', ) { case $::operatingsystem { diff --git a/manifests/client/base.pp b/manifests/client/base.pp index 71531fa..d35d742 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -31,11 +31,13 @@ class munin::client::base inherits munin::client::params { default => $munin::client::host } munin::register { $::fqdn: - host => $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::client::port, + use_ssh => $munin::client::use_ssh, + description => $munin::client::description, + group => $munin::client::munin_group, + config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'], + export_tag => $munin::client::export_tag, } include munin::plugins::base } diff --git a/manifests/client/params.pp b/manifests/client/params.pp index 14d3749..4473912 100644 --- a/manifests/client/params.pp +++ b/manifests/client/params.pp @@ -2,7 +2,7 @@ class munin::client::params { $user = 'root' - case $::operatingsystem { + case $::osfamily { 'OpenBSD': { $group = '0' $log_file = '/var/log/munin-node/munin-node.log' diff --git a/manifests/register.pp b/manifests/register.pp index 1f6d787..f0567d7 100644 --- a/manifests/register.pp +++ b/manifests/register.pp @@ -5,7 +5,8 @@ define munin::register ( $use_ssh = false, $description = 'absent', $config = [], - $export_tag = 'munin' + $export_tag = 'munin', + $group ='absent', ) { $fhost = $name diff --git a/templates/client.erb b/templates/client.erb index 83d5a64..5741701 100644 --- a/templates/client.erb +++ b/templates/client.erb @@ -9,9 +9,9 @@ # Registered on: <%= @h %> # Type: <%= @client_type %> <% if @description != 'absent' -%> -# Description: <%= @description.gsub!(/\n/, ' ') %> +# Description: <%= @description.gsub(/\n/, ' ') %> <% end -%> -[<%= @fhost.downcase %>] +[<% if @group != 'absent' -%><%= @group %>;<% end -%><%= @fhost.downcase %>] <% if @use_ssh -%> address ssh://<%= @host %>/bin/nc localhost <%= @port %> <% else -%> -- cgit v1.2.3 From b5cc9427aeca48689913b7462e58dd905c4a788b Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 3 Feb 2014 14:57:03 +0100 Subject: cleanup some of the missing parts --- manifests/register.pp | 14 +++++++------- templates/client.erb | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/manifests/register.pp b/manifests/register.pp index f0567d7..8c1ec61 100644 --- a/manifests/register.pp +++ b/manifests/register.pp @@ -1,12 +1,12 @@ # Register a munin client define munin::register ( - $host = $::fqdn, - $port = '4949', - $use_ssh = false, - $description = 'absent', - $config = [], - $export_tag = 'munin', - $group ='absent', + $host = $::fqdn, + $port = '4949', + $use_ssh = false, + $description = 'absent', + $config = [], + $export_tag = 'munin', + $group = 'absent', ) { $fhost = $name diff --git a/templates/client.erb b/templates/client.erb index 5741701..bc42452 100644 --- a/templates/client.erb +++ b/templates/client.erb @@ -1,12 +1,12 @@ <% - # Downcase all information - dom = scope.lookupvar('::domain').downcase - h = scope.lookupvar('::hostname').downcase + # Downcase all information + dom = scope.lookupvar('::domain').downcase + h = scope.lookupvar('::hostname').downcase %> ### Munin client from Puppet template -# Domain: <%= @dom %> -# Registered on: <%= @h %> +# Domain: <%= dom %> +# Registered on: <%= h %> # Type: <%= @client_type %> <% if @description != 'absent' -%> # Description: <%= @description.gsub(/\n/, ' ') %> -- cgit v1.2.3 From 9de938880129bc8d8985debdf09336d63787f8ae Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 3 Feb 2014 16:11:07 +0100 Subject: using correct facts in tests --- spec/classes/munin_client_base_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/classes/munin_client_base_spec.rb b/spec/classes/munin_client_base_spec.rb index 1b3d936..2ddfdcc 100644 --- a/spec/classes/munin_client_base_spec.rb +++ b/spec/classes/munin_client_base_spec.rb @@ -13,7 +13,7 @@ describe 'munin::client::base' do context 'on Debian' do let :facts do - { :operatingsystem => 'Debian' }.merge(default_facts) + { :osfamily => 'Debian' }.merge(default_facts) end it 'should compile' do @@ -61,7 +61,7 @@ describe 'munin::client::base' do context 'on CentOS' do let :facts do - { :operatingsystem => 'CentOS' }.merge(default_facts) + { :osfamily => 'CentOS' }.merge(default_facts) end it 'should contain the CentOS specific values' do @@ -74,7 +74,7 @@ describe 'munin::client::base' do # Disabled because the required openbsd module is not in the requirements context 'on OpenBSD', :if => false do let :facts do - { :operatingsystem => 'OpenBSD' }.merge(default_facts) + { :osfamily => 'OpenBSD' }.merge(default_facts) end it 'should contain the config OpenBSD specific values' do -- cgit v1.2.3 From 47c5d323099b341a785b44f9d05ff0b535ce12e6 Mon Sep 17 00:00:00 2001 From: Marco Nenciarini Date: Fri, 14 Feb 2014 16:08:40 +0100 Subject: Allow to deploy a plugin without registering it --- manifests/plugin/deploy.pp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index c514eed..2cee966 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -3,7 +3,8 @@ define munin::plugin::deploy( $ensure = 'present', $source = '', $config = '', - $seltype = 'munin_exec_t' + $seltype = 'munin_exec_t', + $register = true, ) { $plugin_src = $ensure ? { 'present' => $name, @@ -36,9 +37,12 @@ define munin::plugin::deploy( File["munin_plugin_${name}"]{ require => $basic_require, } - # register the plugin - munin::plugin{$name: - ensure => $ensure, - config => $config + + # register the plugin if required + if ($register) { + munin::plugin{$name: + ensure => $ensure, + config => $config + } } } -- cgit v1.2.3 From 0bb71e3aed91c87b529901a2666c8c0eeb439083 Mon Sep 17 00:00:00 2001 From: Marco Nenciarini Date: Fri, 14 Feb 2014 16:21:39 +0100 Subject: Use puppetlabs/concat instead of ripienaar/concat --- Modulefile | 2 +- Puppetfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Modulefile b/Modulefile index 7590eed..23d540e 100644 --- a/Modulefile +++ b/Modulefile @@ -9,5 +9,5 @@ project_page 'https://github.com/duritong/puppet-munin' ## Add dependencies, if any: # dependency 'username/name', '>= 1.2.0' -dependency 'ripienaar/concat', '>= 0.2.0' +dependency 'puppetlabs/concat', '>= 1.0.0' dependency 'puppetlabs/stdlib', '>= 3.2.0' diff --git a/Puppetfile b/Puppetfile index 39f742e..01916ca 100644 --- a/Puppetfile +++ b/Puppetfile @@ -1,5 +1,5 @@ forge 'http://forge.puppetlabs.com' mod 'puppetlabs/stdlib', '>=0.1.6' -mod 'puppetlabs/concat' +mod 'puppetlabs/concat', '>=1.0.0' mod 'openbsd', :git => "git://github.com/duritong/puppet-openbsd.git" -- cgit v1.2.3 From a72b5913f4c87f7c45635197d942683918b5eb13 Mon Sep 17 00:00:00 2001 From: Marco Nenciarini Date: Mon, 17 Feb 2014 17:15:25 +0100 Subject: Sync Puppetfile with Modulefile to avoid errors in librarian-puppet https://github.com/rodjek/librarian-puppet/issues/180 --- Puppetfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Puppetfile b/Puppetfile index 01916ca..7626e84 100644 --- a/Puppetfile +++ b/Puppetfile @@ -1,5 +1,5 @@ forge 'http://forge.puppetlabs.com' -mod 'puppetlabs/stdlib', '>=0.1.6' +mod 'puppetlabs/stdlib', '>=3.2.0' mod 'puppetlabs/concat', '>=1.0.0' mod 'openbsd', :git => "git://github.com/duritong/puppet-openbsd.git" -- cgit v1.2.3 From 315f3d6ece9986d0d41f233c6b7c4acd5d5483c8 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 14 Mar 2014 10:09:25 +0100 Subject: adjust to freshly release module --- Modulefile | 1 + Puppetfile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 23d540e..f654b91 100644 --- a/Modulefile +++ b/Modulefile @@ -11,3 +11,4 @@ project_page 'https://github.com/duritong/puppet-munin' # dependency 'username/name', '>= 1.2.0' dependency 'puppetlabs/concat', '>= 1.0.0' dependency 'puppetlabs/stdlib', '>= 3.2.0' +dependency 'duritong/openbsd', '>= 3.2.0' diff --git a/Puppetfile b/Puppetfile index 7626e84..b8b183b 100644 --- a/Puppetfile +++ b/Puppetfile @@ -2,4 +2,4 @@ forge 'http://forge.puppetlabs.com' mod 'puppetlabs/stdlib', '>=3.2.0' mod 'puppetlabs/concat', '>=1.0.0' -mod 'openbsd', :git => "git://github.com/duritong/puppet-openbsd.git" +mod 'duritong/openbsd', '>=0.0.1' -- cgit v1.2.3 From 557c0a4942ae75251532fddc48d202ac1539a3eb Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 14 Mar 2014 10:15:17 +0100 Subject: release a new version --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index f654b91..77b4cda 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'duritong-munin' -version '0.0.1' +version '0.0.2' source 'git://github.com/duritong/puppet-munin.git' author 'duritong' license 'Apache License, Version 2.0' -- cgit v1.2.3 From a4df8e11532dc9d4dfad522046b47f9d76c5b11d Mon Sep 17 00:00:00 2001 From: Marco Nenciarini Date: Thu, 20 Mar 2014 11:51:42 +0100 Subject: Fix openbsd module dependency Please bump the module version and release it again to the forge or the module will be unusable. --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index f654b91..a7d4828 100644 --- a/Modulefile +++ b/Modulefile @@ -11,4 +11,4 @@ project_page 'https://github.com/duritong/puppet-munin' # dependency 'username/name', '>= 1.2.0' dependency 'puppetlabs/concat', '>= 1.0.0' dependency 'puppetlabs/stdlib', '>= 3.2.0' -dependency 'duritong/openbsd', '>= 3.2.0' +dependency 'duritong/openbsd', '>= 0.0.1' -- cgit v1.2.3 From bcf24d2783aae46d2f4ebe506c017e7b26bdfac8 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 21 Mar 2014 09:31:03 +0100 Subject: new release --- .gitignore | 1 + Modulefile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c6cdc29..7df6248 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ vendor/ .tmp/* .librarian/* *.lock +pkg/ diff --git a/Modulefile b/Modulefile index 19fbc7c..d36804a 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'duritong-munin' -version '0.0.2' +version '0.0.3' source 'git://github.com/duritong/puppet-munin.git' author 'duritong' license 'Apache License, Version 2.0' -- cgit v1.2.3 From d09774c635ea72932727d6724ee847942ddafb77 Mon Sep 17 00:00:00 2001 From: antonio Date: Wed, 9 Apr 2014 15:45:37 +0200 Subject: Configurable host_name variable --- manifests/client.pp | 1 + templates/munin-node.conf.erb | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/manifests/client.pp b/manifests/client.pp index 6614709..7a96233 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -6,6 +6,7 @@ class munin::client( $allow = [ '127.0.0.1' ], $host = '*', + $host_name = '::fqdn', $port = '4949', $use_ssh = false, $manage_shorewall = false, diff --git a/templates/munin-node.conf.erb b/templates/munin-node.conf.erb index 4448002..891203c 100644 --- a/templates/munin-node.conf.erb +++ b/templates/munin-node.conf.erb @@ -34,7 +34,11 @@ ignore_file \.pod$ # Set this if the client doesn't report the correct hostname when # telnetting to localhost, port 4949 # +<% if scope.lookupvar('munin::client::host_name') == '::fqdn' -%> host_name <%= scope.lookupvar('::fqdn') %> +<% else -%> +host_name <%= scope.lookupvar('munin::client::host_name') %> +<% end -%> # A list of addresses that are allowed to connect. This must be a # regular expression, since Net::Server does not understand CIDR-style -- cgit v1.2.3 From bab6dff342ef3288f647edf3bc59580a1fdcc8c4 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 19 Apr 2014 14:04:32 +0200 Subject: the default selinux type should be unconfined --- manifests/plugin/deploy.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 2cee966..6a8d052 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -3,7 +3,7 @@ define munin::plugin::deploy( $ensure = 'present', $source = '', $config = '', - $seltype = 'munin_exec_t', + $seltype = 'munin_unconfined_exec_t', $register = true, ) { $plugin_src = $ensure ? { @@ -24,7 +24,7 @@ define munin::plugin::deploy( mode => '0755'; } - if (str2bool($::selinux) == true) and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ + if (str2bool($::selinux) == true) and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease > '5')){ File["munin_plugin_${name}"]{ seltype => $seltype, } -- cgit v1.2.3 From 0bbf3ce96c049cdcbc59dfdcef860f09d515f618 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 19 Apr 2014 17:11:58 +0200 Subject: correct seltype --- manifests/plugin/deploy.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 6a8d052..461a218 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -3,7 +3,7 @@ define munin::plugin::deploy( $ensure = 'present', $source = '', $config = '', - $seltype = 'munin_unconfined_exec_t', + $seltype = 'munin_unconfined_plugin_exec_t', $register = true, ) { $plugin_src = $ensure ? { -- cgit v1.2.3 From 29919e02a8b3f27d9d516be586e92704b806a48e Mon Sep 17 00:00:00 2001 From: antonio Date: Thu, 12 Jun 2014 00:41:18 +0200 Subject: changed host_name default to ::fqdn --- manifests/client.pp | 2 +- templates/munin-node.conf.erb | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/manifests/client.pp b/manifests/client.pp index 7a96233..724ff05 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -6,7 +6,7 @@ class munin::client( $allow = [ '127.0.0.1' ], $host = '*', - $host_name = '::fqdn', + $host_name = $::fqdn, $port = '4949', $use_ssh = false, $manage_shorewall = false, diff --git a/templates/munin-node.conf.erb b/templates/munin-node.conf.erb index 891203c..b0c8fc8 100644 --- a/templates/munin-node.conf.erb +++ b/templates/munin-node.conf.erb @@ -34,11 +34,7 @@ ignore_file \.pod$ # Set this if the client doesn't report the correct hostname when # telnetting to localhost, port 4949 # -<% if scope.lookupvar('munin::client::host_name') == '::fqdn' -%> -host_name <%= scope.lookupvar('::fqdn') %> -<% else -%> host_name <%= scope.lookupvar('munin::client::host_name') %> -<% end -%> # A list of addresses that are allowed to connect. This must be a # regular expression, since Net::Server does not understand CIDR-style -- cgit v1.2.3 From 88d197da8cedd5d711db043995f725ebe66b6ed6 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 13 Jun 2014 12:25:48 +0200 Subject: implement #38 - allow config to be an array --- manifests/plugin.pp | 4 ++-- spec/defines/munin_plugin_spec.rb | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/manifests/plugin.pp b/manifests/plugin.pp index ef82f90..37d0077 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -32,9 +32,9 @@ define munin::plugin ( seltype => 'munin_etc_t', } } - if $config != '' { + if !empty($config) { file { "/etc/munin/plugin-conf.d/${name}.conf": - content => "[${name}]\n${config}\n", + content => inline_template("[<%= @name %>]\n<%= Array(@config).join(\"\n\") %>\n"), owner => root, group => 0, mode => '0640', diff --git a/spec/defines/munin_plugin_spec.rb b/spec/defines/munin_plugin_spec.rb index 3d7e9e3..0e7306a 100644 --- a/spec/defines/munin_plugin_spec.rb +++ b/spec/defines/munin_plugin_spec.rb @@ -30,6 +30,23 @@ describe 'munin::plugin' do ) } end + context 'present and config as an array' do + let(:params) do + { :config => [ 'env.user root', 'env.group root' ] } + end + it { should contain_file('/etc/munin/plugins/users').with( + :ensure => 'link', + :target => '/usr/share/munin/plugins/users', + :notify => 'Service[munin-node]' + ) } + it { should contain_file('/etc/munin/plugin-conf.d/users.conf').with( + :content => "[users]\nenv.user root\nenv.group root\n", + :owner => 'root', + :group => 0, + :mode => '0640' + ) } + end + context 'absent' do let(:params) do { :ensure => 'absent' } -- cgit v1.2.3 From b4a5d72198df331e8cc62d309d14a989fa4c311c Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 13 Jun 2014 13:15:26 +0200 Subject: migrate tests to new format --- spec/classes/munin_client_base_spec.rb | 2 +- spec/classes/munin_client_spec.rb | 4 ++-- spec/classes/munin_host_cgi_spec.rb | 2 +- spec/classes/munin_host_spec.rb | 4 ++-- spec/classes/munin_plugins_interfaces_spec.rb | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/classes/munin_client_base_spec.rb b/spec/classes/munin_client_base_spec.rb index 2ddfdcc..fdf1403 100644 --- a/spec/classes/munin_client_base_spec.rb +++ b/spec/classes/munin_client_base_spec.rb @@ -17,7 +17,7 @@ describe 'munin::client::base' do end it 'should compile' do - should include_class('munin::client::base') + should contain_class('munin::client::base') end it 'should set up munin-node' do diff --git a/spec/classes/munin_client_spec.rb b/spec/classes/munin_client_spec.rb index 9a92cef..f7fc5e9 100644 --- a/spec/classes/munin_client_spec.rb +++ b/spec/classes/munin_client_spec.rb @@ -10,7 +10,7 @@ describe 'munin::client' do it { should contain_package('munin-node') } it { should contain_package('iproute') } it { should contain_file('/etc/munin/munin-node.conf') } - it { should include_class('munin::client::debian') } + it { should contain_class('munin::client::debian') } end shared_examples 'redhat-client' do |os, codename| @@ -44,7 +44,7 @@ describe 'munin::client' do }} it { should contain_package('munin-node') } it { should contain_file('/etc/munin/munin-node.conf') } - it { should include_class('munin::client::gentoo') } + it { should contain_class('munin::client::gentoo') } end end diff --git a/spec/classes/munin_host_cgi_spec.rb b/spec/classes/munin_host_cgi_spec.rb index 301f964..52c5c22 100644 --- a/spec/classes/munin_host_cgi_spec.rb +++ b/spec/classes/munin_host_cgi_spec.rb @@ -11,7 +11,7 @@ describe 'munin::host::cgi' do end it 'should compile' do - should include_class('munin::host::cgi') + should contain_class('munin::host::cgi') end it 'should exec set_modes_for_cgi' do diff --git a/spec/classes/munin_host_spec.rb b/spec/classes/munin_host_spec.rb index 461ced5..b707b5d 100644 --- a/spec/classes/munin_host_spec.rb +++ b/spec/classes/munin_host_spec.rb @@ -10,7 +10,7 @@ describe 'munin::host' do }} it { should contain_package('munin') } it { should contain_file('/etc/munin/munin.conf') } - it { should include_class('munin::host') } + it { should contain_class('munin::host') } end shared_examples 'redhat-host' do |os, codename| @@ -22,7 +22,7 @@ describe 'munin::host' do }} it { should contain_package('munin') } it { should contain_file('/etc/munin/munin.conf') } - it { should include_class('munin::host') } + it { should contain_class('munin::host') } end context 'on debian-like system' do diff --git a/spec/classes/munin_plugins_interfaces_spec.rb b/spec/classes/munin_plugins_interfaces_spec.rb index 95aa785..7e3c418 100644 --- a/spec/classes/munin_plugins_interfaces_spec.rb +++ b/spec/classes/munin_plugins_interfaces_spec.rb @@ -10,7 +10,7 @@ describe 'munin::plugins::interfaces' do end it 'should compile' do - should include_class('munin::plugins::interfaces') + should contain_class('munin::plugins::interfaces') end it 'should create plugins for each interface' do -- cgit v1.2.3 From 4b766cb0cbfd1bdb8099c650a20268ec331a6666 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 13 Jun 2014 13:56:38 +0200 Subject: ensure lower activesupport versions for RUBY 1.8.7 --- Gemfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Gemfile b/Gemfile index d5495b8..3c721f0 100644 --- a/Gemfile +++ b/Gemfile @@ -6,6 +6,7 @@ else puppetversion = ['>= 2.6'] end +gem 'activesupport', '~> 4.0' if RUBY_VERSION == '1.8.7' gem 'puppet', puppetversion gem 'puppet-lint', '>=0.3.2' gem 'puppetlabs_spec_helper', '>=0.2.0' -- cgit v1.2.3 From 39fe89683fac70469d707995eb04317e83dc456a Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 13 Jun 2014 15:14:26 +0200 Subject: 4.0 does not support <1.9 --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 3c721f0..9c5bad4 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ else puppetversion = ['>= 2.6'] end -gem 'activesupport', '~> 4.0' if RUBY_VERSION == '1.8.7' +gem 'activesupport', '~> 3.2' if RUBY_VERSION == '1.8.7' gem 'puppet', puppetversion gem 'puppet-lint', '>=0.3.2' gem 'puppetlabs_spec_helper', '>=0.2.0' -- cgit v1.2.3 From a12b6eaba350620fa1ad4cdcd4bd639a252a0f0e Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 13 Jun 2014 15:45:28 +0200 Subject: fixing deps for 1.8.7 --- Gemfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 9c5bad4..a6b52f0 100644 --- a/Gemfile +++ b/Gemfile @@ -6,12 +6,16 @@ else puppetversion = ['>= 2.6'] end -gem 'activesupport', '~> 3.2' if RUBY_VERSION == '1.8.7' +if RUBY_VERSION == '1.8.7' + gem 'activesupport', '~> 3.2' + gem 'librarian-puppet', '~> 1.0.0' +else + gem 'librarian-puppet', '>=0.9.10' +end gem 'puppet', puppetversion gem 'puppet-lint', '>=0.3.2' gem 'puppetlabs_spec_helper', '>=0.2.0' gem 'rake', '>=0.9.2.2' -gem 'librarian-puppet', '>=0.9.10' gem 'rspec-system-puppet', :require => false gem 'serverspec', :require => false gem 'rspec-system-serverspec', :require => false -- cgit v1.2.3 From 3cf822dfee3e56e2461c2a5d96dca448c008cd34 Mon Sep 17 00:00:00 2001 From: Daniel Jakob Date: Sat, 28 Jun 2014 12:02:08 +0200 Subject: Rename the package to avoid naming conflicts --- manifests/client/gentoo.pp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/manifests/client/gentoo.pp b/manifests/client/gentoo.pp index fde592f..263fecd 100644 --- a/manifests/client/gentoo.pp +++ b/manifests/client/gentoo.pp @@ -2,8 +2,7 @@ class munin::client::gentoo inherits munin::client::base { Package['munin-node'] { - name => 'munin', - category => 'net-analyzer', + name => 'net-analyzer/munin', } include munin::plugins::gentoo -- cgit v1.2.3 From 85df9f966b9b0135723c5af72cedf4049d6996b9 Mon Sep 17 00:00:00 2001 From: Daniel Jakob Date: Sat, 28 Jun 2014 12:02:45 +0200 Subject: Add gentoo config header --- files/config/host/munin.conf.header.Gentoo | 145 +++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 files/config/host/munin.conf.header.Gentoo diff --git a/files/config/host/munin.conf.header.Gentoo b/files/config/host/munin.conf.header.Gentoo new file mode 100644 index 0000000..d2523df --- /dev/null +++ b/files/config/host/munin.conf.header.Gentoo @@ -0,0 +1,145 @@ +# Example configuration file for Munin, generated by 'make build' + +# The next three variables specifies where the location of the RRD +# databases, the HTML output, logs and the lock/pid files. They all +# must be writable by the user running munin-cron. They are all +# defaulted to the values you see here. +# +#dbdir /var/lib/munin +#htmldir /var/www/localhost/htdocs/munin +#logdir /var/log/munin +#rundir /run/munin + +# Where to look for the HTML templates +# +#tmpldir /etc/munin/templates + +# Where to look for the static www files +# +#staticdir /etc/munin/static + +# temporary cgi files are here. note that it has to be writable by +# the cgi user (usually nobody or httpd). +# +# cgitmpdir @@CGITMPDIR@@ + +# (Exactly one) directory to include all files from. +includedir /etc/munin/munin-conf.d + +# You can choose the time reference for "DERIVE" like graphs, and show +# "per minute", "per hour" values instead of the default "per second" +# +#graph_period second + +# Graphics files are generated either via cron or by a CGI process. +# See http://munin-monitoring.org/wiki/CgiHowto2 for more +# documentation. +# Since 2.0, munin-graph has been rewritten to use the cgi code. +# It is single threaded *by design* now. +# +#graph_strategy cron + +# munin-cgi-graph is invoked by the web server up to very many times at the +# same time. This is not optimal since it results in high CPU and memory +# consumption to the degree that the system can thrash. Again the default is +# 6. Most likely the optimal number for max_cgi_graph_jobs is the same as +# max_graph_jobs. +# +#munin_cgi_graph_jobs 6 + +# If the automatic CGI url is wrong for your system override it here: +# +#cgiurl_graph /munin-cgi/munin-cgi-graph + +# max_size_x and max_size_y are the max size of images in pixel. +# Default is 4000. Do not make it too large otherwise RRD might use all +# RAM to generate the images. +# +#max_size_x 4000 +#max_size_y 4000 + +# HTML files are normally generated by munin-html, no matter if the +# files are used or not. You can change this to on-demand generation +# by following the instructions in http://munin-monitoring.org/wiki/CgiHowto2 +# +# Notes: +# - moving to CGI for HTML means you cannot have graph generated by cron. +# - cgi html has some bugs, mostly you still have to launch munin-html by hand +# +#html_strategy cron + +# munin-update runs in parallel. +# +# The default max number of processes is 16, and is probably ok for you. +# +# If set too high, it might hit some process/ram/filedesc limits. +# If set too low, munin-update might take more than 5 min. +# +# If you want munin-update to not be parallel set it to 0. +# +#max_processes 16 + +# RRD updates are per default, performed directly on the rrd files. +# To reduce IO and enable the use of the rrdcached, uncomment it and set it to +# the location of the socket that rrdcached uses. +# +#rrdcached_socket /var/run/rrdcached.sock + +# Drop somejuser@fnord.comm and anotheruser@blibb.comm an email everytime +# something changes (OK -> WARNING, CRITICAL -> OK, etc) +#contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm +#contact.anotheruser.command mail -s "Munin notification" anotheruser@blibb.comm +# +# For those with Nagios, the following might come in handy. In addition, +# the services must be defined in the Nagios server as well. +#contact.nagios.command /usr/bin/send_nsca nagios.host.comm -c /etc/nsca.conf + +# a simple host tree +#[localhost] +# address 127.0.0.1 +# use_node_name yes + +# +# A more complex example of a host tree +# +## First our "normal" host. +# [fii.foo.com] +# address foo +# +## Then our other host... +# [fay.foo.com] +# address fay +# +## IPv6 host. note that the ip adress has to be in brackets +# [ip6.foo.com] +# address [2001::1234:1] +# +## Then we want totals... +# [foo.com;Totals] #Force it into the "foo.com"-domain... +# update no # Turn off data-fetching for this "host". +# +# # The graph "load1". We want to see the loads of both machines... +# # "fii=fii.foo.com:load.load" means "label=machine:graph.field" +# load1.graph_title Loads side by side +# load1.graph_order fii=fii.foo.com:load.load fay=fay.foo.com:load.load +# +# # The graph "load2". Now we want them stacked on top of each other. +# load2.graph_title Loads on top of each other +# load2.dummy_field.stack fii=fii.foo.com:load.load fay=fay.foo.com:load.load +# load2.dummy_field.draw AREA # We want area instead the default LINE2. +# load2.dummy_field.label dummy # This is needed. Silly, really. +# +# # The graph "load3". Now we want them summarised into one field +# load3.graph_title Loads summarised +# load3.combined_loads.sum fii.foo.com:load.load fay.foo.com:load.load +# load3.combined_loads.label Combined loads # Must be set, as this is +# # not a dummy field! +# +## ...and on a side note, I want them listen in another order (default is +## alphabetically) +# +# # Since [foo.com] would be interpreted as a host in the domain "com", we +# # specify that this is a domain by adding a semicolon. +# [foo.com;] +# node_order Totals fii.foo.com fay.foo.com +# -- cgit v1.2.3 From 90796d31dd9ab7e4f183f99d0fe7237a7f42ddfc Mon Sep 17 00:00:00 2001 From: Daniel Jakob Date: Sat, 28 Jun 2014 12:02:52 +0200 Subject: Add some simple gentoo specific tests --- spec/classes/munin_host_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/classes/munin_host_spec.rb b/spec/classes/munin_host_spec.rb index b707b5d..df002ce 100644 --- a/spec/classes/munin_host_spec.rb +++ b/spec/classes/munin_host_spec.rb @@ -34,4 +34,14 @@ describe 'munin::host' do context 'on redhat-like system' do it_behaves_like 'redhat-host', 'CentOS', '6' end + + context 'on Gentoo' do + let(:facts) {{ + :osfamily => 'Gentoo', + :concat_basedir => '/var/lib/puppet/concat', + }} + it { should contain_package('munin') } + it { should contain_file('/etc/munin/munin.conf') } + it { should contain_class('munin::host') } + end end -- cgit v1.2.3 From 39eb7ac31ad7f1fc16c37c42823fb1860c1f09ba Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 9 Jul 2014 23:12:27 +0200 Subject: get rid off lsb facts - who runs sarge? --- manifests/client/debian.pp | 9 --------- manifests/host.pp | 4 ++-- manifests/plugin.pp | 2 +- manifests/plugin/deploy.pp | 2 +- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/manifests/client/debian.pp b/manifests/client/debian.pp index f1bbb3c..49ee567 100644 --- a/manifests/client/debian.pp +++ b/manifests/client/debian.pp @@ -3,15 +3,6 @@ class munin::client::debian inherits munin::client::base { # the plugin will need that ensure_packages(['iproute']) - $hasstatus = $::lsbdistcodename ? { - sarge => false, - default => true - } - - Service['munin-node']{ - # sarge's munin-node init script has no status - hasstatus => $hasstatus - } # workaround bug in munin_node_configure plugin { 'postfix_mailvolume': ensure => absent } include munin::plugins::debian diff --git a/manifests/host.pp b/manifests/host.pp index e666c3d..55e28bf 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -15,10 +15,10 @@ class munin::host( concat::fragment{'munin.conf.header': target => '/etc/munin/munin.conf', source => [ "puppet:///modules/site_munin/config/host/${::fqdn}/munin.conf.header", - "puppet:///modules/site_munin/config/host/munin.conf.header.${::operatingsystem}.${::lsbdistcodename}", + "puppet:///modules/site_munin/config/host/munin.conf.header.${::operatingsystem}.${::operatingsystemmajrelease}", "puppet:///modules/site_munin/config/host/munin.conf.header.${::operatingsystem}", 'puppet:///modules/site_munin/config/host/munin.conf.header', - "puppet:///modules/munin/config/host/munin.conf.header.${::operatingsystem}.${::lsbdistcodename}", + "puppet:///modules/munin/config/host/munin.conf.header.${::operatingsystem}.${::operatingsystemmajrelease}", "puppet:///modules/munin/config/host/munin.conf.header.${::operatingsystem}", 'puppet:///modules/munin/config/host/munin.conf.header' ], order => 05, diff --git a/manifests/plugin.pp b/manifests/plugin.pp index 37d0077..50b861b 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -27,7 +27,7 @@ define munin::plugin ( target =>"${real_script_path}/${plugin_src}", notify => Service['munin-node']; } - if (str2bool($::selinux) == true) and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease != '5')){ + if (str2bool($::selinux) == true) and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::operatingsystemmajrelease != '5')){ File["/etc/munin/plugins/${name}"]{ seltype => 'munin_etc_t', } diff --git a/manifests/plugin/deploy.pp b/manifests/plugin/deploy.pp index 461a218..2ffd92e 100644 --- a/manifests/plugin/deploy.pp +++ b/manifests/plugin/deploy.pp @@ -24,7 +24,7 @@ define munin::plugin::deploy( mode => '0755'; } - if (str2bool($::selinux) == true) and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::lsbmajdistrelease > '5')){ + if (str2bool($::selinux) == true) and (($::operatingsystem != 'CentOS') or ($::operatingsystem == 'CentOS' and $::operatingsystemmajrelease > '5')){ File["munin_plugin_${name}"]{ seltype => $seltype, } -- cgit v1.2.3 From 37fef292f1c61cb5ca20b60d625310f3150175b0 Mon Sep 17 00:00:00 2001 From: Jasper Lievisse Adriaanse Date: Wed, 13 Aug 2014 10:18:04 +0200 Subject: Bump concat dependency to get rid of deprecation warning when including concat::setup --- Modulefile | 2 +- manifests/host.pp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Modulefile b/Modulefile index d36804a..a9b5030 100644 --- a/Modulefile +++ b/Modulefile @@ -9,6 +9,6 @@ project_page 'https://github.com/duritong/puppet-munin' ## Add dependencies, if any: # dependency 'username/name', '>= 1.2.0' -dependency 'puppetlabs/concat', '>= 1.0.0' +dependency 'puppetlabs/concat', '>= 1.1.0' dependency 'puppetlabs/stdlib', '>= 3.2.0' dependency 'duritong/openbsd', '>= 0.0.1' diff --git a/manifests/host.pp b/manifests/host.pp index e666c3d..70d7116 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -8,7 +8,6 @@ class munin::host( $export_tag = 'munin' ) { package {'munin': ensure => installed, } - include concat::setup Concat::Fragment <<| tag == $export_tag |>> -- cgit v1.2.3 From 77bc6cefe5a4781cb9b7eae13d607348d3352cdd Mon Sep 17 00:00:00 2001 From: Jasper Lievisse Adriaanse Date: Wed, 13 Aug 2014 10:31:26 +0200 Subject: Fix an error on system without full UTF-8: invalid byte sequence in US-ASCII --- manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index b015521..54b489b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -4,7 +4,7 @@ # Copyright (C) 2007 David Schmitt # # Copyright 2008, Puzzle ITC GmbH -# Marcel Härry haerry+puppet(at)puzzle.ch +# Marcel Haerry haerry+puppet(at)puzzle.ch # Simon Josi josi+puppet(at)puzzle.ch # # This program is free software; you can redistribute -- cgit v1.2.3 From 145f35c188b088890049557be6f203272f0d266c Mon Sep 17 00:00:00 2001 From: Jasper Lievisse Adriaanse Date: Wed, 13 Aug 2014 10:34:21 +0200 Subject: Unbreak registring snmp hosts; Exec{} needs a path --- manifests/register/snmp.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index 06bb00b..1c375ec 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -12,6 +12,7 @@ define munin::register::snmp ( exec { "munin_register_snmp_${fhost}": command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --shell | sh", unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null", + path => ['/bin','/sbin','/usr/bin','/usr/sbin','/usr/local/bin','/usr/local/sbin'], } @@concat::fragment{ "munin_snmp_${fhost}": -- cgit v1.2.3 From 68e5a30c917a9275868e609fe986e6424ab1c1eb Mon Sep 17 00:00:00 2001 From: Jasper Lievisse Adriaanse Date: Wed, 13 Aug 2014 10:35:18 +0200 Subject: Unbreak registering new snmp nodes into munin.conf As $group would be undefined, a ';' would be written into the host definition which in turn causes munin to be unable to parse the file. --- manifests/register/snmp.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index 1c375ec..5fab221 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -3,7 +3,8 @@ define munin::register::snmp ( $community = 'public', $description = 'absent', $port = '4949', - $host = $::fqdn + $host = $::fqdn, + $group = 'absent', ) { $fhost = $name $client_type = 'snmp' -- cgit v1.2.3 From 5d5a542c58fc6218af6d210cf9f454da54622d1e Mon Sep 17 00:00:00 2001 From: Jasper Lievisse Adriaanse Date: Wed, 13 Aug 2014 10:38:14 +0200 Subject: spacing --- manifests/register/snmp.pp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index 5fab221..f84785a 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -1,10 +1,10 @@ # Register a munin node with snmp enabled define munin::register::snmp ( - $community = 'public', + $community = 'public', $description = 'absent', - $port = '4949', - $host = $::fqdn, - $group = 'absent', + $port = '4949', + $host = $::fqdn, + $group = 'absent', ) { $fhost = $name $client_type = 'snmp' -- cgit v1.2.3 From c39907a4b3acb1413a290b78b3dd3b49b898e210 Mon Sep 17 00:00:00 2001 From: Jasper Lievisse Adriaanse Date: Wed, 13 Aug 2014 10:40:45 +0200 Subject: Use cron resource instead of a cron.d file --- manifests/host.pp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/manifests/host.pp b/manifests/host.pp index e666c3d..f231691 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -39,12 +39,12 @@ class munin::host( } # from time to time we cleanup hanging munin-runs - file{'/etc/cron.d/munin_kill': - content => "4,34 * * * * root if $(ps ax | grep -v grep | grep -q munin-run); then killall munin-run; fi\n", - owner => root, - group => 0, - mode => '0644', + cron { 'munin_kill': + command => 'if $(ps ax | grep -v grep | grep -q munin-run); then killall munin-run; fi', + minute => ['4', '34'], + user => 'root', } + if $munin::host::manage_shorewall { include shorewall::rules::out::munin } -- cgit v1.2.3 From 043502d650e76ea604ef4f2e23ce2f0112f5706f Mon Sep 17 00:00:00 2001 From: Jasper Lievisse Adriaanse Date: Wed, 13 Aug 2014 22:42:47 +0200 Subject: Allow setting an snmpversion for plugin discovery --- manifests/register/snmp.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index f84785a..d3761ae 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -5,13 +5,14 @@ define munin::register::snmp ( $port = '4949', $host = $::fqdn, $group = 'absent', + $version = '2', ) { $fhost = $name $client_type = 'snmp' $config = [ 'use_node_name no' ] exec { "munin_register_snmp_${fhost}": - command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --shell | sh", + command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --snmpversion ${version} --shell | sh", unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null", path => ['/bin','/sbin','/usr/bin','/usr/sbin','/usr/local/bin','/usr/local/sbin'], } -- cgit v1.2.3 From d9333f5bba1c164f2fc9eae3a6b16e831ac0ed72 Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Tue, 2 Sep 2014 08:02:33 +0200 Subject: Add support for RHEL --- files/config/host/munin.conf.header.RedHat | 143 +++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 files/config/host/munin.conf.header.RedHat diff --git a/files/config/host/munin.conf.header.RedHat b/files/config/host/munin.conf.header.RedHat new file mode 100644 index 0000000..f212ce0 --- /dev/null +++ b/files/config/host/munin.conf.header.RedHat @@ -0,0 +1,143 @@ +# Example configuration file for Munin, generated by 'make build' + +# The next three variables specifies where the location of the RRD +# databases, the HTML output, logs and the lock/pid files. They all +# must be writable by the user running munin-cron. They are all +# defaulted to the values you see here. +# +#dbdir /var/lib/munin +#htmldir /var/www/html/munin +htmldir /var/www/html/munin +#logdir /var/log/munin +#rundir /var/run/munin + +# Where to look for the HTML templates +# +#tmpldir /etc/munin/templates + +# Where to look for the static www files +# +#staticdir /etc/munin/static + +# temporary cgi files are here. note that it has to be writable by +# the cgi user (usually nobody or httpd). +# +# cgitmpdir /var/lib/munin/cgi-tmp + +# (Exactly one) directory to include all files from. +includedir /etc/munin/conf.d + +# You can choose the time reference for "DERIVE" like graphs, and show +# "per minute", "per hour" values instead of the default "per second" +# +#graph_period second + +# Graphics files are generated either via cron or by a CGI process. +# See http://munin-monitoring.org/wiki/CgiHowto2 for more +# documentation. +# Since 2.0, munin-graph has been rewritten to use the cgi code. +# It is single threaded *by design* now. +# +#graph_strategy cgi + +# munin-cgi-graph is invoked by the web server up to very many times at the +# same time. This is not optimal since it results in high CPU and memory +# consumption to the degree that the system can thrash. Again the default is +# 6. Most likely the optimal number for max_cgi_graph_jobs is the same as +# max_graph_jobs. +# +#munin_cgi_graph_jobs 6 + +# If the automatic CGI url is wrong for your system override it here: +# +#cgiurl_graph /munin-cgi/munin-cgi-graph + +# max_size_x and max_size_y are the max size of images in pixel. +# Default is 4000. Do not make it too large otherwise RRD might use all +# RAM to generate the images. +# +#max_size_x 4000 +#max_size_y 4000 + +# HTML files are normally generated by munin-html, no matter if the +# files are used or not. You can change this to on-demand generation +# by following the instructions in http://munin-monitoring.org/wiki/CgiHowto2 +# +# Notes: +# - moving to CGI for HTML means you cannot have graph generated by cron. +# - cgi html has some bugs, mostly you still have to launch munin-html by hand +# +html_strategy cron + +# munin-update runs in parallel. +# +# The default max number of processes is 16, and is probably ok for you. +# +# If set too high, it might hit some process/ram/filedesc limits. +# If set too low, munin-update might take more than 5 min. +# +# If you want munin-update to not be parallel set it to 0. +# +#max_processes 16 + +# RRD updates are per default, performed directly on the rrd files. +# To reduce IO and enable the use of the rrdcached, uncomment it and set it to +# the location of the socket that rrdcached uses. +# +#rrdcached_socket /var/run/rrdcached.sock + +# Drop somejuser@fnord.comm and anotheruser@blibb.comm an email everytime +# something changes (OK -> WARNING, CRITICAL -> OK, etc) +#contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm +#contact.anotheruser.command mail -s "Munin notification" anotheruser@blibb.comm +# +# For those with Nagios, the following might come in handy. In addition, +# the services must be defined in the Nagios server as well. +#contact.nagios.command /usr/bin/send_nsca nagios.host.comm -c /etc/nsca.conf + +# a simple host tree +#[localhost] +# address 127.0.0.1 +# use_node_name yes + +# +# A more complex example of a host tree +# +## First our "normal" host. +# [fii.foo.com] +# address foo +# +## Then our other host... +# [fay.foo.com] +# address fay +# +## Then we want totals... +# [foo.com;Totals] #Force it into the "foo.com"-domain... +# update no # Turn off data-fetching for this "host". +# +# # The graph "load1". We want to see the loads of both machines... +# # "fii=fii.foo.com:load.load" means "label=machine:graph.field" +# load1.graph_title Loads side by side +# load1.graph_order fii=fii.foo.com:load.load fay=fay.foo.com:load.load +# +# # The graph "load2". Now we want them stacked on top of each other. +# load2.graph_title Loads on top of each other +# load2.dummy_field.stack fii=fii.foo.com:load.load fay=fay.foo.com:load.load +# load2.dummy_field.draw AREA # We want area instead the default LINE2. +# load2.dummy_field.label dummy # This is needed. Silly, really. +# +# # The graph "load3". Now we want them summarised into one field +# load3.graph_title Loads summarised +# load3.combined_loads.sum fii.foo.com:load.load fay.foo.com:load.load +# load3.combined_loads.label Combined loads # Must be set, as this is +# # not a dummy field! +# +## ...and on a side note, I want them listen in another order (default is +## alphabetically) +# +# # Since [foo.com] would be interpreted as a host in the domain "com", we +# # specify that this is a domain by adding a semicolon. +# [foo.com;] +# node_order Totals fii.foo.com fay.foo.com +# + -- cgit v1.2.3 From 3b113bd7f8be9f766f5a15933ff5574f6b124163 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 13 Sep 2014 05:17:52 +0200 Subject: Revert "Unbreak registring snmp hosts; Exec{} needs a path" http://www.puppetcookbook.com/posts/set-global-exec-path.html This reverts commit 145f35c188b088890049557be6f203272f0d266c. --- manifests/register/snmp.pp | 1 - 1 file changed, 1 deletion(-) diff --git a/manifests/register/snmp.pp b/manifests/register/snmp.pp index d3761ae..8d7ea56 100644 --- a/manifests/register/snmp.pp +++ b/manifests/register/snmp.pp @@ -14,7 +14,6 @@ define munin::register::snmp ( exec { "munin_register_snmp_${fhost}": command => "munin-node-configure --snmp ${fhost} --snmpcommunity ${community} --snmpversion ${version} --shell | sh", unless => "ls /etc/munin/plugins/snmp_${fhost}_* &> /dev/null", - path => ['/bin','/sbin','/usr/bin','/usr/sbin','/usr/local/bin','/usr/local/sbin'], } @@concat::fragment{ "munin_snmp_${fhost}": -- cgit v1.2.3 From 0b327e4d3c26e77849fe8abdcc560f950ad7c746 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 13 Sep 2014 14:54:21 +0200 Subject: new release 0.0.4 and porting over to metadata.json --- Modulefile | 14 -------------- metadata.json | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 14 deletions(-) delete mode 100644 Modulefile create mode 100644 metadata.json diff --git a/Modulefile b/Modulefile deleted file mode 100644 index a9b5030..0000000 --- a/Modulefile +++ /dev/null @@ -1,14 +0,0 @@ -name 'duritong-munin' -version '0.0.3' -source 'git://github.com/duritong/puppet-munin.git' -author 'duritong' -license 'Apache License, Version 2.0' -summary 'Puppet module for Munin monitoring' -description 'Munin is a performance monitoring system which creates nice RRD graphs and has a very easy plugin interface' -project_page 'https://github.com/duritong/puppet-munin' - -## Add dependencies, if any: -# dependency 'username/name', '>= 1.2.0' -dependency 'puppetlabs/concat', '>= 1.1.0' -dependency 'puppetlabs/stdlib', '>= 3.2.0' -dependency 'duritong/openbsd', '>= 0.0.1' diff --git a/metadata.json b/metadata.json new file mode 100644 index 0000000..f761002 --- /dev/null +++ b/metadata.json @@ -0,0 +1,16 @@ +{ + "name": "duritong-munin", + "version": "0.0.4", + "author": "duritong", + "summary": "Puppet module for Munin monitoring", + "license": "Apache License, Version 2.0", + "source": "git://github.com/duritong/puppet-munin.git", + "project_page": "https://github.com/duritong/puppet-munin", + "issues_url": "https://github.com/duritong/puppet-munin/issues", + "description": "Munin is a performance monitoring system which creates nice RRD graphs and has a very easy plugin interface", + "dependencies": [ + {"name":"puppetlabs/concat","version_requirement":">= 1.1.0"}, + {"name":"puppetlabs/stdlib","version_requirement":">= 3.2.0"}, + {"name":"duritong/openbsd","version_requirement":">= 0.0.1"} + ] +} -- cgit v1.2.3 From 3b1623f00f301e50e2b074bf601af7824d1a530d Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 10 Oct 2014 11:46:00 +0200 Subject: update to v3 api --- Puppetfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Puppetfile b/Puppetfile index b8b183b..3e03b30 100644 --- a/Puppetfile +++ b/Puppetfile @@ -1,4 +1,4 @@ -forge 'http://forge.puppetlabs.com' +forge 'https://forge.puppetlabs.com' mod 'puppetlabs/stdlib', '>=3.2.0' mod 'puppetlabs/concat', '>=1.0.0' -- cgit v1.2.3 From 27c9a5dbc2083dcc20d059008702dd3f75382bcc Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 10 Oct 2014 11:54:10 +0200 Subject: more linting and latest puppet-lint support --- Rakefile | 10 ++++++---- manifests/client/base.pp | 13 +++++++------ manifests/remoteplugin.pp | 6 +++++- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Rakefile b/Rakefile index e9e821a..f3c7f29 100644 --- a/Rakefile +++ b/Rakefile @@ -5,10 +5,12 @@ require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-lint/tasks/puppet-lint' require 'rspec-system/rake_task' -PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "vendor/**/*.pp"] -PuppetLint.configuration.log_format = '%{path}:%{linenumber}:%{KIND}: %{message}' -PuppetLint.configuration.send("disable_class_inherits_from_params_class") -PuppetLint.configuration.send("disable_80chars") +Rake::Task[:lint].clear +PuppetLint::RakeTask.new :lint do |config| + config.ignore_paths = ["spec/**/*.pp", "vendor/**/*.pp"] + config.log_format = '%{path}:%{linenumber}:%{KIND}: %{message}' + config.disable_checks = [ "class_inherits_from_params_class", "80chars" ] +end # use librarian-puppet to manage fixtures instead of .fixtures.yml # offers more possibilities like explicit version management, forge downloads,... diff --git a/manifests/client/base.pp b/manifests/client/base.pp index d35d742..6ed0f71 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -4,11 +4,11 @@ class munin::client::base inherits munin::client::params { ensure => installed } service { 'munin-node': - ensure => running, - enable => true, - hasstatus => true, - hasrestart => true, - require => Package[munin-node], + ensure => running, + enable => true, + hasstatus => true, + hasrestart => true, + require => Package[munin-node], } file {'/etc/munin': ensure => directory, @@ -36,7 +36,8 @@ class munin::client::base inherits munin::client::params { use_ssh => $munin::client::use_ssh, description => $munin::client::description, group => $munin::client::munin_group, - config => [ 'use_node_name yes', 'load.load.warning 5', 'load.load.critical 10'], + config => [ 'use_node_name yes', 'load.load.warning 5', + 'load.load.critical 10'], export_tag => $munin::client::export_tag, } include munin::plugins::base diff --git a/manifests/remoteplugin.pp b/manifests/remoteplugin.pp index a2abf69..dc03c76 100644 --- a/manifests/remoteplugin.pp +++ b/manifests/remoteplugin.pp @@ -1,5 +1,9 @@ # Configure a munin remote plugin -define munin::remoteplugin($ensure = 'present', $source, $config = '') { +define munin::remoteplugin( + $source, + $ensure = 'present', + $config = '' +) { case $ensure { 'absent': { munin::plugin{ $name: ensure => absent } } default: { -- cgit v1.2.3 From 7e03247a9e219fe8e57d544957eb06e305e69fc1 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Fri, 5 Dec 2014 20:07:47 +0000 Subject: Ignore vnet\d+ network interfaces, just like veth, virbr etc. --- manifests/plugins/interfaces.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp index da89ed0..c57e887 100644 --- a/manifests/plugins/interfaces.pp +++ b/manifests/plugins/interfaces.pp @@ -2,7 +2,7 @@ class munin::plugins::interfaces { # filter out many of the useless interfaces that show up - $real_ifs = reject(split($::interfaces, ' |,'), 'eth\d+_\d+|sit0|virbr\d+_nic|vif\d+_\d+|veth\d+|__tmp\d+') + $real_ifs = reject(split($::interfaces, ' |,'), 'eth\d+_\d+|sit0|virbr\d+_nic|vif\d+_\d+|veth\d+|vnet\d+|__tmp\d+') $ifs = regsubst($real_ifs, '(.+)', "if_\\1") munin::plugin { -- cgit v1.2.3 From acfaa47dbdb07805cb07eb72f552d0e9b03ba1c9 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Sat, 13 Dec 2014 11:21:09 -0500 Subject: create a single entry point to the module The current state of the module makes it impossible to install a munin server with munin::host, since it depends on resources in munin::client (because of the plugins it installs). Even if we include the munin::client class "just before" munin::host, puppet thinks there are dependency issues. By moving arguments to a single point of entry we can then include all necessary items and puppet will find the needed resources correctly. --- manifests/client.pp | 21 +++++---------------- manifests/client/base.pp | 14 +++++++------- manifests/host.pp | 13 +++++-------- manifests/init.pp | 38 ++++++++++++++++++++++++++++++++++++-- templates/munin-node.conf.erb | 8 ++++---- 5 files changed, 57 insertions(+), 37 deletions(-) diff --git a/manifests/client.pp b/manifests/client.pp index 724ff05..aca899a 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -3,18 +3,7 @@ # Adapted and improved by admin(at)immerda.ch # configure a munin node -class munin::client( - $allow = [ '127.0.0.1' ], - $host = '*', - $host_name = $::fqdn, - $port = '4949', - $use_ssh = false, - $manage_shorewall = false, - $shorewall_collector_source = 'net', - $export_tag = 'munin', - $description = 'absent', - $munin_group = 'absent', -) { +class munin::client { case $::operatingsystem { openbsd: { include munin::client::openbsd } @@ -24,11 +13,11 @@ class munin::client( centos: { include munin::client::base } default: { include munin::client::base } } - if $munin::client::manage_shorewall { + if $munin::manage_shorewall { class{'shorewall::rules::munin': - munin_port => $port, - munin_collector => delete($allow,'127.0.0.1'), - collector_source => $shorewall_collector_source, + munin_port => $munin::port, + munin_collector => delete($munin::allow,'127.0.0.1'), + collector_source => $munin::shorewall_collector_source, } } } diff --git a/manifests/client/base.pp b/manifests/client/base.pp index 6ed0f71..8ee8b95 100644 --- a/manifests/client/base.pp +++ b/manifests/client/base.pp @@ -26,19 +26,19 @@ class munin::client::base inherits munin::client::params { owner => root, group => 0, } - $host = $munin::client::host ? { + $host = $munin::host ? { '*' => $::fqdn, - default => $munin::client::host + default => $munin::host } munin::register { $::fqdn: host => $host, - port => $munin::client::port, - use_ssh => $munin::client::use_ssh, - description => $munin::client::description, - group => $munin::client::munin_group, + 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::client::export_tag, + export_tag => $munin::export_tag, } include munin::plugins::base } diff --git a/manifests/host.pp b/manifests/host.pp index 0e5fb01..9831052 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -2,11 +2,8 @@ # Copyright (C) 2007 David Schmitt # See LICENSE for the full license granted to you. -class munin::host( - $cgi_graphing = false, - $cgi_owner = 'os_default', - $export_tag = 'munin' -) { +class munin::host { + package {'munin': ensure => installed, } Concat::Fragment <<| tag == $export_tag |>> @@ -31,9 +28,9 @@ class munin::host( include munin::plugins::muninhost - if $munin::host::cgi_graphing { + if $munin::cgi_graphing { class {'munin::host::cgi': - owner => $cgi_owner, + owner => $munin::cgi_owner, } } @@ -44,7 +41,7 @@ class munin::host( user => 'root', } - if $munin::host::manage_shorewall { + if $munin::manage_shorewall { include shorewall::rules::out::munin } } diff --git a/manifests/init.pp b/manifests/init.pp index 54b489b..bbabf2e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -12,5 +12,39 @@ # General Public License version 3 as published by # the Free Software Foundation. # -# the port is a parameter so vservers can share -# IP addresses and still be happy +# Parameters: +# $is_server - determines whether or not to install munin server. munin-node is +# required for the server so it is always installed. +# $export_tag - tag exported resources so that only the server targeted by that +# tag will collect them. This can let you install multiple munin +# servers. +# +# Client-specific parameters: +# $allow, $host, $host_name, $port, $use_ssh, $manage_shorewall, +# $shorewall_collector_source, $description, $munin_group +# +# Server-specific parameters: +# $cgi_graphing, cgi_owner + +class munin ( + $is_server = false, + $export_tag = 'munin', + $allow = [ '127.0.0.1' ], + $host = '*', + $host_name = $::fqdn, + $port = '4949', + $use_ssh = false, + $manage_shorewall = false, + $shorewall_collector_source = 'net', + $description = 'absent', + $munin_group = 'absent', + $cgi_graphing = false, + $cgi_owner = 'os_default', +) { + + include munin::client + + if $is_server { + include munin::host + } +} diff --git a/templates/munin-node.conf.erb b/templates/munin-node.conf.erb index b0c8fc8..f51a665 100644 --- a/templates/munin-node.conf.erb +++ b/templates/munin-node.conf.erb @@ -34,13 +34,13 @@ ignore_file \.pod$ # Set this if the client doesn't report the correct hostname when # telnetting to localhost, port 4949 # -host_name <%= scope.lookupvar('munin::client::host_name') %> +host_name <%= scope.lookupvar('munin::host_name') %> # A list of addresses that are allowed to connect. This must be a # regular expression, since Net::Server does not understand CIDR-style # network notation unless the perl module Net::CIDR is installed. You # may repeat the allow line as many times as you'd like -<% scope.lookupvar('munin::client::allow').each do |allow| -%> +<% scope.lookupvar('munin::allow').each do |allow| -%> allow <%= "^#{Regexp.escape(allow)}$" %> <% end -%> @@ -56,7 +56,7 @@ allow <%= "^#{Regexp.escape(allow)}$" %> # cidr_deny 192.0.2.42/32 # Which address to bind to; -host <%= scope.lookupvar('munin::client::host') %> +host <%= scope.lookupvar('munin::host') %> # And which port -port <%= scope.lookupvar('munin::client::port') %> +port <%= scope.lookupvar('munin::port') %> -- cgit v1.2.3 From eaa092eb1a8f3ae19551e6e80f84d174211b5208 Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Sat, 13 Dec 2014 11:49:14 -0500 Subject: update readme to use the new "main" class --- README.md | 53 +++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 9c5474f..db6af95 100644 --- a/README.md +++ b/README.md @@ -28,27 +28,25 @@ Your modules directory will need all the files included in this repository place ### Master configuration -In the node definition in your site.pp for your main munin host, add the following: +To install a master (or server) you need to flip one argument to true in the main class: - class { 'munin::host': } + class { 'munin': is_server => true } If you want cgi graphing you can pass `cgi_graphing => true`. (For CentOS this is enabled in the default header config) for more information, see: http://munin.projects.linpro.no/wiki/CgiHowto ### Client configuration -For every host you wish to gather munin statistics, add the class `munin::client` to that +For every host you wish to gather munin statistics, add the class `munin` to that node. You will want to set the class parameter `allow` to be the IP(s) of the munin collector, this defines what IP is permitted to connect to the node, for example: node foo { - class { 'munin::client': allow => '192.168.0.1'} + class { 'munin': allow => '192.168.0.1'} } -for multiple munin nodes, you can pass an array: +for multiple munin collectors, you can pass an array: - class { 'munin::client': allow => [ '192.168.0.1', '10.0.0.1' ] } - - 3. In the node definition in your site.pp for your main munin host, add the following: + class { 'munin': allow => [ '192.168.0.1', '10.0.0.1' ] } ### Local plugins @@ -98,10 +96,45 @@ Module path is specified in `puppet.conf`, you can find out your `{modulepath}` in console `puppet config print modulepath`. -### Multiple munin instances +### Multiple munin collectors + +If some part of your infrastructure should be graphed by one munin collector, +and another part by a second collector, you can use the parameter $export_tag +to the main class to differentiate which clients and collectors are associated. + +For example, here are four nodes: two collectors and two clients. Each +collector is associated with one client: + + node coll1 { + class { 'munin': + $is_server => true, + $export_tag => 'coll1', + } + } + + node client1 { + class { 'munin': + $export_tag => 'coll1', + } + } + + node coll2 { + class { 'munin': + $is_server => true, + $export_tag => 'coll2', + } + } + + node client2 { + class { 'munin': + $export_tag => 'coll2', + } + } + +### Multiple munin-node instances with Linux-VServer If you have Linux-Vservers configured, you will likely have multiple munin-node processes competing for the default port 4949, for those nodes, set an alternate port for munin-node to run on by putting something similar to the following class parameter: - class { 'munin::client': allow => '192.168.0.1', port => '4948' } + class { 'munin': allow => '192.168.0.1', port => '4948' } -- cgit v1.2.3 From 64e309214b30502e853f1017cf3f4b12886d02c9 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Thu, 12 Feb 2015 18:58:17 +0000 Subject: Remove munin::client::darwin (Closes: #4347). It's using `line', and then it's the only blocker left to migrate to the cleaned up "common" module. We've found nobody who could maintain it nor test changes we could make, so better simply drop it. --- manifests/client.pp | 1 - manifests/client/darwin.pp | 23 ----------------------- 2 files changed, 24 deletions(-) delete mode 100644 manifests/client/darwin.pp diff --git a/manifests/client.pp b/manifests/client.pp index aca899a..f71d946 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -7,7 +7,6 @@ class munin::client { case $::operatingsystem { openbsd: { include munin::client::openbsd } - darwin: { include munin::client::darwin } debian,ubuntu: { include munin::client::debian } gentoo: { include munin::client::gentoo } centos: { include munin::client::base } diff --git a/manifests/client/darwin.pp b/manifests/client/darwin.pp deleted file mode 100644 index 7639896..0000000 --- a/manifests/client/darwin.pp +++ /dev/null @@ -1,23 +0,0 @@ -# Install a munin client on darwin -class munin::client::darwin { - file { '/usr/share/snmp/snmpd.conf': - mode => '0744', - content => template('munin/darwin_snmpd.conf.erb'), - group => 0, - owner => root, - } - line{'startsnmpdno': - ensure => absent, - file => '/etc/hostconfig', - line => 'SNMPSERVER=-NO-', - } - 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: } -} -- cgit v1.2.3 From 6d7494bfe90819273bb6343911f410071b5561a8 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Tue, 24 Feb 2015 11:25:56 -0500 Subject: Add class parameter to allow customisation of if plugin filter --- manifests/init.pp | 1 + manifests/plugins/interfaces.pp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index bbabf2e..367ba8f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -40,6 +40,7 @@ class munin ( $munin_group = 'absent', $cgi_graphing = false, $cgi_owner = 'os_default', + $if_filter = 'eth\d+_\d+|sit0|virbr\d+_nic|vif\d+_\d+|veth\d+|vnet\d+|__tmp\d+', ) { include munin::client diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp index 35b41fd..2bbc1c6 100644 --- a/manifests/plugins/interfaces.pp +++ b/manifests/plugins/interfaces.pp @@ -2,7 +2,7 @@ class munin::plugins::interfaces { # filter out many of the useless interfaces that show up - $real_ifs = reject(split($::interfaces, ' |,'), 'eth\d+_\d+|sit0|virbr\d+_nic|vif\d+_\d+|veth\d+|vnet\d+|__tmp\d+') + $real_ifs = reject(split($::interfaces, ' |,'), $munin::if_filter) $ifs = prefix($real_ifs, 'if_') $if_err_plugin = $::operatingsystem ? { -- cgit v1.2.3 From ca6462c6dc48dcb1af64cefe35c2cf8902f8cc30 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Fri, 17 Apr 2015 11:35:16 -0400 Subject: Add GPLv3 license --- LICENSE | 674 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 674 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. -- cgit v1.2.3 From 633b8083d23011668735823dff4c5af2d491aa0c Mon Sep 17 00:00:00 2001 From: Gabriel Filion Date: Fri, 14 Aug 2015 05:01:32 -0400 Subject: Add an upgrade notice about using the main class The module's behaviour was changed from needing to include two different classes to using only the main class (class munin) directly. However, this change was not documented and it could lead to weird errors related to variables being undefined. --- README.md | 8 ++++++++ manifests/client.pp | 1 + manifests/host.pp | 1 + 3 files changed, 10 insertions(+) diff --git a/README.md b/README.md index db6af95..68c3c55 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,14 @@ a very easy plugin interface. The munin homepage is http://munin.projects.linpro Your modules directory will need all the files included in this repository placed under a directory called `munin`. +### Upgrade notices + +Users of the module who are upgrading from a older version of the module might be interested in these important changes: + + * The `munin::client` and `munin::host` classes should not be included + directly anymore. Instead, the main class should be used for both client and + server (server should have the `$is_server` parameter set to true). + ### Master configuration To install a master (or server) you need to flip one argument to true in the main class: diff --git a/manifests/client.pp b/manifests/client.pp index f71d946..afab5f1 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -3,6 +3,7 @@ # Adapted and improved by admin(at)immerda.ch # configure a munin node +# WARNING: this class should not be included directly. See the 'munin' class. class munin::client { case $::operatingsystem { diff --git a/manifests/host.pp b/manifests/host.pp index 9831052..ffe7883 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -2,6 +2,7 @@ # Copyright (C) 2007 David Schmitt # See LICENSE for the full license granted to you. +# WARNING: this class should not be included directly. See the 'munin' class. class munin::host { package {'munin': ensure => installed, } -- cgit v1.2.3 From 87dc315597e8ed27c2e0907615ede8a3f1521b7a Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Mon, 14 Sep 2015 09:58:18 -0400 Subject: Fix export tag variable scope in munin::host --- manifests/host.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/host.pp b/manifests/host.pp index ffe7883..dd5720c 100644 --- a/manifests/host.pp +++ b/manifests/host.pp @@ -7,7 +7,7 @@ class munin::host { package {'munin': ensure => installed, } - Concat::Fragment <<| tag == $export_tag |>> + Concat::Fragment <<| tag == $munin::export_tag |>> concat::fragment{'munin.conf.header': target => '/etc/munin/munin.conf', -- cgit v1.2.3