Class: OCI::Monitoring::Models::AlarmOverride

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/monitoring/models/alarm_override.rb

Overview

Values to use for an independent evaluation of the alarm. You can specify values for query, severity, body, and pending duration. When an alarm contains overrides, the Monitoring service evaluates each override in order, beginning with the first override in the array (index position 0), and then evaluates the alarm's base values (ruleName value of BASE)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AlarmOverride

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):

  • :pending_duration (String)

    The value to assign to the #pending_duration property

  • :severity (String)

    The value to assign to the #severity property

  • :body (String)

    The value to assign to the #body property

  • :rule_name (String)

    The value to assign to the #rule_name property

  • :query (String)

    The value to assign to the #query property



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/oci/monitoring/models/alarm_override.rb', line 126

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.pending_duration = attributes[:'pendingDuration'] if attributes[:'pendingDuration']

  raise 'You cannot provide both :pendingDuration and :pending_duration' if attributes.key?(:'pendingDuration') && attributes.key?(:'pending_duration')

  self.pending_duration = attributes[:'pending_duration'] if attributes[:'pending_duration']

  self.severity = attributes[:'severity'] if attributes[:'severity']

  self.body = attributes[:'body'] if attributes[:'body']

  self.rule_name = attributes[:'ruleName'] if attributes[:'ruleName']

  raise 'You cannot provide both :ruleName and :rule_name' if attributes.key?(:'ruleName') && attributes.key?(:'rule_name')

  self.rule_name = attributes[:'rule_name'] if attributes[:'rule_name']

  self.query = attributes[:'query'] if attributes[:'query']
end

Instance Attribute Details

#bodyString

The human-readable content of the delivered alarm notification. Oracle recommends providing guidance to operators for resolving the alarm condition. Consider adding links to standard runbook practices. Avoid entering confidential information.

Example: High CPU usage alert. Follow runbook instructions for resolution.

Returns:

  • (String)


49
50
51
# File 'lib/oci/monitoring/models/alarm_override.rb', line 49

def body
  @body
end

#pending_durationString

The period of time that the condition defined in the alarm must persist before the alarm state changes from "OK" to "FIRING". For example, a value of 5 minutes means that the alarm must persist in breaching the condition for five minutes before the alarm updates its state to "FIRING".

The duration is specified as a string in ISO 8601 format (PT10M for ten minutes or PT1H for one hour). Minimum: PT1M. Maximum: PT1H. Default: PT1M.

Under the default value of PT1M, the first evaluation that breaches the alarm updates the state to "FIRING".

The alarm updates its status to "OK" when the breaching condition has been clear for the most recent minute.

Example: PT5M

Returns:

  • (String)


33
34
35
# File 'lib/oci/monitoring/models/alarm_override.rb', line 33

def pending_duration
  @pending_duration
end

#queryString

The Monitoring Query Language (MQL) expression to evaluate for the alarm. The Alarms feature of the Monitoring service interprets results for each returned time series as Boolean values, where zero represents false and a non-zero value represents true. A true value means that the trigger rule condition has been met. The query must specify a metric, statistic, interval, and trigger rule (threshold or absence). Supported values for interval depend on the specified time range. More interval values are supported for smaller time ranges. You can optionally specify dimensions and grouping functions. Supported grouping functions: grouping(), groupBy(). For information about writing MQL expressions, see Editing the MQL Expression for a Query. For details about MQL, see Monitoring Query Language (MQL) Reference. For available dimensions, review the metric definition for the supported service. See Supported Services.

Example of threshold alarm:


CpuUtilization[1m]{availabilityDomain=\"cumS:PHX-AD-1\"}.groupBy(availabilityDomain).percentile(0.9) > 85

Example of absence alarm:


CpuUtilization[1m]{availabilityDomain=\"cumS:PHX-AD-1\"}.absent()

Returns:

  • (String)


87
88
89
# File 'lib/oci/monitoring/models/alarm_override.rb', line 87

def query
  @query
end

#rule_nameString

A user-friendly description for this alarm override. Must be unique across all ruleName values for the alarm.

Returns:

  • (String)


54
55
56
# File 'lib/oci/monitoring/models/alarm_override.rb', line 54

def rule_name
  @rule_name
end

#severityString

The perceived severity of the alarm with regard to the affected system.

Example: CRITICAL

Returns:

  • (String)


40
41
42
# File 'lib/oci/monitoring/models/alarm_override.rb', line 40

def severity
  @severity
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



90
91
92
93
94
95
96
97
98
99
100
# File 'lib/oci/monitoring/models/alarm_override.rb', line 90

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'pending_duration': :'pendingDuration',
    'severity': :'severity',
    'body': :'body',
    'rule_name': :'ruleName',
    'query': :'query'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



103
104
105
106
107
108
109
110
111
112
113
# File 'lib/oci/monitoring/models/alarm_override.rb', line 103

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'pending_duration': :'String',
    'severity': :'String',
    'body': :'String',
    'rule_name': :'String',
    'query': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



158
159
160
161
162
163
164
165
166
167
# File 'lib/oci/monitoring/models/alarm_override.rb', line 158

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    pending_duration == other.pending_duration &&
    severity == other.severity &&
    body == other.body &&
    rule_name == other.rule_name &&
    query == other.query
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/oci/monitoring/models/alarm_override.rb', line 192

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


172
173
174
# File 'lib/oci/monitoring/models/alarm_override.rb', line 172

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



181
182
183
# File 'lib/oci/monitoring/models/alarm_override.rb', line 181

def hash
  [pending_duration, severity, body, rule_name, query].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



225
226
227
228
229
230
231
232
233
234
# File 'lib/oci/monitoring/models/alarm_override.rb', line 225

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



219
220
221
# File 'lib/oci/monitoring/models/alarm_override.rb', line 219

def to_s
  to_hash.to_s
end