oracle.oci.oci_monitoring_metric_data – Manage a MetricData resource in Oracle Cloud Infrastructure

Note

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

New in version 2.9.0: of oracle.oci

Synopsis

  • This module allows the user to create a MetricData resource in Oracle Cloud Infrastructure

  • For state=present, publishes raw metric data points to the Monitoring service. For more information about publishing metrics, see Publishing Custom Metrics. For important limits information, see Limits on Monitoring.

  • Per-call limits information follows.

    • Dimensions per metric group*. Maximum: 20. Minimum: 1. * Unique metric streams*. Maximum: 50. * Transactions Per Second (TPS) per-tenancy limit for this operation: 50.

  • *A metric group is the combination of a given metric, metric namespace, and tenancy for the purpose of determining limits. A dimension is a qualifier provided in a metric definition. A metric stream is an individual set of aggregated data for a metric with zero or more dimension values. For more information about metric-related concepts, see Monitoring Concepts.

  • The endpoints for this operation differ from other Monitoring operations. Replace the string telemetry with telemetry-ingestion in the endpoint, as in the following example:

  • https://telemetry-ingestion.eu-frankfurt-1.oraclecloud.com

  • This resource has the following action operations in the oracle.oci.oci_monitoring_metric_data_actions module: summarize_metrics_data.

Requirements

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

Parameters

Parameter Choices/Defaults Comments
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.
batch_atomicity
string
    Choices:
  • ATOMIC
  • NON_ATOMIC
Batch atomicity behavior. Requires either partial or full pass of input validation for metric objects in PostMetricData requests. The default value of NON_ATOMIC requires a partial pass: at least one metric object in the request must pass input validation, and any objects that failed validation are identified in the returned summary, along with their error messages. A value of ATOMIC requires a full pass: all metric objects in the request must pass input validation.
Example: `NON_ATOMIC`
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.
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.
content_encoding
string
The optional Content-Encoding header that defines the content encodings that were applied to the payload.
force_create
boolean
    Choices:
  • no ←
  • yes
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.
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.
metric_data
list / elements=dictionary / required
A metric object containing raw metric data points to be posted to the Monitoring service.
compartment_id
string / required
The OCID of the compartment to use for metrics.
datapoints
list / elements=dictionary / required
A list of metric values with timestamps. At least one data point is required per call.
count
integer
The number of occurrences of the associated value in the set of data.
Default is 1. Value must be greater than zero.
timestamp
string / required
Timestamp for this metric value. Format defined by RFC3339.
Example: `2019-02-01T01:02:29.600Z`
value
float / required
Numeric value of the metric.
Example: `10.23`
dimensions
dictionary / required
Qualifiers provided in a metric definition. Available dimensions vary by metric namespace. Each dimension takes the form of a key-value pair. A valid dimension key includes only printable ASCII, excluding spaces. The character limit for a dimension key is 256. A valid dimension value includes only Unicode characters. The character limit for a dimension value is 512. Empty strings are not allowed for keys or values. Avoid entering confidential information.
Example: `"resourceId": "ocid1.instance.region1.phx.exampleuniqueID"`
metadata
dictionary
Properties describing metrics. These are not part of the unique fields identifying the metric. Each metadata item takes the form of a key-value pair. The character limit for a metadata key is 256. The character limit for a metadata value is 256.
Example: `"unit": "bytes"`
name
string / required
The name of the metric.
A valid name value starts with an alphabetical character and includes only alphanumeric characters, dots, underscores, hyphens, and dollar signs. The `oci_` prefix is reserved. Avoid entering confidential information.
Example: `my_app.success_rate`
namespace
string / required
The source service or application emitting the metric.
A valid namespace value starts with an alphabetical character and includes only alphanumeric characters and underscores. The "oci_" prefix is reserved. Avoid entering confidential information.
Example: `my_namespace`
resource_group
string
Resource group to assign to the 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 ($). Avoid entering confidential information.
Example: `frontend-fleet`
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.
state
string
    Choices:
  • present ←
The state of the MetricData.
Use state=present to create a MetricData.
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: Create metric_data
  oci_monitoring_metric_data:
    # required
    metric_data:
    - # required
      namespace: namespace_example
      compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
      name: name_example
      dimensions: null
      datapoints:
      - # required
        timestamp: timestamp_example
        value: 3.4

        # optional
        count: 56

      # optional
      resource_group: resource_group_example
      metadata: null

    # optional
    batch_atomicity: ATOMIC
    content_encoding: content_encoding_example

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:
{'failed_metrics': [{'message': 'message_example', 'metric_data': {'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'datapoints': [{'count': 56, 'timestamp': '2013-10-20T19:20:30+01:00', 'value': 1.2}], 'dimensions': {}, 'metadata': {}, 'name': 'name_example', 'namespace': 'namespace_example', 'resource_group': 'resource_group_example'}}], 'failed_metrics_count': 56}
 
failed_metrics
complex
on success
A list of records identifying metric objects that failed input validation and the reasons for the failures.

   
message
string
on success
An error message indicating the reason that the indicated metric object failed input validation.

Sample:
message_example
   
metric_data
complex
on success
Identifier of a metric object that failed input validation.

     
compartment_id
string
on success
The OCID of the compartment to use for metrics.

Sample:
ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
     
datapoints
complex
on success
A list of metric values with timestamps. At least one data point is required per call.

       
count
integer
on success
The number of occurrences of the associated value in the set of data.
Default is 1. Value must be greater than zero.

Sample:
56
       
timestamp
string
on success
Timestamp for this metric value. 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.23`

Sample:
1.2
     
dimensions
dictionary
on success
Qualifiers provided in a metric definition. Available dimensions vary by metric namespace. Each dimension takes the form of a key-value pair. A valid dimension key includes only printable ASCII, excluding spaces. The character limit for a dimension key is 256. A valid dimension value includes only Unicode characters. The character limit for a dimension value is 512. Empty strings are not allowed for keys or values. Avoid entering confidential information.
Example: `"resourceId": "ocid1.instance.region1.phx.exampleuniqueID"`

     
metadata
dictionary
on success
Properties describing metrics. These are not part of the unique fields identifying the metric. Each metadata item takes the form of a key-value pair. The character limit for a metadata key is 256. The character limit for a metadata value is 256.
Example: `"unit": "bytes"`

     
name
string
on success
The name of the metric.
A valid name value starts with an alphabetical character and includes only alphanumeric characters, dots, underscores, hyphens, and dollar signs. The `oci_` prefix is reserved. Avoid entering confidential information.
Example: `my_app.success_rate`

Sample:
name_example
     
namespace
string
on success
The source service or application emitting the metric.
A valid namespace value starts with an alphabetical character and includes only alphanumeric characters and underscores. The "oci_" prefix is reserved. Avoid entering confidential information.
Example: `my_namespace`

Sample:
namespace_example
     
resource_group
string
on success
Resource group to assign to the 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 ($). Avoid entering confidential information.
Example: `frontend-fleet`

Sample:
resource_group_example
 
failed_metrics_count
integer
on success
The number of metric objects that failed input validation.

Sample:
56


Authors

  • Oracle (@oracle)