Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kostya/nagios_helper
Gem for writing, testing, executing Nagios checks inside Rails application. Checks running throught http or script.
https://github.com/kostya/nagios_helper
Last synced: 20 days ago
JSON representation
Gem for writing, testing, executing Nagios checks inside Rails application. Checks running throught http or script.
- Host: GitHub
- URL: https://github.com/kostya/nagios_helper
- Owner: kostya
- License: mit
- Created: 2012-09-09T23:02:37.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2014-08-22T20:03:22.000Z (about 10 years ago)
- Last Synced: 2024-09-17T23:50:22.078Z (about 2 months ago)
- Language: Ruby
- Homepage:
- Size: 297 KB
- Stars: 6
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
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 :xdef execute
count = User.count + x.to_iwarn "hmmm" if count < 10
crit "ouch" if count < 5ok "good #{count}"
endend
```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
endend
```$ curl http://nagios:password@localhost:3000/nagios/check?method=some&x=1