oracle.oci.oci_monitoring_metric_data_actions – Perform actions on a MetricData resource in Oracle Cloud Infrastructure

Note

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

New in version 2.9.0: of oracle.oci

Synopsis

  • Perform actions on a MetricData resource in Oracle Cloud Infrastructure

  • For action=summarize_metrics_data, returns aggregated data that match the criteria specified in the request. Compartment OCID required. For information on metric queries, see Building Metric Queries. For important limits information, see Limits on Monitoring. Transactions Per Second (TPS) per-tenancy limit for this operation: 10.

Requirements

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

Parameters

Parameter Choices/Defaults Comments
action
string / required
    Choices:
  • summarize_metrics_data
The action to perform on the MetricData.
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 / required
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`
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.
end_time
string
The end of the time range to use when searching for metric data points. Format is defined by RFC3339. The response excludes metric data points for the endTime. Default value: the timestamp representing when the call was sent.
Example: `2019-02-01T02:02:29.600Z`
namespace
string / required
The source service or application to use when searching for metric data points to aggregate.
Example: `oci_computeagent`
query
string / required
The Monitoring Query Language (MQL) expression to use when searching for metric data points to aggregate. The query must specify a metric, statistic, and interval. 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()`.
Construct your query to avoid exceeding limits on returned data. See MetricData Reference.
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: `CpuUtilization[1m].sum()`
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.
resolution
string
The time between calculated aggregation windows. Use with the query interval to vary the frequency at which aggregated data points are returned. For example, use a query interval of 5 minutes with a resolution of 1 minute to retrieve five-minute aggregations at a one-minute frequency. The resolution must be equal or less than the interval in the query. The default resolution is 1m (one minute). Supported values: `1m`-`60m`, `1h`-`24h`, `1d`.
Example: `5m`
resource_group
string
Resource group that you want to match. A null value returns only metric data that has no resource groups. The specified resource group must exist in the definition of the posted metric. 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`
start_time
string
The beginning of the time range to use when searching for metric data points. Format is defined by RFC3339. The response includes metric data points for the startTime. Default value: the timestamp 3 hours before the call was sent.
Example: `2019-02-01T01: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

Examples

- name: Perform action summarize_metrics_data on metric_data
  oci_monitoring_metric_data_actions:
    # required
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    namespace: namespace_example
    query: query_example
    action: summarize_metrics_data

    # optional
    resource_group: resource_group_example
    start_time: start_time_example
    end_time: end_time_example
    resolution: resolution_example
    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
metric_data
complex
on success
Details of the MetricData resource acted upon by the current operation

Sample:
{'aggregated_datapoints': [{'timestamp': '2013-10-20T19:20:30+01:00', 'value': 1.2}], 'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'dimensions': {}, 'metadata': {}, 'name': 'name_example', 'namespace': 'namespace_example', 'resolution': 'resolution_example', 'resource_group': 'resource_group_example'}
 
aggregated_datapoints
complex
on success
The list of timestamp-value pairs returned for the specified request. Metric values are rolled up to the start time specified in the request. For important limits information related to data points, see MetricData Reference at the top of this page.

   
timestamp
string
on success
The date and time associated with the value of this data point. Format defined by RFC3339.
Example: `2019-02-01T01:02:29.600Z`

Sample:
2013-10-20T19:20:30+01:00
   
value
float
on success
Numeric value of the metric.
Example: `10.4`

Sample:
1.2
 
compartment_id
string
on success
The OCID of the compartment containing the resources from which the aggregated data was returned.

Sample:
ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
 
dimensions
dictionary
on success
Qualifiers provided in the definition of the returned metric. Available dimensions vary by metric namespace. Each dimension takes the form of a key-value pair.
Example: `"resourceId": "ocid1.instance.region1.phx.exampleuniqueID"`

 
metadata
dictionary
on success
The references provided in a metric definition to indicate extra information about the metric.
Example: `"unit": "bytes"`

 
name
string
on success
The name of the metric.
Example: `CpuUtilization`

Sample:
name_example
 
namespace
string
on success
The reference provided in a metric definition to indicate the source service or application that emitted the metric.
Example: `oci_computeagent`

Sample:
namespace_example
 
resolution
string
on success
The time between calculated aggregation windows. Use with the query interval to vary the frequency at which aggregated data points are returned. For example, use a query interval of 5 minutes with a resolution of 1 minute to retrieve five-minute aggregations at a one-minute frequency. The resolution must be equal or less than the interval in the query. The default resolution is 1m (one minute). Supported values: `1m`-`60m`, `1h`-`24h`, `1d`.
Example: `5m`

Sample:
resolution_example
 
resource_group
string
on success
Resource group provided with the posted metric. 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


Authors

  • Oracle (@oracle)