Skip to content

fujin/redphone

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Redphone, the monitoring service ruby library

  • Pagerduty support (integration, incidents)
  • Pingdom support (checks, results, actions)
  • Loggly support (event, search, facets)

https://github.com/portertech/redphone/raw/master/redphone.jpg

  • All API request are done over SSL
  • Response bodies are returned as Ruby hashes

Getting started

gem install redphone

Examples

Pagerduty

require "redphone/pagerduty"
pagerduty = Redphone::Pagerduty.new(
  :service_key => SERVICE_KEY,
  :subdomain => SUBDOMAIN,
  :user => USER,
  :password => PASSWORD
)

Trigger an incident

pagerduty.trigger_incident(
  :description => "Testing Redphone Rubygem",
  :incident_key => "redphone/test"
)
# OR Redphone::Pagerduty.trigger_incident()

Resolve an incident

pagerduty.resolve_incident(:incident_key => "redphone/test")
# OR Redphone::Pagerduty.resolve_incident()

List/query current and past incidents

pagerduty.incidents(:incident_key => "redphone/test")

You can add the following options for a date range

:since => "2011-08-01",
:until => "2011-10-01"

Or if you only care about unresolved incidents

:status => "triggered,acknowledged"

Pingdom

require "redphone/pingdom"
pingdom = Redphone::Pingdom.new(
  :user => USER,
  :password => PASSWORD
)

Create a check

response = pingdom.create_check(
  :name => "redphone",
  :host => "www.amazon.ca",
  :type => "http"
)
check_id = response['check']['id']

Delete a check

pingdom.delete_check(:id => check_id)

Loggly

require "redphone/loggly"
loggly = Redphone::Loggly.new(
 :subdomain => SUBDOMAIN,
 :user => USER,
 :password => PASSWORD
)

Create an event

loggly.send_event(
  :input_key => INPUT_KEY,
  :input_type => "json",
  :event => {
    :service => "redphone",
    :message => "test"
  }
)
# OR Redphone::Loggly.send_event()

Search for previous event occurrences

loggly.search(:q => "json.service:redphone")

Faceted search results on date

loggly.facets(:q => "json.service:redphone")

Add an option for faceted search results on input name

:facet_type => "input"

Or on IP address

:facet_type => "ip"

You can add the following options for a date range

:from => "2011-08-01T12:00:00Z",
:until => "2011-10-01T12:00:00Z"

Contributors

About

A rubygem for talking to monitoring service APIs

Resources

Stars

Watchers

Forks

Packages

No packages published