oracle.oci.oci_monitoring_alarm – Manage an Alarm resource in Oracle Cloud Infrastructure¶
Note
This plugin is part of the oracle.oci collection (version 5.5.0).
You might already have this collection installed if you are using the ansible package.
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install oracle.oci.
To use it in a playbook, specify: oracle.oci.oci_monitoring_alarm.
New in version 2.9.0: of oracle.oci
Synopsis¶
This module allows the user to create, update and delete an Alarm resource in Oracle Cloud Infrastructure
For state=present, creates a new alarm in the specified compartment. For more information, see Creating an Alarm. For important limits information, see Limits on Monitoring.
This call is subject to a Monitoring limit that applies to the total number of requests across all alarm operations. Monitoring might throttle this call to reject an otherwise valid request when the total rate of alarm operations exceeds 10 requests, or transactions, per second (TPS) for a given tenancy.
This resource has the following action operations in the oracle.oci.oci_monitoring_alarm_actions module: change_compartment, remove_alarm_suppression.
Requirements¶
The below requirements are needed on the host that executes this module.
python >= 3.6
Python SDK for Oracle Cloud Infrastructure https://oracle-cloud-infrastructure-python-sdk.readthedocs.io
Parameters¶
| Parameter | Choices/Defaults | Comments | |
|---|---|---|---|
| 
                
                alarm_id
                
                 
                    string
                                                                 
                                                     | 
                            
                                         The OCID of an alarm. 
                                        Required for update using state=present when environment variable  
                                        OCI_USE_NAME_AS_IDENTIFIER is not set.Required for delete using state=absent when environment variable  
                                                            OCI_USE_NAME_AS_IDENTIFIER is not set.aliases: id  | 
        ||
| 
                
                alarm_summary
                
                 
                    string
                                                                 
                                                     | 
                            
                                         Customizable alarm summary (`alarmSummary` alarm message parameter). Optionally include dynamic variables. The alarm summary appears within the body of the alarm message and in responses to ListAlarmStatus GetAlarmHistory and RetrieveDimensionStates. 
                                        This parameter is updatable. 
                                                     | 
        ||
| 
                
                api_user
                
                 
                    string
                                                                 
                                                     | 
                            
                                         The OCID of the user, on whose behalf, OCI APIs are invoked. If not set, then the value of the OCI_USER_ID environment variable, if any, is used. This option is required if the user is not specified through a configuration file (See  
                                                    config_file_location). To get the user's OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm. | 
        ||
| 
                
                api_user_fingerprint
                
                 
                    string
                                                                 
                                                     | 
                            
                                         Fingerprint for the key pair being used. If not set, then the value of the OCI_USER_FINGERPRINT environment variable, if any, is used. This option is required if the key fingerprint is not specified through a configuration file (See  
                                                    config_file_location). To get the key pair's fingerprint value please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm. | 
        ||
| 
                
                api_user_key_file
                
                 
                    string
                                                                 
                                                     | 
                            
                                         Full path and filename of the private key (in PEM format). If not set, then the value of the OCI_USER_KEY_FILE variable, if any, is used. This option is required if the private key is not specified through a configuration file (See  
                                                    config_file_location). If the key is encrypted with a pass-phrase, the api_user_key_pass_phrase option must also be provided. | 
        ||
| 
                
                api_user_key_pass_phrase
                
                 
                    string
                                                                 
                                                     | 
                            
                                         Passphrase used by the key referenced in  
                                                    api_user_key_file, if it is encrypted. If not set, then the value of the OCI_USER_KEY_PASS_PHRASE variable, if any, is used. This option is required if the key passphrase is not specified through a configuration file (See config_file_location). | 
        ||
| 
                
                auth_purpose
                
                 
                    string
                                                                 
                                                     | 
                            
                                                                                                                        
  | 
                                                            
                                         The auth purpose which can be used in conjunction with 'auth_type=instance_principal'. The default auth_purpose for instance_principal is None. 
                                                     | 
        |
| 
                
                auth_type
                
                 
                    string
                                                                 
                                                     | 
                            
                                                                                                                        
  | 
                                                            
                                         The type of authentication to use for making API requests. By default  
                                                    auth_type="api_key" based authentication is performed and the API key (see api_user_key_file) in your config file will be used. If this 'auth_type' module option is not specified, the value of the OCI_ANSIBLE_AUTH_TYPE, if any, is used. Use auth_type="instance_principal" to use instance principal based authentication when running ansible playbooks within an OCI compute instance. | 
        |
