Class: Wavefront::Alerting

Inherits:
Object
  • Object
show all
Includes:
Constants, Mixins, Validators
Defined in:
lib/wavefront/alerting.rb

Constant Summary collapse

DEFAULT_PATH =
'/api/alert/'

Constants included from Constants

Constants::ALERT_FORMATS, Constants::DEFAULT_ALERT_FORMAT, Constants::DEFAULT_FORMAT, Constants::DEFAULT_HOST, Constants::DEFAULT_INFILE_FORMAT, Constants::DEFAULT_OBSOLETE_METRICS, Constants::DEFAULT_OPTS, Constants::DEFAULT_PERIOD_SECONDS, Constants::DEFAULT_PREFIX_LENGTH, Constants::DEFAULT_PROXY, Constants::DEFAULT_PROXY_PORT, Constants::DEFAULT_SOURCE_FORMAT, Constants::DEFAULT_STRICT, Constants::EVENT_LEVELS, Constants::EVENT_STATE_DIR, Constants::FORMATS, Constants::GRANULARITIES, Constants::SOURCE_FORMATS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Mixins

#hash_to_qs, #interpolate_schema, #parse_time, #time_to_ms, #uri_concat

Methods included from Validators

#valid_path?, #valid_source?, #valid_string?, #valid_tags?, #valid_ts?, #valid_value?

Constructor Details

#initialize(token, host = DEFAULT_HOST, debug = false, options = {}) ⇒ Alerting

Returns a new instance of Alerting.



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/wavefront/alerting.rb', line 34

def initialize(token, host = DEFAULT_HOST, debug=false, options = {})
  #
  # Following existing convention, 'host' is the Wavefront API endpoint.
  #
  @headers = { :'X-AUTH-TOKEN' => token }
  @endpoint = host
  @token = token
  debug(debug)
  @noop = options[:noop]
  @verbose = options[:verbose]
end

Instance Attribute Details

#endpointObject (readonly)

Returns the value of attribute endpoint.



32
33
34
# File 'lib/wavefront/alerting.rb', line 32

def endpoint
  @endpoint
end

#noopObject (readonly)

Returns the value of attribute noop.



32
33
34
# File 'lib/wavefront/alerting.rb', line 32

def noop
  @noop
end

#tokenObject (readonly)

Returns the value of attribute token.



32
33
34
# File 'lib/wavefront/alerting.rb', line 32

def token
  @token
end

#verboseObject (readonly)

Returns the value of attribute verbose.



32
33
34
# File 'lib/wavefront/alerting.rb', line 32

def verbose
  @verbose
end

Instance Method Details

#active(options = {}) ⇒ Object



46
47
48
# File 'lib/wavefront/alerting.rb', line 46

def active(options={})
  get_alerts('active', options)
end

#affected_by_maintenance(options = {}) ⇒ Object



62
63
64
# File 'lib/wavefront/alerting.rb', line 62

def affected_by_maintenance(options={})
  get_alerts('affected_by_maintenance', options)
end

#all(options = {}) ⇒ Object



50
51
52
# File 'lib/wavefront/alerting.rb', line 50

def all(options={})
  get_alerts('all', options)
end

#invalid(options = {}) ⇒ Object



54
55
56
# File 'lib/wavefront/alerting.rb', line 54

def invalid(options={})
  get_alerts('invalid', options)
end

#snoozed(options = {}) ⇒ Object



58
59
60
# File 'lib/wavefront/alerting.rb', line 58

def snoozed(options={})
  get_alerts('snoozed', options)
end