diff --git a/lib/puppet/provider/sensu_check/json.rb b/lib/puppet/provider/sensu_check/json.rb index b61ddb78ec..bb201ae792 100644 --- a/lib/puppet/provider/sensu_check/json.rb +++ b/lib/puppet/provider/sensu_check/json.rb @@ -32,6 +32,7 @@ def create self.interval = resource[:interval] self.subscribers = resource[:subscribers] # Optional arguments + self.sla = resource[:sla] unless resource[:sla].nil? self.type = resource[:type] unless resource[:type].nil? self.config = resource[:config] unless resource[:config].nil? self.aggregate = resource[:aggregate] unless resource[:aggregate].nil? @@ -105,6 +106,14 @@ def subscribers=(value) conf['checks'][resource[:name]]['subscribers'] = value end + def sla + conf['checks'][resource[:name]]['sla'] || [] + end + + def sla=(value) + conf['checks'][resource[:name]]['sla'] = value + end + def type conf['checks'][resource[:name]]['type'] end diff --git a/lib/puppet/type/sensu_check.rb b/lib/puppet/type/sensu_check.rb index 5cf7e6ccb1..bd44be2a7b 100644 --- a/lib/puppet/type/sensu_check.rb +++ b/lib/puppet/type/sensu_check.rb @@ -67,6 +67,10 @@ def initialize(*args) desc "Who is subscribed to this check" end + newproperty(:sla, :array_matching => :all) do + desc "custom variable for notifu" + end + newproperty(:type) do desc "What type of check is this" end diff --git a/manifests/check.pp b/manifests/check.pp index a17a2d7af8..1e130901b2 100644 --- a/manifests/check.pp +++ b/manifests/check.pp @@ -13,6 +13,7 @@ $standalone = undef, $interval = '60', $subscribers = [], + $sla = [], $notification = undef, $low_flap_threshold = undef, $high_flap_threshold = undef, @@ -34,6 +35,7 @@ handlers => $handlers, interval => $interval, subscribers => $subscribers, + sla => $sla, notification => $notification, low_flap_threshold => $low_flap_threshold, high_flap_threshold => $high_flap_threshold, diff --git a/spec/defines/sensu_check_spec.rb b/spec/defines/sensu_check_spec.rb index 8c3298fefc..f2faef30cb 100644 --- a/spec/defines/sensu_check_spec.rb +++ b/spec/defines/sensu_check_spec.rb @@ -21,6 +21,7 @@ :handlers => ['/handler1', '/handler2'], :interval => '10', :subscribers => ['all'], + :sla => ['admin:2'], :type => 'metric', :standalone => true, :notification => 'some text', @@ -35,6 +36,7 @@ 'handlers' => ['/handler1', '/handler2'], 'interval' => '10', 'subscribers' => ['all'], + 'sla' => ['admin:2'], 'type' => 'metric', 'standalone' => true, 'notification' => 'some text',