Alarm

class oci.monitoring.models.Alarm(**kwargs)

Bases: object

The properties that define an alarm. For information about alarms, see Alarms Overview.

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.

For information about endpoints and signing API requests, see About the API. For information about available SDKs and tools, see SDKS and Other Tools.

LIFECYCLE_STATE_ACTIVE = 'ACTIVE'

A constant which can be used with the lifecycle_state property of a Alarm. This constant has a value of "ACTIVE"

LIFECYCLE_STATE_DELETED = 'DELETED'

A constant which can be used with the lifecycle_state property of a Alarm. This constant has a value of "DELETED"

LIFECYCLE_STATE_DELETING = 'DELETING'

A constant which can be used with the lifecycle_state property of a Alarm. This constant has a value of "DELETING"

SEVERITY_CRITICAL = 'CRITICAL'

A constant which can be used with the severity property of a Alarm. This constant has a value of "CRITICAL"

SEVERITY_ERROR = 'ERROR'

A constant which can be used with the severity property of a Alarm. This constant has a value of "ERROR"

SEVERITY_INFO = 'INFO'

A constant which can be used with the severity property of a Alarm. This constant has a value of "INFO"

SEVERITY_WARNING = 'WARNING'

A constant which can be used with the severity property of a Alarm. This constant has a value of "WARNING"

__init__(**kwargs)

Initializes a new Alarm object with values from keyword arguments. The following keyword arguments are supported (corresponding to the getters/setters of this class):

Parameters:
  • id (str) -- The value to assign to the id property of this Alarm.
  • display_name (str) -- The value to assign to the display_name property of this Alarm.
  • compartment_id (str) -- The value to assign to the compartment_id property of this Alarm.
  • metric_compartment_id (str) -- The value to assign to the metric_compartment_id property of this Alarm.
  • metric_compartment_id_in_subtree (bool) -- The value to assign to the metric_compartment_id_in_subtree property of this Alarm.
  • namespace (str) -- The value to assign to the namespace property of this Alarm.
  • resource_group (str) -- The value to assign to the resource_group property of this Alarm.
  • query (str) -- The value to assign to the query property of this Alarm.
  • resolution (str) -- The value to assign to the resolution property of this Alarm.
  • pending_duration (str) -- The value to assign to the pending_duration property of this Alarm.
  • severity (str) -- The value to assign to the severity property of this Alarm. Allowed values for this property are: "CRITICAL", "ERROR", "WARNING", "INFO", 'UNKNOWN_ENUM_VALUE'. Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
  • body (str) -- The value to assign to the body property of this Alarm.
  • destinations (list[str]) -- The value to assign to the destinations property of this Alarm.
  • repeat_notification_duration (str) -- The value to assign to the repeat_notification_duration property of this Alarm.
  • suppression (Suppression) -- The value to assign to the suppression property of this Alarm.
  • is_enabled (bool) -- The value to assign to the is_enabled property of this Alarm.
  • freeform_tags (dict(str, str)) -- The value to assign to the freeform_tags property of this Alarm.
  • defined_tags (dict(str, dict(str, object))) -- The value to assign to the defined_tags property of this Alarm.
  • lifecycle_state (str) -- The value to assign to the lifecycle_state property of this Alarm. Allowed values for this property are: "ACTIVE", "DELETING", "DELETED", 'UNKNOWN_ENUM_VALUE'. Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
  • time_created (datetime) -- The value to assign to the time_created property of this Alarm.
  • time_updated (datetime) -- The value to assign to the time_updated property of this Alarm.
body

Gets the body of this Alarm. 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.

Returns:The body of this Alarm.
Return type:str
compartment_id

[Required] Gets the compartment_id of this Alarm. The OCID of the compartment containing the alarm.

Returns:The compartment_id of this Alarm.
Return type:str
defined_tags

Gets the defined_tags of this Alarm. Usage of predefined tag keys. These predefined keys are scoped to namespaces. Example: {"Operations": {"CostCenter": "42"}}

