class CachetMetrics

Inherits CachetClient and handles all Metrics API Calls

Public Instance Methods

create(options) click to toggle source

Create Metric.

@option options [string] :name Required Metric name @option options [string] :suffix Required Measurments in @option options [string] :description Required Description of what is measured @option options [int] :default_value Required The default value for points @option options [int] :display_chart Required Whether to display the chart on the status page @return object

# File lib/cachet.rb, line 327
def create(options)
  request method:  :post,
          url:     @base_url + 'metrics',
          payload: options
end
delete(options) click to toggle source

Delete a Metric.

@option options [string] :id Numeric Metric id @return object

# File lib/cachet.rb, line 350
def delete(options)
  request method:  :delete,
          url:     @base_url + 'metrics/' + options['id'].to_s
end
list() click to toggle source

List all Metrics.

@return object

# File lib/cachet.rb, line 312
def list
  request method:  :get,
          url:     @base_url + 'metrics'
end
list_id(options) click to toggle source

List Metric by ID Without Points.

@option options [string] :id Numeric Metric id @return object

# File lib/cachet.rb, line 339
def list_id(options)
  request method:  :get,
          url:     @base_url + 'metrics/' + options['id'].to_s
end
point_add(options) click to toggle source

Add Metric Point.

@option options [string] :id Numeric Metric id @option options [int] :value Required Value to plot on the metric graph @option options [string] :timestamp Unix timestamp of the point was measured @return object

# File lib/cachet.rb, line 374
def point_add(options)
  request method:  :post,
          url:     @base_url + 'metrics/' + options['id'].to_s + '/points',
          payload: options
end
point_delete(options) click to toggle source

Delete Metric Point.

@option options [string] :id Numeric Metric id @option options [int] :point_id Required Metric Point id @return object

# File lib/cachet.rb, line 387
def point_delete(options)
  request method:  :delete,
          url:     @base_url + 'metrics/' + options['id'].to_s + '/points/' + options['point_id'].to_s,
          payload: options
end
point_list(options) click to toggle source

List Metric Points.

@option options [string] :id Numeric Metric id @return object

# File lib/cachet.rb, line 361
def point_list(options)
  request method:  :get,
          url:     @base_url + 'metrics/' + options['id'].to_s + '/points'
end