Skip to content

Commit

Permalink
add dependencies to sensu::check
Browse files Browse the repository at this point in the history
  • Loading branch information
jlambert121 committed May 29, 2014
1 parent 938e344 commit fa527b5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/puppet/provider/sensu_check/json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ def command=(value)
conf['checks'][resource[:name]]['command'] = value
end

def dependencies
conf['checks'][resource[:name]]['dependencies']
end

def dependencies=(value)
value = [ value ] if value.is_a?(String)
conf['checks'][resource[:name]]['dependencies'] = value
end

def subscribers
conf['checks'][resource[:name]]['subscribers']
end
Expand Down
4 changes: 4 additions & 0 deletions lib/puppet/type/sensu_check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ def initialize(*args)
desc "Command to be run by the check"
end

newproperty(:dependencies) do
desc "Dependencies of this check"
end

newproperty(:handlers, :array_matching => :all) do
desc "List of handlers that responds to this check"
end
Expand Down
6 changes: 6 additions & 0 deletions manifests/check.pp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@
# of commands that are not actually 'checks' per say, but actually arbitrary commands for remediation
# Default: undef
#
# [*dependencies*]
# Array. List of checks this check depends on. Note: The validity of the other checks is not enforced by puppet
# Default: undef
#
define sensu::check(
$command,
$ensure = 'present',
Expand All @@ -72,6 +76,7 @@
$aggregate = undef,
$handle = undef,
$publish = undef,
$dependencies = undef,
$custom = undef,
) {

Expand Down Expand Up @@ -126,6 +131,7 @@
aggregate => $aggregate,
handle => $handle,
publish => $publish,
dependencies => $dependencies,
custom => $custom,
require => File['/etc/sensu/conf.d/checks'],
notify => $notify,
Expand Down

0 comments on commit fa527b5

Please sign in to comment.