Class: CachetMetrics

Inherits:
CachetClient show all
Defined in:
lib/cachet.rb

Constant Summary

Constants inherited from CachetClient

CachetClient::INCIDENT_FIXED, CachetClient::INCIDENT_IDENTIFIED, CachetClient::INCIDENT_INVESTIGATING, CachetClient::INCIDENT_SCHEDULED, CachetClient::INCIDENT_WATCHING, CachetClient::STATUS_MAJOR_OUTAGE, CachetClient::STATUS_OPERATIONAL, CachetClient::STATUS_PARTIAL_OUTAGE, CachetClient::STATUS_PERFORMANCE_ISSUES, CachetClient::VERSION

Instance Method Summary collapse

Methods inherited from CachetClient

#initialize, #ping, #request

Constructor Details

This class inherits a constructor from CachetClient

Instance Method Details

#create(options) ⇒ Object

Create Metric.

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :name (string)

    *Required* Metric name

  • :suffix (string)

    *Required* Measurments in

  • :description (string)

    *Required* Description of what is measured

  • :default_value (int)

    *Required* The default value for points

  • :display_chart (int)

    Whether to display the chart on the status page

Returns:

  • object


293
294
295
296
297
# File 'lib/cachet.rb', line 293

def create(options)
  request method:  :post,
          url:     @base_url + 'metrics',
          payload: options
end

#delete(options) ⇒ Object

Delete a Metric.

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :id (string)

    Numeric Metric id

Returns:

  • object


316
317
318
319
# File 'lib/cachet.rb', line 316

def delete(options)
  request method:  :delete,
          url:     @base_url + 'metrics/' + options['id']
end

#listObject

List all Metrics.

Returns:

  • object


278
279
280
281
# File 'lib/cachet.rb', line 278

def list
  request method:  :get,
          url:     @base_url + 'metrics'
end

#list_id(options) ⇒ Object

List Metric by ID Without Points.

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :id (string)

    Numeric Metric id

Returns:

  • object


305
306
307
308
# File 'lib/cachet.rb', line 305

def list_id(options)
  request method:  :get,
          url:     @base_url + 'metrics/' + options['id']
end

#point_add(options) ⇒ Object

Add Metric Point.

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :id (string)

    Numeric Metric id

  • :value (int)

    *Required* Value to plot on the metric graph

  • :timestamp (string)

    Unix timestamp of the point was measured

Returns:

  • object


340
341
342
343
344
# File 'lib/cachet.rb', line 340

def point_add(options)
  request method:  :post,
          url:     @base_url + 'metrics/' + options['id'] + '/points',
          payload: options
end

#point_delete(options) ⇒ Object

Delete Metric Point.

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :id (string)

    Numeric Metric id

  • :point_id (int)

    *Required* Metric Point id

Returns:

  • object


353
354
355
356
357
# File 'lib/cachet.rb', line 353

def point_delete(options)
  request method:  :delete,
          url:     @base_url + 'metrics/' + options['id'] + '/points/' + options['point_id'],
          payload: options
end

#point_list(options) ⇒ Object

List Metric Points.

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (options):

  • :id (string)

    Numeric Metric id

Returns:

  • object


327
328
329
330
# File 'lib/cachet.rb', line 327

def point_list(options)
  request method:  :get,
          url:     @base_url + 'metrics/' + options['id'] + '/points'
end