Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifu notification #72

Merged
merged 2 commits into from
May 8, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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?
Expand Down Expand Up @@ -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
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 @@ -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
Expand Down
2 changes: 2 additions & 0 deletions manifests/check.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
$standalone = undef,
$interval = '60',
$subscribers = [],
$sla = [],
$notification = undef,
$low_flap_threshold = undef,
$high_flap_threshold = undef,
Expand All @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions spec/defines/sensu_check_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
:handlers => ['/handler1', '/handler2'],
:interval => '10',
:subscribers => ['all'],
:sla => ['admin:2'],
:type => 'metric',
:standalone => true,
:notification => 'some text',
Expand All @@ -35,6 +36,7 @@
'handlers' => ['/handler1', '/handler2'],
'interval' => '10',
'subscribers' => ['all'],
'sla' => ['admin:2'],
'type' => 'metric',
'standalone' => true,
'notification' => 'some text',
Expand Down