Scout API

Query for metric data, manage servers, and more through the scout_api Ruby gem. Read the full gem documentation or follow the quick start guide below.

Installation and Authentication

Install the gem:

gem install scout_api

Require the gem and authenticate to get your Scout on:

require 'scout_api'
scout = Scout::Account.new('account_url_param', 'your@awesome.com', 'sekret')

Finding Objects

You can query for the following high-level objects:

  • Scout::Server
  • Scout::Metric

These classes have Rails-like finder methods. For example:

# all servers
Scout::Server.all

# first server
Scout::Server.first

# first metric with ID=1
Scout::Metric.first(1) 

Metrics

Access your metric data stored in Scout. You can retrieve data for a specific metric or aggregated metrics. For example:

# average value of the metric with ID=1 over the past hour
Scout::Metric.average(1)

# maximum rate of insert queries over the previous 24 hours
Scout::Server.first(:name => "DB Server").metrics.maximum(:name => 'inserts', 
:start => Time.now.utc-(24*3600)*2,:end => Time.now.utc-(24*3600) )

# throughput for just the "Beta App" plugin - use "/" to separate the plugin name and metric name (PLUGIN NAME/METRIC NAME)
Scout::Server.first(:name => 'web1.scoutapp.com').metrics.average(:name => 'Beta App/request_rate', :aggregate => true)

Server Management

Create and delete servers:

# create a server using the server with id=6 as the template.
Scout::Server.create('heavy metal',:id => 6)

# delete the server with id=10
Scout::Server.delete(10)

Going Deeper

View the gem documentation or browse the source on Github.

HomeFeaturesPricing & SignupPluginsAPIHelpBlogTwitterAbout