| 
                
                body
                
                 
                    string
                                                                 
                                                     | 
                            
                                         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.` 
                                        This parameter is updatable. 
                                                     | 
        ||
| 
                
                cert_bundle
                
                 
                    string
                                                                 
                                                     | 
                            
                                         The full path to a CA certificate bundle to be used for SSL verification. This will override the default CA certificate bundle. If not set, then the value of the OCI_ANSIBLE_CERT_BUNDLE variable, if any, is used. 
                                                     | 
        ||
| 
                
                compartment_id
                
                 
                    string
                                                                 
                                                     | 
                            
                                         The OCID of the compartment containing the alarm. 
                                        Required for create using state=present. 
                                        Required for update when environment variable  
                                        OCI_USE_NAME_AS_IDENTIFIER is set.Required for delete when environment variable  
                                        OCI_USE_NAME_AS_IDENTIFIER is set.This parameter is updatable. 
                                                     | 
        ||
| 
                
                config_file_location
                
                 
                    string
                                                                 
                                                     | 
                            
                                         Path to configuration file. If not set then the value of the OCI_CONFIG_FILE environment variable, if any, is used. Otherwise, defaults to ~/.oci/config. 
                                                     | 
        ||
| 
                
                config_profile_name
                
                 
                    string
                                                                 
                                                     | 
                            
                                         The profile to load from the config file referenced by  
                                                    config_file_location. If not set, then the value of the OCI_CONFIG_PROFILE environment variable, if any, is used. Otherwise, defaults to the "DEFAULT" profile in config_file_location. | 
        ||
| 
                
                defined_tags
                
                 
                    dictionary
                                                                 
                                                     | 
                            
                                         Usage of predefined tag keys. These predefined keys are scoped to namespaces. Example: `{"Operations": {"CostCenter": "42"}}` 
                                        This parameter is updatable. 
                                                     | 
        ||
| 
                
                destinations
                
                 
                    list
                     / elements=string                                             
                                                     | 
                            
                                         A list of destinations for alarm notifications. Each destination is represented by the OCID of a related resource, such as a topic. Supported destination services: Notifications, Streaming. Limit: One destination per supported destination service. 
                                        Required for create using state=present. 
                                        This parameter is updatable. 
                                                     | 
        ||
| 
                
                display_name
                
                 
                    string
                                                                 
                                                     | 
                            
                                         A user-friendly name for the alarm. It does not have to be unique, and it's changeable. Avoid entering confidential information. 
                                        This value determines the title of each alarm notification. 
                                        Example: `High CPU Utilization` 
                                        Required for create using state=present. 
                                        Required for update, delete when environment variable  
                                        OCI_USE_NAME_AS_IDENTIFIER is set.This parameter is updatable when  
                                                            OCI_USE_NAME_AS_IDENTIFIER is not set.aliases: name  | 
        ||
| 
                
                evaluation_slack_duration
                
                 
                    string
                                                                 
                                                     | 
                            
                                         Customizable slack period to wait for metric ingestion before evaluating the alarm. Specify a string in ISO 8601 format (`PT10M` for ten minutes or `PT1H` for one hour). Minimum: PT3M. Maximum: PT2H. Default: PT3M. For more information about the slack period, see About the Internal Reset Period. 
                                        This parameter is updatable. 
                                                     | 
        ||
| 
                
                force_create
                
                 
                    boolean
                                                                 
                                                     | 
                            
                                                                                                                                                                                                                
  | 
                                                            
                                         Whether to attempt non-idempotent creation of a resource. By default, create resource is an idempotent operation, and doesn't create the resource if it already exists. Setting this option to true, forcefully creates a copy of the resource, even if it already exists.This option is mutually exclusive with key_by. 
                                                     | 
        |
| 
                
                freeform_tags
                
                 
                    dictionary
                                                                 
                                                     | 
                            
                                         Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{"Department": "Finance"}` 
                                        This parameter is updatable. 
                                                     | 
        ||
| 
                
                is_enabled
                
                 
                    boolean
                                                                 
                                                     | 
                            
                                                                                                                                                                    
  | 
                                                            
                                         Whether the alarm is enabled. 
                                        Example: `true` 
                                        Required for create using state=present. 
                                        This parameter is updatable. 
                                                     | 
        |
