Navigation Menu

Skip to content

Commit

Permalink
[api-updates] update /checks & /check/:name
Browse files Browse the repository at this point in the history
  • Loading branch information
portertech committed Mar 20, 2012
1 parent b08d5cb commit 4814260
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/sensu/api.rb
Expand Up @@ -148,13 +148,18 @@ def self.setup(options={})

aget '/checks' do
$logger.debug('[checks] -- ' + request.ip + ' -- GET -- request for check list')
body $settings.checks.to_json
response = Array.new
$settings.checks.each do |check, details|
response.push(details.merge(:name => check))
end
body response.to_json
end

aget '/check/:name' do |check|
$logger.debug('[check] -- ' + request.ip + ' -- GET -- request for check -- ' + check)
if $settings.checks.key?(check)
body $settings.checks[check].to_json
response = $settings.checks[check].merge(:name => check)
body response.to_json
else
status 404
body ''
Expand Down

0 comments on commit 4814260

Please sign in to comment.