oracle.oci.oci_monitoring_alarm_facts – Fetches details about one or multiple Alarm resources in Oracle Cloud Infrastructure

Note

This plugin is part of the oracle.oci collection (version 4.14.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_facts.

New in version 2.9.0: of oracle.oci

Synopsis

  • Fetches details about one or multiple Alarm resources in Oracle Cloud Infrastructure

  • Lists the alarms for the specified compartment. 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.

  • If alarm_id is specified, the details of a single Alarm will be returned.

Requirements

The below requirements are needed on the host that executes this module.

Parameters

Parameter Choices/Defaults Comments
alarm_id
string
The OCID of an alarm.
Required to get a specific alarm.

aliases: id
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
    Choices:
  • service_principal
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
    Choices:
  • api_key ←
  • instance_principal
  • instance_obo_user
  • resource_principal
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.
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 resources monitored by the metric that you are searching for. Use tenancyId to search in the root compartment.
Example: `ocid1.compartment.oc1..exampleuniqueID`
Required to list multiple alarms.
compartment_id_in_subtree
boolean
    Choices:
  • no
  • yes
When true, returns resources from all compartments and subcompartments. The parameter can only be set to true when compartmentId 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, returns resources from only the compartment specified in compartmentId. Default is false.
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.
display_name
string
A filter to return only resources that match the given display name exactly. Use this filter to list an alarm by name. Alternatively, when you know the alarm OCID, use the GetAlarm operation.

aliases: name
lifecycle_state
string
    Choices:
  • ACTIVE
  • DELETING
  • DELETED
A filter to return only alarms that match the given lifecycle state exactly. When not specified, only alarms in the ACTIVE lifecycle state are listed.
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.
sort_by
string
    Choices:
  • displayName
  • severity
The field to use when sorting returned alarm definitions. Only one sorting level is provided.
Example: `severity`
sort_order
string
    Choices:
  • ASC
  • DESC
The sort order to use when sorting returned alarm definitions. Ascending (ASC) or descending (DESC).
Example: `ASC`
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

Examples

- name: Get a specific alarm
  oci_monitoring_alarm_facts:
    # required
    alarm_id: "ocid1.alarm.oc1..xxxxxxEXAMPLExxxxxx"

- name: List alarms
  oci_monitoring_alarm_facts:
    # required
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"

    # optional
    display_name: display_name_example
    lifecycle_state: ACTIVE
    sort_by: displayName
    sort_order: ASC
    compartment_id_in_subtree: true

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
alarms
complex
on success
List of Alarm resources

Sample:
[{'body': 'body_example', 'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'defined_tags': {'Operations': {'CostCenter': 'US'}}, 'destinations': [], 'display_name': 'display_name_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', 'pending_duration': 'pending_duration_example', 'query': 'query_example', 'repeat_notification_duration': 'repeat_notification_duration_example', 'resolution': 'resolution_example', 'resource_group': 'resource_group_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'}]
 
body
string
on success
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.
Example: `High CPU usage alert. Follow runbook instructions for resolution.`
Returned for get operation

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 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.

 
display_name
string
on success
A user-friendly name for the alarm. It does not have to be unique, and it's changeable.
This name is sent as the title for notifications related to this alarm.
Example: `High CPU Utilization`

Sample:
display_name_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 notifications per metric stream. When set to `false`, groups notifications across metric streams. Example: `true`
Returned for get operation

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 notification messages sent from this alarm. The formats are: * `RAW` - Raw JSON blob. Default value. * `PRETTY_JSON`: JSON with new lines and indents. * `ONS_OPTIMIZED`: Simplified, user-friendly layout. Applies only to messages sent through the Notifications service to the following subscription types: Email.
Returned for get operation

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`
Returned for get operation

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
 
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`
Returned for get operation

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. Supported grouping functions: `grouping()`, `groupBy()`. For details about Monitoring Query Language (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()
-----

Sample:
query_example
 
repeat_notification_duration
string
on success
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`
Returned for get operation

Sample:
repeat_notification_duration_example
 
resolution
string
on success
The time between calculated aggregation windows for the alarm. Supported value: `1m`
Returned for get operation

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`
Returned for get operation

Sample:
resource_group_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: `2019-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: `2019-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: `2019-02-01T01:02:29.600Z`
Returned for get operation

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: `2019-02-03T01:02:29.600Z`
Returned for get operation

Sample:
2013-10-20T19:20:30+01:00


Authors

  • Oracle (@oracle)