Class: OCI::Monitoring::Models::Alarm
- Inherits:
-
Object
- Object
- OCI::Monitoring::Models::Alarm
- Defined in:
- lib/oci/monitoring/models/alarm.rb
Overview
The properties that define an alarm. For information about alarms, see [Alarms Overview](docs.cloud.oracle.com/iaas/Content/Monitoring/Concepts/monitoringoverview.htm#AlarmsOverview).
To use any of the API operations, you must be authorized in an IAM policy. If you’re not authorized, talk to an administrator. If you’re an administrator who needs to write policies to give users access, see [Getting Started with Policies](docs.cloud.oracle.com/iaas/Content/Identity/Concepts/policygetstarted.htm).
For information about endpoints and signing API requests, see [About the API](docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm). For information about available SDKs and tools, see [SDKS and Other Tools](docs.cloud.oracle.com/iaas/Content/API/Concepts/sdks.htm).
Constant Summary collapse
- SEVERITY_ENUM =
rubocop:disable Metrics/LineLength
[ SEVERITY_CRITICAL = 'CRITICAL'.freeze, SEVERITY_ERROR = 'ERROR'.freeze, SEVERITY_WARNING = 'WARNING'.freeze, SEVERITY_INFO = 'INFO'.freeze, SEVERITY_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
- LIFECYCLE_STATE_ENUM =
[ LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze, LIFECYCLE_STATE_DELETING = 'DELETING'.freeze, LIFECYCLE_STATE_DELETED = 'DELETED'.freeze, LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
Instance Attribute Summary collapse
-
#body ⇒ String
The human-readable content of the notification delivered.
-
#compartment_id ⇒ String
[Required] The [OCID](docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing the alarm.
-
#defined_tags ⇒ Hash<String, Hash<String, Object>>
Usage of predefined tag keys.
-
#destinations ⇒ Array<String>
[Required] An array of [OCIDs](docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) to which the notifications for this alarm will be delivered.
-
#display_name ⇒ String
[Required] A user-friendly name for the alarm.
-
#freeform_tags ⇒ Hash<String, String>
Simple key-value pair that is applied without any predefined name, type or scope.
-
#id ⇒ String
[Required] The [OCID](docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the alarm.
-
#is_enabled ⇒ BOOLEAN
[Required] Whether the alarm is enabled.
-
#lifecycle_state ⇒ String
[Required] The current lifecycle state of the alarm.
-
#metric_compartment_id ⇒ String
[Required] The [OCID](docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing the metric being evaluated by the alarm.
-
#metric_compartment_id_in_subtree ⇒ BOOLEAN
When true, the alarm evaluates metrics from all compartments and subcompartments.
-
#namespace ⇒ String
[Required] The source service or application emitting the metric that is evaluated by the alarm.
-
#pending_duration ⇒ String
The period of time that the condition defined in the alarm must persist before the alarm state changes from "OK" to "FIRING" or vice versa.
-
#query ⇒ String
[Required] The Monitoring Query Language (MQL) expression to evaluate for the alarm.
-
#repeat_notification_duration ⇒ String
The frequency at which notifications are re-submitted, if the alarm keeps firing without interruption.
-
#resolution ⇒ String
The time between calculated aggregation windows for the alarm.
-
#severity ⇒ String
[Required] The perceived type of response required when the alarm is in the "FIRING" state.
-
#suppression ⇒ OCI::Monitoring::Models::Suppression
The configuration details for suppressing an alarm.
-
#time_created ⇒ DateTime
[Required] The date and time the alarm was created.
-
#time_updated ⇒ DateTime
[Required] The date and time the alarm was last updated.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Alarm
constructor
Initializes the object.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
Constructor Details
#initialize(attributes = {}) ⇒ Alarm
Initializes the object
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
# File 'lib/oci/monitoring/models/alarm.rb', line 292 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.id = attributes[:'id'] if attributes[:'id'] self.display_name = attributes[:'displayName'] if attributes[:'displayName'] raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name') self.display_name = attributes[:'display_name'] if attributes[:'display_name'] self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId'] raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id') self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id'] self.metric_compartment_id = attributes[:'metricCompartmentId'] if attributes[:'metricCompartmentId'] raise 'You cannot provide both :metricCompartmentId and :metric_compartment_id' if attributes.key?(:'metricCompartmentId') && attributes.key?(:'metric_compartment_id') self.metric_compartment_id = attributes[:'metric_compartment_id'] if attributes[:'metric_compartment_id'] self.metric_compartment_id_in_subtree = attributes[:'metricCompartmentIdInSubtree'] unless attributes[:'metricCompartmentIdInSubtree'].nil? raise 'You cannot provide both :metricCompartmentIdInSubtree and :metric_compartment_id_in_subtree' if attributes.key?(:'metricCompartmentIdInSubtree') && attributes.key?(:'metric_compartment_id_in_subtree') self.metric_compartment_id_in_subtree = attributes[:'metric_compartment_id_in_subtree'] unless attributes[:'metric_compartment_id_in_subtree'].nil? self.namespace = attributes[:'namespace'] if attributes[:'namespace'] self.query = attributes[:'query'] if attributes[:'query'] self.resolution = attributes[:'resolution'] if attributes[:'resolution'] 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.destinations = attributes[:'destinations'] if attributes[:'destinations'] self.repeat_notification_duration = attributes[:'repeatNotificationDuration'] if attributes[:'repeatNotificationDuration'] raise 'You cannot provide both :repeatNotificationDuration and :repeat_notification_duration' if attributes.key?(:'repeatNotificationDuration') && attributes.key?(:'repeat_notification_duration') self.repeat_notification_duration = attributes[:'repeat_notification_duration'] if attributes[:'repeat_notification_duration'] self.suppression = attributes[:'suppression'] if attributes[:'suppression'] self.is_enabled = attributes[:'isEnabled'] unless attributes[:'isEnabled'].nil? raise 'You cannot provide both :isEnabled and :is_enabled' if attributes.key?(:'isEnabled') && attributes.key?(:'is_enabled') self.is_enabled = attributes[:'is_enabled'] unless attributes[:'is_enabled'].nil? self. = attributes[:'freeformTags'] if attributes[:'freeformTags'] raise 'You cannot provide both :freeformTags and :freeform_tags' if attributes.key?(:'freeformTags') && attributes.key?(:'freeform_tags') self. = attributes[:'freeform_tags'] if attributes[:'freeform_tags'] self. = attributes[:'definedTags'] if attributes[:'definedTags'] raise 'You cannot provide both :definedTags and :defined_tags' if attributes.key?(:'definedTags') && attributes.key?(:'defined_tags') self. = attributes[:'defined_tags'] if attributes[:'defined_tags'] self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState'] raise 'You cannot provide both :lifecycleState and :lifecycle_state' if attributes.key?(:'lifecycleState') && attributes.key?(:'lifecycle_state') self.lifecycle_state = attributes[:'lifecycle_state'] if attributes[:'lifecycle_state'] self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated'] raise 'You cannot provide both :timeCreated and :time_created' if attributes.key?(:'timeCreated') && attributes.key?(:'time_created') self.time_created = attributes[:'time_created'] if attributes[:'time_created'] self.time_updated = attributes[:'timeUpdated'] if attributes[:'timeUpdated'] raise 'You cannot provide both :timeUpdated and :time_updated' if attributes.key?(:'timeUpdated') && attributes.key?(:'time_updated') self.time_updated = attributes[:'time_updated'] if attributes[:'time_updated'] end |
Instance Attribute Details
#body ⇒ String
The human-readable content of the notification delivered. 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.`
145 146 147 |
# File 'lib/oci/monitoring/models/alarm.rb', line 145 def body @body end |
#compartment_id ⇒ String
[Required] The [OCID](docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing the alarm.
53 54 55 |
# File 'lib/oci/monitoring/models/alarm.rb', line 53 def compartment_id @compartment_id end |
#defined_tags ⇒ Hash<String, Hash<String, Object>>
Usage of predefined tag keys. These predefined keys are scoped to namespaces. Example: ‘{"CostCenter": "42"}`
187 188 189 |
# File 'lib/oci/monitoring/models/alarm.rb', line 187 def @defined_tags end |
#destinations ⇒ Array<String>
[Required] An array of [OCIDs](docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) to which the notifications for this alarm will be delivered. An example destination is an OCID for a topic managed by the Oracle Cloud Infrastructure Notification service.
152 153 154 |
# File 'lib/oci/monitoring/models/alarm.rb', line 152 def destinations @destinations end |
#display_name ⇒ String
[Required] A user-friendly name for the alarm. It does not have to be unique, and it’s changeable. Avoid entering confidential information.
This name is sent as the title for notifications related to this alarm.
Example: ‘High CPU Utilization`
48 49 50 |
# File 'lib/oci/monitoring/models/alarm.rb', line 48 def display_name @display_name end |
#freeform_tags ⇒ Hash<String, String>
Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: ‘"Finance"`
181 182 183 |
# File 'lib/oci/monitoring/models/alarm.rb', line 181 def @freeform_tags end |
#id ⇒ String
[Required] The [OCID](docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the alarm.
38 39 40 |
# File 'lib/oci/monitoring/models/alarm.rb', line 38 def id @id end |
#is_enabled ⇒ BOOLEAN
[Required] Whether the alarm is enabled.
Example: ‘true`
175 176 177 |
# File 'lib/oci/monitoring/models/alarm.rb', line 175 def is_enabled @is_enabled end |
#lifecycle_state ⇒ String
[Required] The current lifecycle state of the alarm.
Example: ‘DELETED`
194 195 196 |
# File 'lib/oci/monitoring/models/alarm.rb', line 194 def lifecycle_state @lifecycle_state end |
#metric_compartment_id ⇒ String
[Required] The [OCID](docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing the metric being evaluated by the alarm.
59 60 61 |
# File 'lib/oci/monitoring/models/alarm.rb', line 59 def metric_compartment_id @metric_compartment_id end |
#metric_compartment_id_in_subtree ⇒ BOOLEAN
When true, the alarm evaluates metrics from all compartments and subcompartments. The parameter can only be set to true when metricCompartmentId is the tenancy OCID (the tenancy is the root compartment). A true value requires the user to have tenancy-level permissions. If this requirement is not met, then the call is rejected. When false, the alarm evaluates metrics from only the compartment specified in metricCompartmentId. Default is false.
Example: ‘true`
70 71 72 |
# File 'lib/oci/monitoring/models/alarm.rb', line 70 def metric_compartment_id_in_subtree @metric_compartment_id_in_subtree end |
#namespace ⇒ String
[Required] The source service or application emitting the metric that is evaluated by the alarm.
Example: ‘oci_computeagent`
77 78 79 |
# File 'lib/oci/monitoring/models/alarm.rb', line 77 def namespace @namespace end |
#pending_duration ⇒ String
The period of time that the condition defined in the alarm must persist before the alarm state changes from "OK" to "FIRING" or vice versa. 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"; likewise, the alarm must persist in not breaching the condition for five minutes before the alarm updates its state to "OK."
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" and the first evaluation that does not breach the alarm updates the state to "OK".
Example: ‘PT5M`
129 130 131 |
# File 'lib/oci/monitoring/models/alarm.rb', line 129 def pending_duration @pending_duration end |
#query ⇒ String
[Required] 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: ‘1m`-`60m` (also `1h`). You can optionally specify dimensions and grouping functions. Supported grouping functions: `grouping()`, `groupBy()`. For details about Monitoring Query Language (MQL), see [Monitoring Query Language (MQL) Reference](docs.cloud.oracle.com/iaas/Content/Monitoring/Reference/mql.htm). For available dimensions, review the metric definition for the supported service. See [Supported Services](docs.cloud.oracle.com/iaas/Content/Monitoring/Concepts/monitoringoverview.htm#SupportedServices).
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()
-----
106 107 108 |
# File 'lib/oci/monitoring/models/alarm.rb', line 106 def query @query end |
#repeat_notification_duration ⇒ String
The frequency at which notifications are re-submitted, if the alarm keeps firing without interruption. Format defined by ISO 8601. For example, ‘PT4H` indicates four hours. Minimum: PT1M. Maximum: P30D.
Default value: null (notifications are not re-submitted).
Example: ‘PT2H`
163 164 165 |
# File 'lib/oci/monitoring/models/alarm.rb', line 163 def repeat_notification_duration @repeat_notification_duration end |
#resolution ⇒ String
The time between calculated aggregation windows for the alarm. Supported value: ‘1m`
111 112 113 |
# File 'lib/oci/monitoring/models/alarm.rb', line 111 def resolution @resolution end |
#severity ⇒ String
[Required] The perceived type of response required when the alarm is in the "FIRING" state.
Example: ‘CRITICAL`
136 137 138 |
# File 'lib/oci/monitoring/models/alarm.rb', line 136 def severity @severity end |
#suppression ⇒ OCI::Monitoring::Models::Suppression
The configuration details for suppressing an alarm.
168 169 170 |
# File 'lib/oci/monitoring/models/alarm.rb', line 168 def suppression @suppression end |
#time_created ⇒ DateTime
[Required] The date and time the alarm was created. Format defined by RFC3339.
Example: ‘2019-02-01T01:02:29.600Z`
201 202 203 |
# File 'lib/oci/monitoring/models/alarm.rb', line 201 def time_created @time_created end |
#time_updated ⇒ DateTime
[Required] The date and time the alarm was last updated. Format defined by RFC3339.
Example: ‘2019-02-03T01:02:29.600Z`
208 209 210 |
# File 'lib/oci/monitoring/models/alarm.rb', line 208 def time_updated @time_updated end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/oci/monitoring/models/alarm.rb', line 211 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'id': :'id', 'display_name': :'displayName', 'compartment_id': :'compartmentId', 'metric_compartment_id': :'metricCompartmentId', 'metric_compartment_id_in_subtree': :'metricCompartmentIdInSubtree', 'namespace': :'namespace', 'query': :'query', 'resolution': :'resolution', 'pending_duration': :'pendingDuration', 'severity': :'severity', 'body': :'body', 'destinations': :'destinations', 'repeat_notification_duration': :'repeatNotificationDuration', 'suppression': :'suppression', 'is_enabled': :'isEnabled', 'freeform_tags': :'freeformTags', 'defined_tags': :'definedTags', 'lifecycle_state': :'lifecycleState', 'time_created': :'timeCreated', 'time_updated': :'timeUpdated' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
# File 'lib/oci/monitoring/models/alarm.rb', line 239 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'id': :'String', 'display_name': :'String', 'compartment_id': :'String', 'metric_compartment_id': :'String', 'metric_compartment_id_in_subtree': :'BOOLEAN', 'namespace': :'String', 'query': :'String', 'resolution': :'String', 'pending_duration': :'String', 'severity': :'String', 'body': :'String', 'destinations': :'Array<String>', 'repeat_notification_duration': :'String', 'suppression': :'OCI::Monitoring::Models::Suppression', 'is_enabled': :'BOOLEAN', 'freeform_tags': :'Hash<String, String>', 'defined_tags': :'Hash<String, Hash<String, Object>>', 'lifecycle_state': :'String', 'time_created': :'DateTime', 'time_updated': :'DateTime' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 |
# File 'lib/oci/monitoring/models/alarm.rb', line 424 def ==(other) return true if equal?(other) self.class == other.class && id == other.id && display_name == other.display_name && compartment_id == other.compartment_id && metric_compartment_id == other.metric_compartment_id && metric_compartment_id_in_subtree == other.metric_compartment_id_in_subtree && namespace == other.namespace && query == other.query && resolution == other.resolution && pending_duration == other.pending_duration && severity == other.severity && body == other.body && destinations == other.destinations && repeat_notification_duration == other.repeat_notification_duration && suppression == other.suppression && is_enabled == other.is_enabled && == other. && == other. && lifecycle_state == other.lifecycle_state && time_created == other.time_created && time_updated == other.time_updated end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 |
# File 'lib/oci/monitoring/models/alarm.rb', line 473 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
453 454 455 |
# File 'lib/oci/monitoring/models/alarm.rb', line 453 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
462 463 464 |
# File 'lib/oci/monitoring/models/alarm.rb', line 462 def hash [id, display_name, compartment_id, metric_compartment_id, metric_compartment_id_in_subtree, namespace, query, resolution, pending_duration, severity, body, destinations, repeat_notification_duration, suppression, is_enabled, , , lifecycle_state, time_created, time_updated].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
506 507 508 509 510 511 512 513 514 515 |
# File 'lib/oci/monitoring/models/alarm.rb', line 506 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_s ⇒ String
Returns the string representation of the object
500 501 502 |
# File 'lib/oci/monitoring/models/alarm.rb', line 500 def to_s to_hash.to_s end |