From 6b175636bb82d048655a901e6eab183ffad58fc3 Mon Sep 17 00:00:00 2001 From: Stephen Gran Date: Sun, 20 May 2012 08:54:15 +0100 Subject: [PATCH] add some munin magic Signed-off-by: Stephen Gran --- modules/munin/manifests/conf.pp | 24 ++++++++++++++++++++++++ modules/vsftpd/manifests/init.pp | 4 +++- modules/vsftpd/manifests/site.pp | 7 +++++++ modules/vsftpd/templates/munin.erb | 3 +++ 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 modules/munin/manifests/conf.pp create mode 100644 modules/vsftpd/templates/munin.erb diff --git a/modules/munin/manifests/conf.pp b/modules/munin/manifests/conf.pp new file mode 100644 index 00000000..a4ac0ab7 --- /dev/null +++ b/modules/munin/manifests/conf.pp @@ -0,0 +1,24 @@ +define munin::conf ( + $ensure=present, + $content='', + $source='' +) { + + include munin + + case $ensure { + present: { + if ! ($source or $content) { + fail ( "No configuration found for ${name}" ) + } + } + absent: {} + default: { fail ( "Unknown ensure value: '$ensure'" ) } + } + + file { "/etc/munin/plugin-conf.d/${name}": + ensure => $ensure, + require => Package['munin-node'], + notify => Service['munin-node'], + } +} diff --git a/modules/vsftpd/manifests/init.pp b/modules/vsftpd/manifests/init.pp index 11755b49..d664b7e0 100644 --- a/modules/vsftpd/manifests/init.pp +++ b/modules/vsftpd/manifests/init.pp @@ -18,7 +18,9 @@ class vsftpd { notify => Service['vsftpd'] } - munin::check { 'vsftpd': } + munin::check { "vsftpd-${name}": + ensure => absent + } munin::check { 'ps_vsftpd': script => 'ps_' } diff --git a/modules/vsftpd/manifests/site.pp b/modules/vsftpd/manifests/site.pp index 46c805ed..f8a71a0f 100644 --- a/modules/vsftpd/manifests/site.pp +++ b/modules/vsftpd/manifests/site.pp @@ -29,6 +29,13 @@ define vsftpd::site ( ensure => absent } + munin::check { "vsftpd-${name}": + script => 'vsftpd' + } + munin::conf { "vsftpd-${name}": + content => template('vsftpd/munin.erb') + } + # We don't need a firewall rule because it's added in vsftp.pp xinetd::service { "vsftpd-${name}": bind => $bind, diff --git a/modules/vsftpd/templates/munin.erb b/modules/vsftpd/templates/munin.erb new file mode 100644 index 00000000..dd980e69 --- /dev/null +++ b/modules/vsftpd/templates/munin.erb @@ -0,0 +1,3 @@ +[vsftpd-<%= scope.lookupvar('ftpsite') %>] +user root +env.logfile /var/log/ftp/<%= scope.lookupvar('ftpsite') %>.log -- 2.39.2