Skip to content

Commit

Permalink
Merge pull request #65 from airbnb/allow_external_checks
Browse files Browse the repository at this point in the history
Allow external checks
  • Loading branch information
igor47 committed Jan 14, 2015
2 parents 7e73de7 + 1c938a5 commit ee3cfd2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ Although the exact parameters passed to each check are different, all take a num
* `rise`: (optional) how many consecutive checks must pass before the check is considered passing; defaults to 1
* `fall`: (optional) how many consecutive checks must fail before the check is considered failing; defaults to 1

#### Custom External Checks ####

If you would like to run a custom check but don't feel like trying to get it merged into this project, there is a mechanism for including external checks thanks to @bakins (airbnb/nerve#36).
Build your custom check as a separate gem and make sure to `bundle install` it on your system.

Ideally, you should name your gem `"nerve-watcher-#{type}"`, as that is what nerve will `require` on boot.
However, if you have a custom name for your gem, you can specify that in the `module` argument to the check.

## Contributing

1. Fork it
Expand Down
4 changes: 4 additions & 0 deletions lib/nerve/service_watcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ def initialize(service={})
service['checks'].each do |check|
check['type'] ||= "undefined"
begin
unless ServiceCheck::CHECKS[check['type']]
m = check['module'] ? check['module'] : "nerve-watcher-#{check['type']}"
require m
end
service_check_class = ServiceCheck::CHECKS[check['type']]
rescue
raise ArgumentError,
Expand Down

0 comments on commit ee3cfd2

Please sign in to comment.