From 8b8254af56943e761289d54d5c57fd942303f914 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Mon, 26 Apr 2010 17:30:11 -0400 Subject: initial commit --- README | 22 ++++++++++++++++++++ files/munin/passenger_mem | 31 ++++++++++++++++++++++++++++ files/munin/passenger_stats | 45 ++++++++++++++++++++++++++++++++++++++++ manifests/init.pp | 50 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 148 insertions(+) create mode 100644 README create mode 100755 files/munin/passenger_mem create mode 100755 files/munin/passenger_stats create mode 100644 manifests/init.pp diff --git a/README b/README new file mode 100644 index 0000000..31b1378 --- /dev/null +++ b/README @@ -0,0 +1,22 @@ +Passenger (mod_rails) puppet module +----------------------------------- + +This puppet module handles a passenger setup, it installs the +packages, and configures some munin graphs. + +Dependencies +------------ + +This module expects you to have the munin module installed. + +Getting started +--------------- + +Simply do 'include passenger' and it will be installed. + +If you need to install a specific version of passenger or +librack-ruby, you can specify the version to be installed by providing +a variable, for example: + +$passenger_ensure_version = "2.2.3-2~bpo50+1" +$librack-ruby_ensure_version = "1.0.0-2~bpo50+1" diff --git a/files/munin/passenger_mem b/files/munin/passenger_mem new file mode 100755 index 0000000..47fba09 --- /dev/null +++ b/files/munin/passenger_mem @@ -0,0 +1,31 @@ +#!/usr/bin/env ruby +# by Dan Manges, http://www.dcmanges.com/blog/rails-application-visualization-with-munin + +def output_config + puts <<-END +graph_category App +graph_title Passenger memory stats +graph_vlabel count + +memory.label memory +END + exit 0 +end + +def output_values + status = `/usr/sbin/passenger-memory-stats | tail -1` + unless $?.success? + $stderr.puts "failed executing passenger-memory-stats" + exit 1 + end + status =~ /(\d+\.\d+)/ + puts "memory.value #{$1}" +end + +if ARGV[0] == "config" + output_config +else + output_values +end + + diff --git a/files/munin/passenger_stats b/files/munin/passenger_stats new file mode 100755 index 0000000..00bf5e4 --- /dev/null +++ b/files/munin/passenger_stats @@ -0,0 +1,45 @@ +#!/usr/bin/env ruby + +def output_config + puts <<-END +graph_category App +graph_title passenger status +graph_vlabel count + +sessions.label sessions +max.label max processes +running.label running processes +active.label active processes +inactive.label inactive processes +END + exit 0 +end + +def output_values + status = `/usr/sbin/passenger-status` + unless $?.success? + $stderr.puts "failed executing passenger-status" + exit 1 + end + status =~ /max\s+=\s+(\d+)/ + puts "max.value #{$1}" + + status =~ /count\s+=\s+(\d+)/ + puts "running.value #{$1}" + + status =~ /active\s+=\s+(\d+)/ + puts "active.value #{$1}" + + status =~ /inactive\s+=\s+(\d+)/ + puts "inactive.value #{$1}" + + total_sessions = 0 + status.scan(/Sessions: (\d+)/).flatten.each { |count| total_sessions += count.to_i } + puts "sessions.value #{total_sessions}" +end + +if ARGV[0] == "config" + output_config +else + output_values +end diff --git a/manifests/init.pp b/manifests/init.pp new file mode 100644 index 0000000..62166e7 --- /dev/null +++ b/manifests/init.pp @@ -0,0 +1,50 @@ +# passenger module +# +# Copyright 2010, Riseup Networks +# Micah Anderson micah(at)riseup.net +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 3 as +# published by the Free Software Foundation. +# +# If you need to install a specific version of passenger or +# librack-ruby, you can specify the version to be installed by +# providing a variable, for example: +# +# $passenger_ensure_version = "2.2.3-2~bpo50+1" +# $librack-ruby_ensure_version = "1.0.0-2~bpo50+1" + +class passenger { + + if !defined(Package["libapache2-mod-passenger"]) { + if $passenger_ensure_version == '' { $passenger_ensure_version = 'installed' } + package { + "libapache2-mod-passenger": + ensure => $passenger_ensure_version; + } + } + if !defined(Package["librack-ruby"]) { + if $librack-ruby_ensure_version == '' { $librack-ruby_ensure_version = 'installed' } + package { + "librack-ruby": + ensure => $librack-ruby_ensure_version; + } + } + + file { + "/usr/local/share/munin-plugins/passenger_mem": + source => [ "puppet://$server/modules/site-passenger/munin/passenger_mem", + "puppet://$server/modules/passenger/munin/passenger_mem" ], + mode => 0755, owner => root, group => root; + + "/usr/local/share/munin-plugins/passenger_stats": + source => [ "puppet://$server/modules/site-passenger/munin/passenger_stats", + "puppet://$server/modules/passenger/munin/passenger_stats" ], + mode => 0755, owner => root, group => root; + } + + munin::plugin { [ passenger_mem, passenger_stats ]: + config => "user root", + script_path_in => "/usr/local/share/munin-plugins"; + } +} -- cgit v1.2.3 From 65a851a783b172542aacb4711fffc68a72f28589 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 27 Apr 2010 08:57:30 -0400 Subject: better way to deploy munin plugins is to use the munin::plugin::deploy --- manifests/init.pp | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 62166e7..7d8d249 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -31,20 +31,12 @@ class passenger { } } - file { - "/usr/local/share/munin-plugins/passenger_mem": - source => [ "puppet://$server/modules/site-passenger/munin/passenger_mem", - "puppet://$server/modules/passenger/munin/passenger_mem" ], - mode => 0755, owner => root, group => root; - - "/usr/local/share/munin-plugins/passenger_stats": - source => [ "puppet://$server/modules/site-passenger/munin/passenger_stats", - "puppet://$server/modules/passenger/munin/passenger_stats" ], - mode => 0755, owner => root, group => root; - } - - munin::plugin { [ passenger_mem, passenger_stats ]: - config => "user root", - script_path_in => "/usr/local/share/munin-plugins"; + munin::plugin::deploy { + 'passenger_mem': + source => "passenger/munin/passenger_mem", + config => "user root"; + 'passenger_stats': + source => "passenger/munin/passenger_stats", + config => "user root"; } } -- cgit v1.2.3 From 97ea40f9c22ae4a363ef8e7394b8d2b4c6846103 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 27 Apr 2010 09:07:51 -0400 Subject: update passenger-memory-stats to a better version of the plugin --- files/munin/passenger_mem | 31 ---------- files/munin/passenger_memory_stats | 123 +++++++++++++++++++++++++++++++++++++ manifests/init.pp | 6 +- 3 files changed, 126 insertions(+), 34 deletions(-) delete mode 100755 files/munin/passenger_mem create mode 100755 files/munin/passenger_memory_stats diff --git a/files/munin/passenger_mem b/files/munin/passenger_mem deleted file mode 100755 index 47fba09..0000000 --- a/files/munin/passenger_mem +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env ruby -# by Dan Manges, http://www.dcmanges.com/blog/rails-application-visualization-with-munin - -def output_config - puts <<-END -graph_category App -graph_title Passenger memory stats -graph_vlabel count - -memory.label memory -END - exit 0 -end - -def output_values - status = `/usr/sbin/passenger-memory-stats | tail -1` - unless $?.success? - $stderr.puts "failed executing passenger-memory-stats" - exit 1 - end - status =~ /(\d+\.\d+)/ - puts "memory.value #{$1}" -end - -if ARGV[0] == "config" - output_config -else - output_values -end - - diff --git a/files/munin/passenger_memory_stats b/files/munin/passenger_memory_stats new file mode 100755 index 0000000..d71b2a5 --- /dev/null +++ b/files/munin/passenger_memory_stats @@ -0,0 +1,123 @@ +#!/usr/bin/env ruby +pod=<<-POD + +=head1 NAME +passenger_memory_stats - Munin plugin to monitor the memory usage of passenger application servers. +Monitors the memory consumed by passenger instances. + +=head1 APPLICABLE SYSTEMS +All systems that have passenger installed. + +=head1 CONFIGURATION +The plugin needs to execute passenger-memory-stats. +This configuration section shows the defaults of the plugin: + + [passenger_*] + user root + command /usr/local/bin/ruby %c + +Options + env.passenger_memory_stats '/path/to/passenger-memory-stats' # Path to passenger memory status. + env.graph_category 'App' # Graph Category. Defaults to App. + +ln -s /usr/share/munin/plugins/passenger_memory_stats /etc/munin/plugins/passenger_memory_stats + +=head1 INTERPRETATION +The plugin shows the memory consumed by passenger instances. + +=head1 MAGIC MARKERS + #%# family=auto + #%# capabilities=autoconf + +=head1 VERSION +1.5 + +=head1 BUGS +None known + +=head1 AUTHOR +Ilya Lityuga +Bart ten Brinke - railsdoctors.com + +=head1 LICENSE +MIT + +POD + +# Globals +GRAPH_CATEGORY = ENV['graph_category'] || 'App' +PASSENGER_MEMORY_STATS = ENV['passenger_memory_stats'] || '/usr/local/bin/passenger-memory-stats' + +# Check if this plugin can run +def autoconf + begin + require 'rubygems' + gem "passenger", ">=2.0" + rescue Exception => e + puts "no (Gem not found: #{e})" + exit 1 + end + + status = `#{PASSENGER_MEMORY_STATS}` + unless $?.success? + puts "no (error when executing #{PASSENGER_MEMORY_STATS})" + exit 1 + end + + puts "yes" + exit 0 +end + +# Describe the graph config +def config + status = `#{PASSENGER_MEMORY_STATS}` + memory_info = open('/proc/meminfo', 'r') do |lines| + lines.inject({}) do |h, line| + matched = line.match(/^([\w_\(\)]+):\s+(\d+)/) + h[matched[1].to_sym] = matched[2].to_i * 1024 + h + end + end + upper_limit = memory_info[:MemTotal] + puts <<-CONFIG +graph_category #{GRAPH_CATEGORY} +graph_title Passenger memory stats +graph_vlabel Bytes +graph_args --base 1000 -l 0 --upper-limit #{upper_limit} +graph_info The memory used by passenger instances on this application server + +memory.label memory +CONFIG + exit 0 +end + + +# Collect the data +# debug Show debug information +def run(debug = false) + stats = `#{PASSENGER_MEMORY_STATS}` + + unless $?.success? + $stderr.puts "failed executing passenger-memory-stats" + exit 1 + end + + puts stats if debug + + #### Total private dirty RSS: 81.81 MB + stats =~ /RSS:\s*([\d\.]+)\s*MB\Z/m + memory = ($1.to_f * 1024 * 1024).to_i + puts "memory.value #{memory}" +end + + +# Main +if ARGV[0] == "config" + config +elsif ARGV[0] == "autoconf" + autoconf +elsif ARGV[0] == "debug" + run(true) +else + run +end diff --git a/manifests/init.pp b/manifests/init.pp index 7d8d249..43951a2 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -32,9 +32,9 @@ class passenger { } munin::plugin::deploy { - 'passenger_mem': - source => "passenger/munin/passenger_mem", - config => "user root"; + 'passenger_memory_stats': + source => "passenger/munin/passenger_memory_stats", + config => "user root\nenv.passenger_memory_stats /usr/sbin/passenger-memory-stats"; 'passenger_stats': source => "passenger/munin/passenger_stats", config => "user root"; -- cgit v1.2.3 From 0ed2fed2b6deed4432102301b3eec59f103b734d Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 27 Apr 2010 09:41:19 -0400 Subject: make sure the module is enabled --- manifests/init.pp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/manifests/init.pp b/manifests/init.pp index 43951a2..50ef34a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -31,6 +31,10 @@ class passenger { } } + apache2::module { + "passenger": ensure => present, require_package => "libapache2-mod-passenger"; + } + munin::plugin::deploy { 'passenger_memory_stats': source => "passenger/munin/passenger_memory_stats", -- cgit v1.2.3 From e4028b8a0432539647c4752047ecbddbcc7e7be4 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 27 Apr 2010 09:42:05 -0400 Subject: update README to note apache module requirement --- README | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README b/README index 31b1378..c3e40b0 100644 --- a/README +++ b/README @@ -7,7 +7,9 @@ packages, and configures some munin graphs. Dependencies ------------ -This module expects you to have the munin module installed. +This module expects you to have: + . munin module + . apache module Getting started --------------- -- cgit v1.2.3 From 19f55b34ead0dddb87bc45a45779ce971da31b57 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 27 Apr 2010 09:45:44 -0400 Subject: change name of $librack-ruby_ensure_version variable name, the dash in the name does not work --- manifests/init.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 50ef34a..a5f3fcc 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -12,7 +12,7 @@ # providing a variable, for example: # # $passenger_ensure_version = "2.2.3-2~bpo50+1" -# $librack-ruby_ensure_version = "1.0.0-2~bpo50+1" +# $librack_ensure_version = "1.0.0-2~bpo50+1" class passenger { @@ -24,10 +24,10 @@ class passenger { } } if !defined(Package["librack-ruby"]) { - if $librack-ruby_ensure_version == '' { $librack-ruby_ensure_version = 'installed' } + if $librack_ensure_version == '' { $librack_ensure_version = 'installed' } package { "librack-ruby": - ensure => $librack-ruby_ensure_version; + ensure => $librack_ensure_version; } } -- cgit v1.2.3 From a5b6a893b494033eec5c4bec9a8aa89bf65a9571 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Fri, 7 May 2010 10:41:47 -0400 Subject: allow for munin plugin configuration overrides, update README to reflect this and remove redundant README info from comments --- README | 9 +++++++++ manifests/init.pp | 28 +++++++++++++++++++--------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/README b/README index c3e40b0..7f39265 100644 --- a/README +++ b/README @@ -16,9 +16,18 @@ Getting started Simply do 'include passenger' and it will be installed. +Configuration +------------- + If you need to install a specific version of passenger or librack-ruby, you can specify the version to be installed by providing a variable, for example: $passenger_ensure_version = "2.2.3-2~bpo50+1" $librack-ruby_ensure_version = "1.0.0-2~bpo50+1" + +If you need to set different munin plugin configuration values, you +can also do so as follows: + +$passenger_memory_munin_config = "user root\nenv.passenger_memory_stats /opt/bin/passenger-memory-stats" +$passenger_stats_munin_config = "user root\nenv.PASSENGER_TMPDIR=/var/tmp\n" diff --git a/manifests/init.pp b/manifests/init.pp index a5f3fcc..3078cfe 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -6,16 +6,19 @@ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as # published by the Free Software Foundation. -# -# If you need to install a specific version of passenger or -# librack-ruby, you can specify the version to be installed by -# providing a variable, for example: -# -# $passenger_ensure_version = "2.2.3-2~bpo50+1" -# $librack_ensure_version = "1.0.0-2~bpo50+1" class passenger { + $real_passenger_memory_munin_config = $passenger_memory_munin_config ? { + '' => "user root\nenv.passenger_memory_stats /usr/sbin/passenger-memory-stats", + default => $passenger_memory_munin_config, + } + + $real_passenger_stats_munin_config = $passenger_stats_munin_config ? { + '' => "user root", + default => $passenger_stats_munin_config, + } + if !defined(Package["libapache2-mod-passenger"]) { if $passenger_ensure_version == '' { $passenger_ensure_version = 'installed' } package { @@ -38,9 +41,16 @@ class passenger { munin::plugin::deploy { 'passenger_memory_stats': source => "passenger/munin/passenger_memory_stats", - config => "user root\nenv.passenger_memory_stats /usr/sbin/passenger-memory-stats"; + config => $real_passenger_memory_munin_config; 'passenger_stats': source => "passenger/munin/passenger_stats", - config => "user root"; + config => $real_passenger_stats_munin_config; + } +} + +test::deploy { + 'passenger_memory_stats': + source => "test/deploythis", + config => $passenger_munin_config } } -- cgit v1.2.3 From 1e23792f58c5495e19e76602f63bb99d34e8392a Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Fri, 7 May 2010 10:57:39 -0400 Subject: remove some bogus test things that snuck in --- manifests/init.pp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 3078cfe..8e8b78b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -47,10 +47,3 @@ class passenger { config => $real_passenger_stats_munin_config; } } - -test::deploy { - 'passenger_memory_stats': - source => "test/deploythis", - config => $passenger_munin_config - } -} -- cgit v1.2.3 From 47694168cdb741f42e0152432261eeba48d91829 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Fri, 7 May 2010 11:09:03 -0400 Subject: fix the way the environment variable is defined, you do not specify '=' --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 7f39265..7014d6f 100644 --- a/README +++ b/README @@ -30,4 +30,4 @@ If you need to set different munin plugin configuration values, you can also do so as follows: $passenger_memory_munin_config = "user root\nenv.passenger_memory_stats /opt/bin/passenger-memory-stats" -$passenger_stats_munin_config = "user root\nenv.PASSENGER_TMPDIR=/var/tmp\n" +$passenger_stats_munin_config = "user root\nenv.PASSENGER_TMPDIR /var/tmp\n" -- cgit v1.2.3 From faf21f62222898758cdec3ce1207bf02d5dbeb78 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Fri, 7 May 2010 11:45:48 -0400 Subject: make the configurable munin variable a little cleaner --- manifests/init.pp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 8e8b78b..ba19f1f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -9,14 +9,12 @@ class passenger { - $real_passenger_memory_munin_config = $passenger_memory_munin_config ? { - '' => "user root\nenv.passenger_memory_stats /usr/sbin/passenger-memory-stats", - default => $passenger_memory_munin_config, + case $passenger_memory_munin_config { '': + { $passenger_memory_munin_config = "user root\nenv.passenger_memory_stats /usr/sbin/passenger-memory-stats" } } - $real_passenger_stats_munin_config = $passenger_stats_munin_config ? { - '' => "user root", - default => $passenger_stats_munin_config, + case $passenger_stats_munin_config { '': + { $passenger_stats_munin_config = "user root\n" } } if !defined(Package["libapache2-mod-passenger"]) { @@ -41,9 +39,9 @@ class passenger { munin::plugin::deploy { 'passenger_memory_stats': source => "passenger/munin/passenger_memory_stats", - config => $real_passenger_memory_munin_config; + config => $passenger_memory_munin_config; 'passenger_stats': source => "passenger/munin/passenger_stats", - config => $real_passenger_stats_munin_config; + config => $passenger_stats_munin_config; } } -- cgit v1.2.3 From f2a42cf9ffde9c6a2ac466aacf4e413d0c6197fa Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Sun, 9 May 2010 10:58:23 -0400 Subject: change default munin category for graphs --- files/munin/passenger_memory_stats | 4 ++-- files/munin/passenger_stats | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/files/munin/passenger_memory_stats b/files/munin/passenger_memory_stats index d71b2a5..eb9b284 100755 --- a/files/munin/passenger_memory_stats +++ b/files/munin/passenger_memory_stats @@ -18,7 +18,7 @@ This configuration section shows the defaults of the plugin: Options env.passenger_memory_stats '/path/to/passenger-memory-stats' # Path to passenger memory status. - env.graph_category 'App' # Graph Category. Defaults to App. + env.graph_category 'App' # Graph Category. Defaults to Passenger. ln -s /usr/share/munin/plugins/passenger_memory_stats /etc/munin/plugins/passenger_memory_stats @@ -45,7 +45,7 @@ MIT POD # Globals -GRAPH_CATEGORY = ENV['graph_category'] || 'App' +GRAPH_CATEGORY = ENV['graph_category'] || 'Passenger' PASSENGER_MEMORY_STATS = ENV['passenger_memory_stats'] || '/usr/local/bin/passenger-memory-stats' # Check if this plugin can run diff --git a/files/munin/passenger_stats b/files/munin/passenger_stats index 00bf5e4..a117903 100755 --- a/files/munin/passenger_stats +++ b/files/munin/passenger_stats @@ -2,7 +2,7 @@ def output_config puts <<-END -graph_category App +graph_category Passenger graph_title passenger status graph_vlabel count -- cgit v1.2.3 From 1c699503c7b5929c9e2f5a6fcb11487486b46f1d Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Wed, 12 May 2010 15:09:00 -0400 Subject: refactor classes for multi-platform, place munin in seperate (optional) class, adapt to shared apache puppet module, support a config file for apache --- files/mod_passenger.conf | 0 manifests/base.pp | 13 +++++++++++++ manifests/debian.pp | 19 +++++++++++++++++++ manifests/init.pp | 40 +++++++--------------------------------- manifests/munin.pp | 20 ++++++++++++++++++++ 5 files changed, 59 insertions(+), 33 deletions(-) create mode 100644 files/mod_passenger.conf create mode 100644 manifests/base.pp create mode 100644 manifests/debian.pp create mode 100644 manifests/munin.pp diff --git a/files/mod_passenger.conf b/files/mod_passenger.conf new file mode 100644 index 0000000..e69de29 diff --git a/manifests/base.pp b/manifests/base.pp new file mode 100644 index 0000000..34ef976 --- /dev/null +++ b/manifests/base.pp @@ -0,0 +1,13 @@ +class passenger::base { + + include apache + + apache::config::file { 'mod_passenger': + ensure => present, + source => [ "puppet://${server}/modules/site-passenger/${fqdn}/mod_passenger.conf", + "puppet://${server}/modules/site-passenger/mod_passenger.conf", + "puppet://${server}/modules/passenger/mod_passenger.conf", + ], + } + +} diff --git a/manifests/debian.pp b/manifests/debian.pp new file mode 100644 index 0000000..fdffdfa --- /dev/null +++ b/manifests/debian.pp @@ -0,0 +1,19 @@ +class passenger::base::debian inherits passenger::base { + + if !defined(Package["libapache2-mod-passenger"]) { + if $passenger_ensure_version == '' { $passenger_ensure_version = 'installed' } + apache::debian::module { 'passenger': + ensure => $passenger_ensure_version, + package_name => 'libapache2-mod-passenger'; + } + } + + if !defined(Package["librack-ruby"]) { + if $librack_ensure_version == '' { $librack_ensure_version = 'installed' } + package { + "librack-ruby": + ensure => $librack_ensure_version; + } + } + +} diff --git a/manifests/init.pp b/manifests/init.pp index ba19f1f..59cdabd 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -8,40 +8,14 @@ # published by the Free Software Foundation. class passenger { - - case $passenger_memory_munin_config { '': - { $passenger_memory_munin_config = "user root\nenv.passenger_memory_stats /usr/sbin/passenger-memory-stats" } + + case $operatingsystem { + debian: { include passenger::debian } + default: { include passenger::base } } - case $passenger_stats_munin_config { '': - { $passenger_stats_munin_config = "user root\n" } - } + if $use_munin { + include passenger::munin + } - if !defined(Package["libapache2-mod-passenger"]) { - if $passenger_ensure_version == '' { $passenger_ensure_version = 'installed' } - package { - "libapache2-mod-passenger": - ensure => $passenger_ensure_version; - } - } - if !defined(Package["librack-ruby"]) { - if $librack_ensure_version == '' { $librack_ensure_version = 'installed' } - package { - "librack-ruby": - ensure => $librack_ensure_version; - } - } - - apache2::module { - "passenger": ensure => present, require_package => "libapache2-mod-passenger"; - } - - munin::plugin::deploy { - 'passenger_memory_stats': - source => "passenger/munin/passenger_memory_stats", - config => $passenger_memory_munin_config; - 'passenger_stats': - source => "passenger/munin/passenger_stats", - config => $passenger_stats_munin_config; - } } diff --git a/manifests/munin.pp b/manifests/munin.pp new file mode 100644 index 0000000..9b6cc68 --- /dev/null +++ b/manifests/munin.pp @@ -0,0 +1,20 @@ +class passenger::munin { + + case $passenger_memory_munin_config { '': + { $passenger_memory_munin_config = "user root\nenv.passenger_memory_stats /usr/sbin/passenger-memory-stats" } + } + + case $passenger_stats_munin_config { '': + { $passenger_stats_munin_config = "user root\n" } + } + + munin::plugin::deploy { + 'passenger_memory_stats': + source => "passenger/munin/passenger_memory_stats", + config => $passenger_memory_munin_config; + 'passenger_stats': + source => "passenger/munin/passenger_stats", + config => $passenger_stats_munin_config; + } + +} -- cgit v1.2.3 From 9820bf2428a6fe3dbd0f361e5679991d263b73af Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Wed, 12 May 2010 18:17:29 -0400 Subject: correct class name typo --- manifests/debian.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/debian.pp b/manifests/debian.pp index fdffdfa..f351111 100644 --- a/manifests/debian.pp +++ b/manifests/debian.pp @@ -1,4 +1,4 @@ -class passenger::base::debian inherits passenger::base { +class passenger::debian inherits passenger::base { if !defined(Package["libapache2-mod-passenger"]) { if $passenger_ensure_version == '' { $passenger_ensure_version = 'installed' } -- cgit v1.2.3