Sha256: 3ba25a2a28480b95888583089abc042deaade1235320288069d6171f6719d647

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

NagiosHelper
============

Gem for writing, testing, executing Nagios checks inside Rails application.
Checks running throught http or script.

```
gem 'nagios_helper', :require => 'nagios'
```

    $ rails generate nagios:check some

Check example:
--------------

app/nagios/some.rb

```ruby
class Nagios::Some < Nagios::Check
  params :x

  def execute
    count = User.count + x.to_i

    warn "hmmm" if count < 10
    crit "ouch" if count < 5

    ok "good #{count}"
  end

end
```

Run:

    $ RAILS_ENV=production bundle exec nagios_check some x 1

### Nagios Check Initilizers:
All files in app/nagios/initializers will auto loads.

Server:
-------

### Inside rails server

Create controller: app/controllers/nagios_controller.rb

```ruby
class NagiosController < ApplicationController
  http_basic_authenticate_with :name => "nagios", :password => "password"

  def check
    status, message = Nagios::Runner.check(params)
    render :text => "#{status}|#{message}", :layout => false
  end

end
```

    $ curl http://nagios:password@localhost:3000/nagios/check?method=some&x=1

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nagios_helper-0.2.2 README.md
nagios_helper-0.2.1 README.md
nagios_helper-0.2 README.md