Class: NewRelicApi::ThresholdValue

Inherits:
BaseResource
  • Object
show all
Defined in:
lib/new_relic_api.rb

Overview

A threshold value represents a single health indicator for an application such as CPU, memory or response time.

Fields

name

The name of the threshold setting associated with this threshold value.

begin_time

Time value indicating start of evaluation period, as a string.

threshold_value

A value of 0, 1, 2 or 3 representing gray (not reporting), green, yellow and red

metric_value

The metric value associated with this threshold

Instance Method Summary collapse

Methods inherited from BaseResource

headers, inherited, reset!, site_url

Instance Method Details

#color_valueObject

Returns the color value for this threshold (Gray, Green, Yellow or Red).



146
147
148
149
150
151
152
153
# File 'lib/new_relic_api.rb', line 146

def color_value
  case threshold_value
    when 3 then 'Red'
    when 2 then 'Yellow'
    when 1 then 'Green'
  else 'Gray'
  end
end

#metric_valueObject

Return the actual value of the threshold as a Float



142
143
144
# File 'lib/new_relic_api.rb', line 142

def metric_value
  super.to_f
end

#threshold_valueObject

Return theshold_value as 0, 1, 2, or 3 representing grey (not reporting) green, yellow, and red, respectively.



137
138
139
# File 'lib/new_relic_api.rb', line 137

def threshold_value
  super.to_i
end

#to_sObject

:nodoc:



155
156
157
# File 'lib/new_relic_api.rb', line 155

def to_s #:nodoc:
  "#{name}: #{color_value} (#{formatted_metric_value})"
end