oracle.oci.oci_monitoring_metric_actions – Perform actions on a Metric resource in Oracle Cloud Infrastructure¶
Note
This plugin is part of the oracle.oci collection (version 5.1.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_actions
.
New in version 2.9.0: of oracle.oci
Synopsis¶
Perform actions on a Metric resource in Oracle Cloud Infrastructure
For action=list, returns metric definitions that match the criteria specified in the request. Compartment OCID required. For more information, see Listing Metric Definitions. For information about metrics, see Metrics Overview. 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.
python >= 3.6
Python SDK for Oracle Cloud Infrastructure https://oracle-cloud-infrastructure-python-sdk.readthedocs.io
Parameters¶
Parameter | Choices/Defaults | Comments |
---|---|---|
action
string
/ required
|
|
The action to perform on the Metric.
|
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. |
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
|
|
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 . |
|
dimension_filters
dictionary
|
Qualifiers that you want to use when searching for metric definitions. Available dimensions vary by metric namespace. Each dimension takes the form of a key-value pair.
Example: `"resourceId": "ocid1.instance.region1.phx.exampleuniqueID"`
|
|
group_by
list
/ elements=string
|
Group metrics by these fields in the response. For example, to list all metric namespaces available in a compartment, groupBy the "namespace" field. Supported fields: namespace, name, resourceGroup. If `groupBy` is used, then `dimensionFilters` is ignored.
Example - group by namespace: `[ "namespace" ]`
|
|
name
string
|
The metric name to use when searching for metric definitions.
Example: `CpuUtilization`
|
|
namespace
string
|
The source service or application to use when searching for metric definitions.
Example: `oci_computeagent`
|
|
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. |
|
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`
|
|
sort_by
string
|
|
The field to use when sorting returned metric definitions. Only one sorting level is provided.
Example: `NAMESPACE`
|
sort_order
string
|
|
The sort order to use when sorting returned metric 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 |
Notes¶
Note
For OCI python sdk configuration, please refer to https://oracle-cloud-infrastructure-python-sdk.readthedocs.io/en/latest/configuration.html
Examples¶
- name: Perform action list on metric
oci_monitoring_metric_actions:
# required
compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
action: list
# optional
name: name_example
namespace: namespace_example
resource_group: resource_group_example
dimension_filters: null
group_by: [ "group_by_example" ]
sort_by: NAMESPACE
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 | |
---|---|---|---|
metric
complex
|
on success |
Details of the Metric resource acted upon by the current operation
Sample:
{'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'dimensions': {}, 'name': 'name_example', 'namespace': 'namespace_example', 'resource_group': 'resource_group_example'}
|
|
compartment_id
string
|
on success |
The OCID of the compartment containing the resources monitored by the metric.
Sample:
ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
|
|
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.
Example: `"resourceId": "ocid1.instance.region1.phx.exampleuniqueID"`
|
|
name
string
|
on success |
The name of the metric.
Example: `CpuUtilization`
Sample:
name_example
|
|
namespace
string
|
on success |
The source service or application emitting the metric.
Example: `oci_computeagent`
Sample:
namespace_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)