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 ='account_url_param', '', '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

# first server

# first metric with ID=1


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

# maximum rate of insert queries over the previous 24 hours
Scout::Server.first(:name => "DB Server").metrics.maximum(:name => 'inserts', 
:start =>*3600)*2,:end =>*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 => '').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

Going Deeper

View the gem documentation or browse the source on Github.

HomeFeaturesPricing & SignupPluginsAPIHelpBlogTwitterAbout