Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Ruby
branch: master

This branch is 204 commits behind flapjack:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.gitignore
.rspec
Gemfile
LICENSE
README.md
Rakefile
flapjack-diner.gemspec

README.md

Flapjack::Diner

Access the API of a Flapjack system monitoring server.

Installation

Add this line to your application's Gemfile:

gem 'flapjack-diner'

And then execute:

$ bundle

Or install it yourself as:

$ gem install flapjack-diner

Usage

Set the URI of the Flapjack server:

Flapjack::Diner.base_uri('127.0.0.1:5000')

Return a list of monitored entities, and their statuses for all associated checks:

Flapjack::Diner.entities

The data is returned as a JSON list where each element is an associative array representing an entity.

// ID     is an integer, to hold e.g. database id from an external system
// NAME   is a string
// STATUS is an associative array with the format returned from Flapjack::Diner.status(entity, check)
[{"id"     : ID,
  "name"   : NAME,
  "checks" : [STATUS, STATUS, ...]},
 {},
 ...]

Return a list of checks for an entity:

Flapjack::Diner.checks('example.com')

The data is returned as a JSON list of strings, where each element is a check name for the provided entity.

// CHECK is a string, e.g. 'ssh', 'ping'
[CHECK, CHECK, ...]

Return the statuses for all checks on an entity

Flapjack::Diner.status('example.com')

The data is returned as a JSON list of checks, where each element is an associative array with the format returned from Flapjack::Diner.status(entity, check)

// STATUS is an associative array with the format returned from Flapjack::Diner.status(entity, check)
[STATUS, STATUS, ...]

Return the status for a check on an entity

Flapjack::Diner.status('example.com', 'ping')

Return lists of scheduled maintenance periods for all checks on an entity:

# start time (ISO 8601-formatted String, optional)
# end time (ISO 8601-formatted String, optional)
Flapjack::Diner.scheduled_maintenances('example.com', :start_time => "2012-09-01T00:00:00+09:30", :end_time => "2012-10-01T00:00:00+09:30")

Return a list of scheduled maintenance periods for a check on an entity:

# start time (ISO 8601-formatted String, optional)
# end time (ISO 8601-formatted String, optional)
Flapjack::Diner.scheduled_maintenances('example.com', 'ping', :start_time => "2012-09-01T00:00:00+09:30", :end_time => "2012-10-01T00:00:00+09:30")

Return lists of unscheduled maintenance periods for all checks on an entity:

# start time (ISO 8601-formatted String, optional)
# end time (ISO 8601-formatted String, optional)
Flapjack::Diner.unscheduled_maintenances('example.com', :start_time => "2012-09-01T00:00:00+09:30", :end_time => "2012-10-01T00:00:00+09:30")

Return a list of unscheduled maintenance periods for a check on an entity:

# start time (ISO 8601-formatted String, optional)
# end time (ISO 8601-formatted String, optional)
Flapjack::Diner.unscheduled_maintenances('example.com', 'ping', :start_time => "2012-09-01T00:00:00+09:30", :end_time => "2012-10-01T00:00:00+09:30")

Return lists of outages for all checks on an entity (all times for which said checks failed):

# start time (ISO 8601-formatted String, optional)
# end time (ISO 8601-formatted String, optional)
Flapjack::Diner.outages('example.com', :start_time => "2012-09-01T00:00:00+09:30", :end_time => "2012-10-01T00:00:00+09:30")

Return a list of outages for a check on an entity (all times for which the check failed):

# start time (ISO 8601-formatted String, optional)
# end time (ISO 8601-formatted String, optional)
Flapjack::Diner.outages('example.com', 'ping', :start_time => "2012-09-01T00:00:00+09:30", :end_time => "2012-10-01T00:00:00+09:30")

Return a list of downtimes for all checks on an entity (outages outside of scheduled maintenance periods):

# start time (ISO 8601-formatted String, optional)
# end time (ISO 8601-formatted String, optional)
Flapjack::Diner.downtime('example.com', :start_time => "2012-09-01T00:00:00+09:30", :end_time => "2012-10-01T00:00:00+09:30")

Return a list of downtimes for a check on an entity (outages outside of scheduled maintenance periods):

# start time (ISO 8601-formatted String, optional)
# end time (ISO 8601-formatted String, optional)
Flapjack::Diner.downtime('example.com', 'ping', :start_time => "2012-09-01T00:00:00+09:30", :end_time => "2012-10-01T00:00:00+09:30")

Acknowledge the current state for a check on an entity:

# summary (String, optional)
Flapjack::Diner.acknowledge!('example.com', 'ping', :summary => 'ack')

Create a scheduled maintenance period for a check on an entity:

# start time (ISO 8601-formatted String, required)
# duration (Integer, required) is measured in seconds
# summary (String, optional)
Flapjack::Diner.create_scheduled_maintenance!('example.com', 'ping',
  :start_time => Time.now.to_i - (30 * 60), :duration => (60 * 60),
  :summary => 'changing stuff')

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
Something went wrong with that request. Please try again.