Sha256: 30145831b9b877428a70f93469875300aaea586d527f53890a3de1b7bddefd55

Contents?: true

Size: 1.55 KB

Versions: 1

Compression:

Stored size: 1.55 KB

Contents

# NagiosPlugin

A simple framework for writing [Nagios](http://www.nagios.org/) Plugins.

## Installation

	`gem install nagiosplugin`

## Usage

Create your executable file (which will be called by nagios), `require
'nagiosplugin'` and subclass from `NagiosPlugin::Plugin`.

Then define a check method in your class which figures out the status
for what you want to check and calls the corresponding status method
(`ok`, `warning`, `critical` or `unknown`) to display a status message
and exit imediately.

Here's a simple example plugin named `check_u2d`:

```Ruby
#!/usr/bin/env ruby
require 'nagiosplugin'

class UnicornToDwarfRatio < NagiosPlugin::Plugin
	def check
    unicorn_to_dwarf_ratio = ... # We still need an alogrithm for this.
    msg = "#{unicorn_to_dwarf_ratio} unicorns/dwarves"

    critical(msg) if unicorn_to_dwarf_ratio < 0.0
    warning(msg) if unicorn_to_dwarf_ratio == 0.0
    ok(msg)
  end
end

UnicornToDwarfRatio.run
```

Take a look below `features` to see what's going on...

## Note on Patches/Pull Requests

* Fork the project and run `bundle install` to resolve all development dependencies.
* Add specs and/or features for it. This is important so I don't break it in a future version unintentionally.
* Make your feature addition or bug fix.
* Commit, do not mess with the Rakefile or gemspec.
  (If you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull.)
* Send me a pull request. Bonus points for topic branches.

## Copyright

Copyright (c) 2011-2012 Björn Albers. See LICENSE for details.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nagiosplugin-1.0.0 README.md