Class: NewRelicApi::ThresholdValue
- Inherits:
-
BaseResource
- Object
- ActiveResource::Base
- BaseResource
- NewRelicApi::ThresholdValue
- 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
-
#color_value ⇒ Object
Returns the color value for this threshold (Gray, Green, Yellow or Red).
-
#metric_value ⇒ Object
Return the actual value of the threshold as a Float.
-
#threshold_value ⇒ Object
Return theshold_value as 0, 1, 2, or 3 representing grey (not reporting) green, yellow, and red, respectively.
-
#to_s ⇒ Object
:nodoc:.
Methods inherited from BaseResource
headers, inherited, proxy, reset!, site_url
Instance Method Details
#color_value ⇒ Object
Returns the color value for this threshold (Gray, Green, Yellow or Red).
154 155 156 157 158 159 160 161 |
# File 'lib/new_relic_api.rb', line 154 def color_value case threshold_value when 3 then 'Red' when 2 then 'Yellow' when 1 then 'Green' else 'Gray' end end |
#metric_value ⇒ Object
Return the actual value of the threshold as a Float
150 151 152 |
# File 'lib/new_relic_api.rb', line 150 def metric_value super.to_f end |
#threshold_value ⇒ Object
Return theshold_value as 0, 1, 2, or 3 representing grey (not reporting) green, yellow, and red, respectively.
145 146 147 |
# File 'lib/new_relic_api.rb', line 145 def threshold_value super.to_i end |
#to_s ⇒ Object
:nodoc:
163 164 165 |
# File 'lib/new_relic_api.rb', line 163 def to_s #:nodoc: "#{name}: #{color_value} (#{formatted_metric_value})" end |