From d077dca013cc0efb85dc49d8c1e1673736efa5a2 Mon Sep 17 00:00:00 2001 From: Luke Chavers Date: Thu, 14 Nov 2013 14:17:23 -0600 Subject: [PATCH] Added sensu::manage_services to optionally disable internal service management. --- README.md | 7 +++++++ manifests/init.pp | 5 ++++- manifests/service/client.pp | 10 ++++++---- manifests/service/server.pp | 19 ++++++++++++------- 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 5b6fd8ba2d..7797d40c81 100644 --- a/README.md +++ b/README.md @@ -198,6 +198,13 @@ This will create the following check definition for Sensu } } +### Disable Service Management + +If you'd prefer to use an external service management tool such as DaemonTools or SupervisorD, +you can disable the modules internal service management functions like so: + + sensu::manage_services: false + ## Including Sensu monitoring in other modules diff --git a/manifests/init.pp b/manifests/init.pp index a3348dd2f5..d3819590b9 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -35,6 +35,7 @@ $purge_config = false, $use_embedded_ruby = false, $safe_mode = false, + $manage_services = true ){ anchor {'sensu::begin': } @@ -54,7 +55,9 @@ Class['sensu::service::client'] -> Anchor['sensu::end'] - if $server == 'true' or $server == true { + if $manage_services != 'true' and $manage_services != true { + $notify_services = [] + } elsif $server == 'true' or $server == true { if $client == 'true' or $client == true { Class['sensu::service::server'] ~> Class['sensu::service::client'] $notify_services = [ Class['sensu::service::client'], Class['sensu::service::server'] ] diff --git a/manifests/service/client.pp b/manifests/service/client.pp index 9d72a3bdc9..6915a84781 100644 --- a/manifests/service/client.pp +++ b/manifests/service/client.pp @@ -14,10 +14,12 @@ default => 'stopped', } - service { 'sensu-client': - ensure => $real_ensure, - enable => $enabled, - hasrestart => true, + if $sensu::manage_services == 'true' or $sensu::manage_services == true { + service { 'sensu-client': + ensure => $real_ensure, + enable => $enabled, + hasrestart => true, + } } } diff --git a/manifests/service/server.pp b/manifests/service/server.pp index a148bb886c..aa1a0e89d9 100644 --- a/manifests/service/server.pp +++ b/manifests/service/server.pp @@ -14,13 +14,18 @@ default => 'stopped', } - Service { - ensure => $real_ensure, - enable => $enabled, - hasrestart => true, + if $sensu::manage_services == 'true' or $sensu::manage_services == true { + + Service { + ensure => $real_ensure, + enable => $enabled, + hasrestart => true, + } + + service { 'sensu-server': } + service { 'sensu-api': } + service { 'sensu-dashboard': } + } - service { 'sensu-server': } - service { 'sensu-api': } - service { 'sensu-dashboard': } }