Skip to content

Commit a1ce774

Browse files
author
Tom Copeland
committed
Adding a little controller so's Nagios can check status
1 parent d8d17d1 commit a1ce774

File tree

5 files changed

+30
-0
lines changed

5 files changed

+30
-0
lines changed

Diff for: app/controllers/status_controller.rb

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class StatusController < ApplicationController
2+
3+
skip_before_filter :require_logged_in, :require_not_overeager
4+
skip_filter :record_api_request
5+
6+
def status
7+
head :ok
8+
end
9+
10+
end

Diff for: app/helpers/status_helper.rb

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
module StatusHelper
2+
end

Diff for: config/routes.rb

+2
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@
2121
map.resources :users, :member => [:groups]
2222

2323
map.resources :processors
24+
25+
map.status '/status', :controller => 'status', :action => 'status'
2426
end

Diff for: test/functional/status_controller_test.rb

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
require 'test/test_helper'
2+
3+
class StatusControllerTest < ActionController::TestCase
4+
5+
test "status action doesn't log or need to be authenticated" do
6+
assert_no_difference 'ApiRequest.count' do
7+
get :status
8+
assert_response :ok
9+
end
10+
end
11+
12+
end

Diff for: test/unit/helpers/status_helper_test.rb

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
require 'test_helper'
2+
3+
class StatusHelperTest < ActionView::TestCase
4+
end

0 commit comments

Comments
 (0)