Returns:The defined_tags of this Alarm.
Return type:dict(str, dict(str, object))
destinations

[Required] Gets the destinations of this Alarm. A list of destinations to which the notifications for this alarm will be delivered. Each destination is represented by an OCID related to the supported destination service. For example, a destination using the Notifications service is represented by a topic OCID. Supported destination services: Notifications Service. Limit: One destination per supported destination service.

Returns:The destinations of this Alarm.
Return type:list[str]
display_name

[Required] Gets the display_name of this Alarm. 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

Returns:The display_name of this Alarm.
Return type:str
freeform_tags

Gets the freeform_tags of this Alarm. Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: {"Department": "Finance"}

Returns:The freeform_tags of this Alarm.
Return type:dict(str, str)
id

[Required] Gets the id of this Alarm. The OCID of the alarm.

Returns:The id of this Alarm.
Return type:str
is_enabled

[Required] Gets the is_enabled of this Alarm. Whether the alarm is enabled.

Example: true

Returns:The is_enabled of this Alarm.
Return type:bool
lifecycle_state

[Required] Gets the lifecycle_state of this Alarm. The current lifecycle state of the alarm.

Example: DELETED

Allowed values for this property are: "ACTIVE", "DELETING", "DELETED", 'UNKNOWN_ENUM_VALUE'. Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.

Returns:The lifecycle_state of this Alarm.
Return type:str
metric_compartment_id

[Required] Gets the metric_compartment_id of this Alarm. The OCID of the compartment containing the metric being evaluated by the alarm.

Returns:The metric_compartment_id of this Alarm.
Return type:str
metric_compartment_id_in_subtree

Gets the metric_compartment_id_in_subtree of this Alarm. 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

Returns:The metric_compartment_id_in_subtree of this Alarm.
Return type:bool
namespace

[Required] Gets the namespace of this Alarm. The source service or application emitting the metric that is evaluated by the alarm.

Example: oci_computeagent

Returns:The namespace of this Alarm.
Return type:str
pending_duration

Gets the pending_duration of this Alarm. 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:The pending_duration of this Alarm.
Return type:str
query

[Required] Gets the query of this Alarm. 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. 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:The query of this Alarm.
Return type:str
repeat_notification_duration

Gets the repeat_notification_duration of this Alarm. 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

Returns:The repeat_notification_duration of this Alarm.
Return type:str
resolution

Gets the resolution of this Alarm. The time between calculated aggregation windows for the alarm. Supported value: 1m

Returns:The resolution of this Alarm.
Return type:str
resource_group

Gets the resource_group of this Alarm. Resource group specified as a filter for metric data retrieved by the alarm. A resource group is a custom string that can be used as a filter. Only one resource group can be applied per metric. A valid resourceGroup value starts with an alphabetical character and includes only alphanumeric characters, periods (.), underscores (_), hyphens (-), and dollar signs ($). Avoid entering confidential information.

Example: frontend-fleet

Returns:The resource_group of this Alarm.
Return type:str
severity

[Required] Gets the severity of this Alarm. The perceived type of response required when the alarm is in the "FIRING" state.

Example: CRITICAL

Allowed values for this property are: "CRITICAL", "ERROR", "WARNING", "INFO", 'UNKNOWN_ENUM_VALUE'. Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.

Returns:The severity of this Alarm.
Return type:str
suppression

Gets the suppression of this Alarm. The configuration details for suppressing an alarm.

Returns:The suppression of this Alarm.
Return type:Suppression
time_created

[Required] Gets the time_created of this Alarm. The date and time the alarm was created. Format defined by RFC3339.

Example: 2019-02-01T01:02:29.600Z

Returns:The time_created of this Alarm.
Return type:datetime
time_updated

[Required] Gets the time_updated of this Alarm. The date and time the alarm was last updated. Format defined by RFC3339.

Example: 2019-02-03T01:02:29.600Z

Returns:The time_updated of this Alarm.
Return type:datetime