| 
                
                is_notifications_per_metric_dimension_enabled
                
                 
                    boolean
                                                                 
                                                     | 
                            
                                                                                                                                                                    
  | 
                                                            
                                         When set to `true`, splits alarm notifications per metric stream. When set to `false`, groups alarm notifications across metric streams. Example: `true` 
                                        This parameter is updatable. 
                                                     | 
        |
| 
                
                key_by
                
                 
                    list
                     / elements=string                                             
                                                     | 
                            
                                         The list of attributes of this resource which should be used to uniquely identify an instance of the resource. By default, all the attributes of a resource are used to uniquely identify a resource. 
                                                     | 
        ||
| 
                
                message_format
                
                 
                    string
                                                                 
                                                     | 
                            
                                                                                                                        
  | 
                                                            
                                         The format to use for alarm notifications. The formats are: * `RAW` - Raw JSON blob. Default value. When the `destinations` attribute specifies `Streaming`, all alarm notifications use this format. * `PRETTY_JSON`: JSON with new lines and indents. Available when the `destinations` attribute specifies `Notifications` only. * `ONS_OPTIMIZED`: Simplified, user-friendly layout. Available when the `destinations` attribute specifies `Notifications` only. Applies to Email subscription types only. 
                                        This parameter is updatable. 
                                                     | 
        |
| 
                
                metric_compartment_id
                
                 
                    string
                                                                 
                                                     | 
                            
                                         The OCID of the compartment containing the metric being evaluated by the alarm. 
                                        Required for create using state=present. 
                                        This parameter is updatable. 
                                                     | 
        ||
| 
                
                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` 
                                        This parameter is updatable. 
                                                     | 
        |
| 
                
                namespace
                
                 
                    string
                                                                 
                                                     | 
                            
                                         The source service or application emitting the metric that is evaluated by the alarm. 
                                        Example: `oci_computeagent` 
                                        Required for create using state=present. 
                                        This parameter is updatable. 
                                                     | 
        ||
| 
                
                notification_title
                
                 
                    string
                                                                 
                                                     | 
                            
                                         Customizable notification title (`title` alarm message parameter). Optionally include dynamic variables. The notification title appears as the subject line in a formatted email message and as the title in a Slack message. 
                                        This parameter is updatable. 
                                                     | 
        ||
| 
                
                notification_version
                
                 
                    string
                                                                 
                                                     | 
                            
                                         The version of the alarm notification to be delivered. Allowed value: `1.X` The value must start with a number (up to four digits), followed by a period and an uppercase X. 
                                        This parameter is updatable. 
                                                     | 
        ||
| 
                
                overrides
                
                 
                    list
                     / elements=dictionary                                             
                                                     | 
                            
                                         A set of overrides that control evaluations of the alarm. 
                                        Each override 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`). 
                                        This parameter is updatable. 
                                                     | 
        ||
| 
                
                body
                
                 
                    string
                                                                 
                                                     | 
                            
                                         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.` 
                                                     | 
        ||
| 
                
                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". 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` 
                                                     | 
        ||
