Skip to content

Commit

Permalink
Added sensu::manage_services to optionally disable internal service m…
Browse files Browse the repository at this point in the history
…anagement.
  • Loading branch information
Luke Chavers committed Nov 14, 2013
1 parent 78e122a commit d077dca
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 12 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
$purge_config = false,
$use_embedded_ruby = false,
$safe_mode = false,
$manage_services = true
){

anchor {'sensu::begin': }
Expand All @@ -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'] ]
Expand Down
10 changes: 6 additions & 4 deletions manifests/service/client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

}
19 changes: 12 additions & 7 deletions manifests/service/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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': }
}

0 comments on commit d077dca

Please sign in to comment.