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



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/oci/monitoring/models/alarm_override.rb', line 138

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. Optionally include dynamic variables. 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)


51
52
53
# File 'lib/oci/monitoring/models/alarm_override.rb', line 51

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. Also, you can customize the absence detection period. 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()

—– Example of absence alarm with custom absence detection period of 20 hours:


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

Returns:

  • (String)


99
100
101
# File 'lib/oci/monitoring/models/alarm_override.rb', line 99

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)


56
57
58
# File 'lib/oci/monitoring/models/alarm_override.rb', line 56

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.



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

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.



115
116
117
118
119
120
121
122
123
124
125
# File 'lib/oci/monitoring/models/alarm_override.rb', line 115

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



170
171
172
173
174
175
176
177
178
179
# File 'lib/oci/monitoring/models/alarm_override.rb', line 170

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



204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/oci/monitoring/models/alarm_override.rb', line 204

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


184
185
186
# File 'lib/oci/monitoring/models/alarm_override.rb', line 184

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



193
194
195
# File 'lib/oci/monitoring/models/alarm_override.rb', line 193

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



237
238
239
240
241
242
243
244
245
246
# File 'lib/oci/monitoring/models/alarm_override.rb', line 237

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



231
232
233
# File 'lib/oci/monitoring/models/alarm_override.rb', line 231

def to_s
  to_hash.to_s
end