| 
                
                query
                
                 
                    string
                                                                 
                                                     | 
                            
                                         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 L(Monitoring Query Language (MQL) Reference,https://docs.cloud.oracle.com/iaas/Content/Monitoring/Reference/mql.htm). 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) 
                                        ----- 
                                                     | 
        ||
| 
                
                rule_name
                
                 
                    string
                                                                 
                                                     | 
                            
                                         A user-friendly description for this alarm override. Must be unique across all `ruleName` values for the alarm. 
                                                     | 
        ||
| 
                
                severity
                
                 
                    string
                                                                 
                                                     | 
                            
                                         The perceived severity of the alarm with regard to the affected system. 
                                        Example: `CRITICAL` 
                                                     | 
        ||
| 
                
                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". 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` 
                                        This parameter is updatable. 
                                                     | 
        ||
| 
                
                query
                
                 
                    string
                                                                 
                                                     | 
                            
                                         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 L(Monitoring Query Language (MQL) Reference,https://docs.cloud.oracle.com/iaas/Content/Monitoring/Reference/mql.htm). 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) 
                                        ----- 
                                        Required for create using state=present. 
                                        This parameter is updatable. 
                                                     | 
        ||
| 
                
                realm_specific_endpoint_template_enabled
                
                 
                    boolean
                                                                 
                                                     | 
                            
                                                                                                                                                                    
  | 
                                                            
                                         Enable/Disable realm specific endpoint template for service client. By Default, realm specific endpoint template is disabled. If not set, then the value of the OCI_REALM_SPECIFIC_SERVICE_ENDPOINT_TEMPLATE_ENABLED variable, if any, is used. 
                                                     | 
        |
| 
                
                region
                
                 
                    string
                                                                 
                                                     | 
                            
                                         The Oracle Cloud Infrastructure region to use for all OCI API requests. If not set, then the value of the OCI_REGION variable, if any, is used. This option is required if the region is not specified through a configuration file (See  
                                                    config_file_location). Please refer to https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm for more information on OCI regions. | 
        ||
| 
                
                repeat_notification_duration
                
                 
                    string
                                                                 
                                                     | 
                            
                                         The frequency for re-submitting alarm notifications, 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` 
                                        This parameter is updatable. 
                                                     | 
        ||
| 
                
                resolution
                
                 
                    string
                                                                 
                                                     | 
                            
                                         The time between calculated aggregation windows for the alarm. Supported value: `1m` 
                                        This parameter is updatable. 
                                                     | 
        ||
| 
                
                resource_group
                
                 
                    string
                                                                 
                                                     | 
                            
                                         Resource group that you want to match. A null value returns only metric data that has no resource groups. The alarm retrieves metric data associated with the specified resource group only. 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` 
                                        This parameter is updatable. 
                                                     | 
        ||
| 
                
                rule_name
                
                 
                    string
                                                                 
                                                     | 
                            
                                         Identifier of the alarm's base values for alarm evaluation, for use when the alarm contains overrides. Default value is `BASE`. For information about alarm overrides, see AlarmOverride. 
                                        This parameter is updatable. 
                                                     | 
        ||
| 
                
                severity
                
                 
                    string
                                                                 
                                                     | 
                            
                                         The perceived type of response required when the alarm is in the "FIRING" state. 
                                        Example: `CRITICAL` 
                                        Required for create using state=present. 
                                        This parameter is updatable. 
                                                     | 
        ||
| 
                
                state
                
                 
                    string
                                                                 
                                                     | 
                            
                                                                                                                        
  | 
                                                            
                                         The state of the Alarm. 
                                        Use state=present to create or update an Alarm. 
                                        Use state=absent to delete an Alarm. 
                                                     | 
        |
| 
                
                suppression
                
                 
                    dictionary
                                                                 
                                                     | 
                            
                                         The configuration details for suppressing an alarm. 
                                        This parameter is updatable. 
                                                     | 
        ||
| 
                
                description
                
                 
                    string
                                                                 
                                                     | 
                            
                                         Human-readable reason for suppressing alarm notifications. It does not have to be unique, and it's changeable. Avoid entering confidential information. 
                                        Oracle recommends including tracking information for the event or associated work, such as a ticket number. 
                                        Example: `Planned outage due to change IT-1234.` 
                                                     | 
        ||
| 
                
                time_suppress_from
                
                 
                    string
                                             / required                     
                                                     | 
                            
                                         The start date and time for the suppression to take place, inclusive. Format defined by RFC3339. 
                                        Example: `2023-02-01T01:02:29.600Z` 
                                                     | 
        ||
| 
                
                time_suppress_until
                
                 
                    string
                                             / required                     
                                                     | 
                            
                                         The end date and time for the suppression to take place, inclusive. Format defined by RFC3339. 
                                        Example: `2023-02-01T02:02:29.600Z` 
                                                     | 
        ||
| 
                
                tenancy
                
                 
                    string
                                                                 
                                                     | 
                            
                                         OCID of your tenancy. If not set, then the value of the OCI_TENANCY variable, if any, is used. This option is required if the tenancy OCID is not specified through a configuration file (See  
                                                    config_file_location). To get the tenancy OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm | 
        ||
| 
                
                wait
                
                 
                    boolean
                                                                 
                                                     | 
                            
                                                                                                                                                                                                                
  | 
                                                            
                                         Whether to wait for create or delete operation to complete. 
                                                     | 
        |
| 
                
                wait_timeout
                
                 
                    integer
                                                                 
                                                     | 
                            
                                         Time, in seconds, to wait when wait=yes. Defaults to 1200 for most of the services but some services might have a longer wait timeout. 
                                                     | 
        ||
Notes¶
Note
For OCI python sdk configuration, please refer to https://oracle-cloud-infrastructure-python-sdk.readthedocs.io/en/latest/configuration.html
Examples¶
- name: Create alarm
  oci_monitoring_alarm:
    # required
    display_name: display_name_example
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    metric_compartment_id: "ocid1.metriccompartment.oc1..xxxxxxEXAMPLExxxxxx"
    namespace: namespace_example
    query: query_example
    severity: severity_example
    destinations: [ "destinations_example" ]
    is_enabled: true
    # optional
    metric_compartment_id_in_subtree: true
    resource_group: resource_group_example
    resolution: resolution_example
    pending_duration: pending_duration_example
    body: body_example
    is_notifications_per_metric_dimension_enabled: true
    message_format: RAW
    repeat_notification_duration: repeat_notification_duration_example
    suppression:
      # required
      time_suppress_from: time_suppress_from_example
      time_suppress_until: time_suppress_until_example
      # optional
      description: description_example
    freeform_tags: {'Department': 'Finance'}
    defined_tags: {'Operations': {'CostCenter': 'US'}}
    overrides:
    - # optional
      pending_duration: pending_duration_example
      severity: severity_example
      body: body_example
      rule_name: rule_name_example
      query: query_example
    rule_name: rule_name_example
    notification_version: notification_version_example
    notification_title: notification_title_example
    evaluation_slack_duration: evaluation_slack_duration_example
    alarm_summary: alarm_summary_example
- name: Update alarm
  oci_monitoring_alarm:
    # required
    alarm_id: "ocid1.alarm.oc1..xxxxxxEXAMPLExxxxxx"
    # optional
    display_name: display_name_example
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    metric_compartment_id: "ocid1.metriccompartment.oc1..xxxxxxEXAMPLExxxxxx"
    metric_compartment_id_in_subtree: true
    namespace: namespace_example
    resource_group: resource_group_example
    query: query_example
    resolution: resolution_example
    pending_duration: pending_duration_example
    severity: severity_example
    body: body_example
    is_notifications_per_metric_dimension_enabled: true
    message_format: RAW
    destinations: [ "destinations_example" ]
    repeat_notification_duration: repeat_notification_duration_example
    suppression:
      # required
      time_suppress_from: time_suppress_from_example
      time_suppress_until: time_suppress_until_example
      # optional
      description: description_example
    is_enabled: true
    freeform_tags: {'Department': 'Finance'}
    defined_tags: {'Operations': {'CostCenter': 'US'}}
    overrides:
    - # optional
      pending_duration: pending_duration_example
      severity: severity_example
      body: body_example
      rule_name: rule_name_example
      query: query_example
    rule_name: rule_name_example
    notification_version: notification_version_example
    notification_title: notification_title_example
    evaluation_slack_duration: evaluation_slack_duration_example
    alarm_summary: alarm_summary_example
- name: Update alarm using name (when environment variable OCI_USE_NAME_AS_IDENTIFIER is set)
  oci_monitoring_alarm:
    # required
    display_name: display_name_example
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    # optional
    metric_compartment_id: "ocid1.metriccompartment.oc1..xxxxxxEXAMPLExxxxxx"
    metric_compartment_id_in_subtree: true
    namespace: namespace_example
    resource_group: resource_group_example
    query: query_example
    resolution: resolution_example
    pending_duration: pending_duration_example
    severity: severity_example
    body: body_example
    is_notifications_per_metric_dimension_enabled: true
    message_format: RAW
    destinations: [ "destinations_example" ]
    repeat_notification_duration: repeat_notification_duration_example
    suppression:
      # required
      time_suppress_from: time_suppress_from_example
      time_suppress_until: time_suppress_until_example
      # optional
      description: description_example
    is_enabled: true
    freeform_tags: {'Department': 'Finance'}
    defined_tags: {'Operations': {'CostCenter': 'US'}}
    overrides:
    - # optional
      pending_duration: pending_duration_example
      severity: severity_example
      body: body_example
      rule_name: rule_name_example
      query: query_example
    rule_name: rule_name_example
    notification_version: notification_version_example
    notification_title: notification_title_example
    evaluation_slack_duration: evaluation_slack_duration_example
    alarm_summary: alarm_summary_example
- name: Delete alarm
  oci_monitoring_alarm:
    # required
    alarm_id: "ocid1.alarm.oc1..xxxxxxEXAMPLExxxxxx"
    state: absent
- name: Delete alarm using name (when environment variable OCI_USE_NAME_AS_IDENTIFIER is set)
  oci_monitoring_alarm:
    # required
    display_name: display_name_example
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    state: absent
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description | ||
|---|---|---|---|---|
| 
                
                alarm
                
                 
                  complex
                                       
                                 | 
            on success | 
                                         Details of the Alarm resource acted upon by the current operation 
                                    Sample: 
                                            {'alarm_summary': 'alarm_summary_example', 'body': 'body_example', 'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'defined_tags': {'Operations': {'CostCenter': 'US'}}, 'destinations': [], 'display_name': 'display_name_example', 'evaluation_slack_duration': 'evaluation_slack_duration_example', 'freeform_tags': {'Department': 'Finance'}, 'id': 'ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx', 'is_enabled': True, 'is_notifications_per_metric_dimension_enabled': True, 'lifecycle_state': 'ACTIVE', 'message_format': 'RAW', 'metric_compartment_id': 'ocid1.metriccompartment.oc1..xxxxxxEXAMPLExxxxxx', 'metric_compartment_id_in_subtree': True, 'namespace': 'namespace_example', 'notification_title': 'notification_title_example', 'notification_version': 'notification_version_example', 'overrides': [{'body': 'body_example', 'pending_duration': 'pending_duration_example', 'query': 'query_example', 'rule_name': 'rule_name_example', 'severity': 'severity_example'}], 'pending_duration': 'pending_duration_example', 'query': 'query_example', 'repeat_notification_duration': 'repeat_notification_duration_example', 'resolution': 'resolution_example', 'resource_group': 'resource_group_example', 'rule_name': 'rule_name_example', 'severity': 'CRITICAL', 'suppression': {'description': 'description_example', 'time_suppress_from': '2013-10-20T19:20:30+01:00', 'time_suppress_until': '2013-10-20T19:20:30+01:00'}, 'time_created': '2013-10-20T19:20:30+01:00', 'time_updated': '2013-10-20T19:20:30+01:00'} 
                                 | 
        ||
| 
                
                alarm_summary
                
                 
                  string
                                       
                                 | 
            on success | 
                                         Customizable alarm summary (`alarmSummary` alarm message parameter). Optionally include dynamic variables. The alarm summary appears within the body of the alarm message and in responses to ListAlarmStatus GetAlarmHistory and RetrieveDimensionStates. 
                                    Sample: 
                                            alarm_summary_example 
                                 | 
        ||
| 
                
                body
                
                 
                  string
                                       
                                 | 
            on success | 
                                         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.` 
                                    Sample: 
                                            body_example 
                                 | 
        ||
| 
                
                compartment_id
                
                 
                  string
                                       
                                 | 
            on success | 
                                         The OCID of the compartment containing the alarm. 
                                    Sample: 
                                            ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx 
                                 | 
        ||
| 
                
                defined_tags
                
                 
                  dictionary
                                       
                                 | 
            on success | 
                                         Usage of predefined tag keys. These predefined keys are scoped to namespaces. Example: `{"Operations": {"CostCenter": "42"}}` 
                                    Sample: 
                                            {'Operations': {'CostCenter': 'US'}} 
                                 | 
        ||
| 
                
                destinations
                
                 
                  list
                   / elements=string                     
                                 | 
            on success | 
                                         A list of destinations for alarm notifications. Each destination is represented by the OCID of a related resource, such as a topic. Supported destination services: Notifications, Streaming. Limit: One destination per supported destination service. 
                                     | 
        ||
| 
                
                display_name
                
                 
                  string
                                       
                                 | 
            on success | 
                                         A user-friendly name for the alarm. It does not have to be unique, and it's changeable. 
                                        This value determines the title of each alarm notification. 
                                        Example: `High CPU Utilization` 
                                    Sample: 
                                            display_name_example 
                                 | 
        ||
| 
                
                evaluation_slack_duration
                
                 
                  string
                                       
                                 | 
            on success | 
                                         Customizable slack period to wait for metric ingestion before evaluating the alarm. Specify a string in ISO 8601 format (`PT10M` for ten minutes or `PT1H` for one hour). Minimum: PT3M. Maximum: PT2H. Default: PT3M. For more information about the slack period, see About the Internal Reset Period. 
                                    Sample: 
                                            evaluation_slack_duration_example 
                                 | 
        ||
| 
                
                freeform_tags
                
                 
                  dictionary
                                       
                                 | 
            on success | 
                                         Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{"Department": "Finance"}` 
                                    Sample: 
                                            {'Department': 'Finance'} 
                                 | 
        ||
| 
                
                id
                
                 
                  string
                                       
                                 | 
            on success | 
                                         The OCID of the alarm. 
                                    Sample: 
                                            ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx 
                                 | 
        ||
| 
                
                is_enabled
                
                 
                  boolean
                                       
                                 | 
            on success | 
                                         Whether the alarm is enabled. 
                                        Example: `true` 
                                    Sample: 
                                            True 
                                 | 
        ||
| 
                
                is_notifications_per_metric_dimension_enabled
                
                 
                  boolean
                                       
                                 | 
            on success | 
                                         When set to `true`, splits alarm notifications per metric stream. When set to `false`, groups alarm notifications across metric streams. 
                                    Sample: 
                                            True 
                                 | 
        ||
| 
                
                lifecycle_state
                
                 
                  string
                                       
                                 | 
            on success | 
                                         The current lifecycle state of the alarm. 
                                        Example: `DELETED` 
                                    Sample: 
                                            ACTIVE 
                                 | 
        ||
| 
                
                message_format
                
                 
                  string
                                       
                                 | 
            on success | 
                                         The format to use for alarm notifications. The formats are: * `RAW` - Raw JSON blob. Default value. When the `destinations` attribute specifies `Streaming`, all alarm notifications use this format. * `PRETTY_JSON`: JSON with new lines and indents. Available when the `destinations` attribute specifies `Notifications` only. * `ONS_OPTIMIZED`: Simplified, user-friendly layout. Available when the `destinations` attribute specifies `Notifications` only. Applies to Email subscription types only. 
                                    Sample: 
                                            RAW 
                                 | 
        ||
| 
                
                metric_compartment_id
                
                 
                  string
                                       
                                 | 
            on success | 
                                         The OCID of the compartment containing the metric being evaluated by the alarm. 
                                    Sample: 
                                            ocid1.metriccompartment.oc1..xxxxxxEXAMPLExxxxxx 
                                 | 
        ||
| 
                
                metric_compartment_id_in_subtree
                
                 
                  boolean
                                       
                                 | 
            on success | 
                                         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` 
                                    Sample: 
                                            True 
                                 | 
        ||
| 
                
                namespace
                
                 
                  string
                                       
                                 | 
            on success | 
                                         The source service or application emitting the metric that is evaluated by the alarm. 
                                        Example: `oci_computeagent` 
                                    Sample: 
                                            namespace_example 
                                 | 
        ||
| 
                
                notification_title
                
                 
                  string
                                       
                                 | 
            on success | 
                                         Customizable notification title (`title` alarm message parameter). Optionally include dynamic variables. The notification title appears as the subject line in a formatted email message and as the title in a Slack message. 
                                    Sample: 
                                            notification_title_example 
                                 | 
        ||
| 
                
                notification_version
                
                 
                  string
                                       
                                 | 
            on success | 
                                         The version of the alarm notification to be delivered. Allowed value: `1.X` The value must start with a number (up to four digits), followed by a period and an uppercase X. 
                                    Sample: 
                                            notification_version_example 
                                 | 
        ||
| 
                
                overrides
                
                 
                  complex
                                       
                                 | 
            on success | 
                                         A set of overrides that control evaluations of the alarm. 
                                        Each override 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`). 
                                     | 
        ||
| 
                
                body
                
                 
                  string
                                       
                                 | 
            on success | 
                                         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.` 
                                    Sample: 
                                            body_example 
                                 | 
        ||
| 
                
                pending_duration
                
                 
                  string
                                       
                                 | 
            on success | 
                                         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` 
                                    Sample: 
                                            pending_duration_example 
                                 | 
        ||
| 
                
                query
                
                 
                  string
                                       
                                 | 
            on success | 
                                         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 L(Monitoring Query Language (MQL) Reference,https://docs.cloud.oracle.com/iaas/Content/Monitoring/Reference/mql.htm). 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) 
                                        ----- 
                                    Sample: 
                                            query_example 
                                 | 
        ||
| 
                
                rule_name
                
                 
                  string
                                       
                                 | 
            on success | 
                                         A user-friendly description for this alarm override. Must be unique across all `ruleName` values for the alarm. 
                                    Sample: 
                                            rule_name_example 
                                 | 
        ||
| 
                
                severity
                
                 
                  string
                                       
                                 | 
            on success | 
                                         The perceived severity of the alarm with regard to the affected system. 
                                        Example: `CRITICAL` 
                                    Sample: 
                                            severity_example 
                                 | 
        ||
| 
                
                pending_duration
                
                 
                  string
                                       
                                 | 
            on success | 
                                         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` 
                                    Sample: 
                                            pending_duration_example 
                                 | 
        ||
| 
                
                query
                
                 
                  string
                                       
                                 | 
            on success | 
                                         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 L(Monitoring Query Language (MQL) Reference,https://docs.cloud.oracle.com/iaas/Content/Monitoring/Reference/mql.htm). 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) 
                                        ----- 
                                    Sample: 
                                            query_example 
                                 | 
        ||
| 
                
                repeat_notification_duration
                
                 
                  string
                                       
                                 | 
            on success | 
                                         The frequency for re-submitting alarm notifications, 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` 
                                    Sample: 
                                            repeat_notification_duration_example 
                                 | 
        ||
| 
                
                resolution
                
                 
                  string
                                       
                                 | 
            on success | 
                                         The time between calculated aggregation windows for the alarm. Supported value: `1m` 
                                    Sample: 
                                            resolution_example 
                                 | 
        ||
| 
                
                resource_group
                
                 
                  string
                                       
                                 | 
            on success | 
                                         Resource group to match for metric data retrieved by the alarm. A resource group is a custom string that you can match when retrieving custom metrics. 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 ($). 
                                        Example: `frontend-fleet` 
                                    Sample: 
                                            resource_group_example 
                                 | 
        ||
| 
                
                rule_name
                
                 
                  string
                                       
                                 | 
            on success | 
                                         Identifier of the alarm's base values for alarm evaluation, for use when the alarm contains overrides. Default value is `BASE`. For information about alarm overrides, see AlarmOverride. 
                                    Sample: 
                                            rule_name_example 
                                 | 
        ||
| 
                
                severity
                
                 
                  string
                                       
                                 | 
            on success | 
                                         The perceived type of response required when the alarm is in the "FIRING" state. 
                                        Example: `CRITICAL` 
                                    Sample: 
                                            CRITICAL 
                                 | 
        ||
| 
                
                suppression
                
                 
                  complex
                                       
                                 | 
            on success | 
                                         The configuration details for suppressing an alarm. 
                                     | 
        ||
| 
                
                description
                
                 
                  string
                                       
                                 | 
            on success | 
                                         Human-readable reason for suppressing alarm notifications. It does not have to be unique, and it's changeable. Avoid entering confidential information. 
                                        Oracle recommends including tracking information for the event or associated work, such as a ticket number. 
                                        Example: `Planned outage due to change IT-1234.` 
                                    Sample: 
                                            description_example 
                                 | 
        ||
| 
                
                time_suppress_from
                
                 
                  string
                                       
                                 | 
            on success | 
                                         The start date and time for the suppression to take place, inclusive. Format defined by RFC3339. 
                                        Example: `2023-02-01T01:02:29.600Z` 
                                    Sample: 
                                            2013-10-20T19:20:30+01:00 
                                 | 
        ||
| 
                
                time_suppress_until
                
                 
                  string
                                       
                                 | 
            on success | 
                                         The end date and time for the suppression to take place, inclusive. Format defined by RFC3339. 
                                        Example: `2023-02-01T02:02:29.600Z` 
                                    Sample: 
                                            2013-10-20T19:20:30+01:00 
                                 | 
        ||
| 
                
                time_created
                
                 
                  string
                                       
                                 | 
            on success | 
                                         The date and time the alarm was created. Format defined by RFC3339. 
                                        Example: `2023-02-01T01:02:29.600Z` 
                                    Sample: 
                                            2013-10-20T19:20:30+01:00 
                                 | 
        ||
| 
                
                time_updated
                
                 
                  string
                                       
                                 | 
            on success | 
                                         The date and time the alarm was last updated. Format defined by RFC3339. 
                                        Example: `2023-02-03T01:02:29.600Z` 
                                    Sample: 
                                            2013-10-20T19:20:30+01:00 
                                 | 
        ||
Authors¶
Oracle (@oracle)