oracle.oci.oci_stack_monitoring_monitored_resource_actions – Perform actions on a MonitoredResource resource in Oracle Cloud Infrastructure

Note

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

New in version 2.9.0: of oracle.oci

Synopsis

  • Perform actions on a MonitoredResource resource in Oracle Cloud Infrastructure

  • For action=associate, create an association between two monitored resources.

  • For action=change_compartment, moves a MonitoredResource resource from one compartment identifier to another. When provided, If-Match is checked against ETag values of the resource.

  • For action=disable_external_database, disable external database resource monitoring.

  • For action=disassociate, removes associations between two monitored resources.

  • For action=search_monitored_resource_associations, returns a list of monitored resource associations.

  • For action=search_monitored_resource_members, list resources which are members of the given monitored resource

  • For action=search, returns a list of monitored resources.

Requirements

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

Parameters

Parameter Choices/Defaults Comments
action
string / required
    Choices:
  • associate
  • change_compartment
  • disable_external_database
  • disassociate
  • search_monitored_resource_associations
  • search_monitored_resource_members
  • search
The action to perform on the MonitoredResource.
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).
association_type
string
Association type to be created between source and destination resources
Required for action=associate.
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
Compartment Identifier OCID
Required for action=associate, action=change_compartment, action=disassociate, action=search_monitored_resource_associations, action=search.
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.
destination_resource_id
string
Destination Monitored Resource Identifier OCID
Required for action=associate.
destination_resource_name
string
Source Monitored Resource Name
Applicable only for action=search_monitored_resource_associations.
destination_resource_type
string
Source Monitored Resource Type
Applicable only for action=search_monitored_resource_associations.
exclude_fields
list / elements=string
Partial response refers to an optimization technique offered by the RESTful web APIs, to return all the information except the fields requested to be excluded (excludeFields) by the client. In this mechanism, the client sends the exclude field names as the query parameters for an API to the server, and the server trims down the default response content by removing the fields that are not required by the client. The parameter controls which fields to exlude and to return and should be a query string parameter called "excludeFields" of an array type, provide the values as enums, and use collectionFormat.
Applicable only for action=search.
external_id
string
External resource is any OCI resource identifier OCID which is not a Stack Monitoring service resource. Currently supports only following resource type identifiers - externalcontainerdatabase, externalnoncontainerdatabase, externalpluggabledatabase and OCI compute instance.
Applicable only for action=search.
fields
list / elements=string
Partial response refers to an optimization technique offered by the RESTful web APIs, to return only the information (fields) required by the client. In this mechanism, the client sends the required field names as the query parameters for an API to the server, and the server trims down the default response content by removing the fields that are not required by the client. The parameter controls which fields to return and should be a query string parameter called "fields" of an array type, provide the values as enums, and use collectionFormat.
Applicable only for action=search.
host_name
string
A filter to return resources with host name match
Applicable only for action=search.
host_name_contains
string
A filter to return resources with host name pattern
Applicable only for action=search.
lifecycle_state
string
    Choices:
  • CREATING
  • UPDATING
  • ACTIVE
  • DELETING
  • DELETED
  • FAILED
A filter to return resources with matching lifecycle state.
Applicable only for action=search.
limit_level
integer
The field which determines the depth of hierarchy while searching for members
Applicable only for action=search_monitored_resource_members.
management_agent_id
string
A filter to return resources with matching management agent id.
Applicable only for action=search.
monitored_resource_id
string
The OCID of monitored resource.
Required for action=change_compartment, action=disable_external_database, action=search_monitored_resource_members.
name
string
A filter to return resources that match exact resource name
Applicable only for action=search.
name_contains
string
A filter to return resources that match resource name pattern given. The match is not case sensitive.
Applicable only for action=search.
property_equals
dictionary
Criteria based on resource property.
Applicable only for action=search.
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_time_zone
string
Time zone in the form of tz database canonical zone ID.
Applicable only for action=search.
sort_by
string
    Choices:
  • TIME_CREATED
  • ASSOC_TYPE
  • resourceName
  • resourceType
  • sourceResourceType
  • RESOURCE_NAME
The field to sort by. Only one sort order may be provided. Default order for timeCreated is descending. Default order for assocType is descending.
Applicable only for action=search_monitored_resource_associationsaction=search_monitored_resource_membersaction=search.
sort_order
string
    Choices:
  • ASC
  • DESC
The sort order to use, either 'ASC' or 'DESC'.
Applicable only for action=search_monitored_resource_associationsaction=search_monitored_resource_membersaction=search.
source_resource_id
string
Source Monitored Resource Identifier OCID
Required for action=associate.
source_resource_name
string
Source Monitored Resource Name
Applicable only for action=search_monitored_resource_associations.
source_resource_type
string
Source Monitored Resource Type
Applicable only for action=search_monitored_resource_associations.
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
time_created_greater_than_or_equal_to
string
Search for resources that were created within a specific date range, using this parameter to specify the earliest creation date for the returned list (inclusive). Specifying this parameter without the corresponding `timeCreatedLessThan` parameter will retrieve resources created from the given `timeCreatedGreaterThanOrEqualTo` to the current time, in "YYYY-MM-ddThh:mmZ" format with a Z offset, as defined by RFC 3339.
**Example:** 2016-12-19T16:39:57.600Z
Applicable only for action=search.
time_created_less_than
string
Search for resources that were created within a specific date range, using this parameter to specify the latest creation date for the returned list (exclusive). Specifying this parameter without the corresponding `timeCreatedGreaterThanOrEqualTo` parameter will retrieve all resources created before the specified end date, in "YYYY-MM-ddThh:mmZ" format with a Z offset, as defined by RFC 3339.
**Example:** 2016-12-19T16:39:57.600Z
Applicable only for action=search.
time_updated_greater_than_or_equal_to
string
Search for resources that were updated within a specific date range, using this parameter to specify the earliest update date for the returned list (inclusive). Specifying this parameter without the corresponding `timeUpdatedLessThan` parameter will retrieve resources updated from the given `timeUpdatedGreaterThanOrEqualTo` to the current time, in "YYYY-MM-ddThh:mmZ" format with a Z offset, as defined by RFC 3339.
**Example:** 2016-12-19T16:39:57.600Z
Applicable only for action=search.
time_updated_less_than
string
Search for resources that were updated within a specific date range, using this parameter to specify the latest creation date for the returned list (exclusive). Specifying this parameter without the corresponding `timeUpdatedGreaterThanOrEqualTo` parameter will retrieve all resources updated before the specified end date, in "YYYY-MM-ddThh:mmZ" format with a Z offset, as defined by RFC 3339.
**Example:** 2016-12-19T16:39:57.600Z
Applicable only for action=search.
type
string
A filter to return resources that match resource type
Applicable only for action=search.
wait
boolean
    Choices:
  • no
  • yes ←
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.

Examples

- name: Perform action associate on monitored_resource
  oci_stack_monitoring_monitored_resource_actions:
    # required
    source_resource_id: "ocid1.sourceresource.oc1..xxxxxxEXAMPLExxxxxx"
    association_type: association_type_example
    destination_resource_id: "ocid1.destinationresource.oc1..xxxxxxEXAMPLExxxxxx"
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    action: associate

- name: Perform action change_compartment on monitored_resource
  oci_stack_monitoring_monitored_resource_actions:
    # required
    monitored_resource_id: "ocid1.monitoredresource.oc1..xxxxxxEXAMPLExxxxxx"
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    action: change_compartment

- name: Perform action disable_external_database on monitored_resource
  oci_stack_monitoring_monitored_resource_actions:
    # required
    monitored_resource_id: "ocid1.monitoredresource.oc1..xxxxxxEXAMPLExxxxxx"
    action: disable_external_database

- name: Perform action disassociate on monitored_resource
  oci_stack_monitoring_monitored_resource_actions:
    # required
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    action: disassociate

    # optional
    source_resource_id: "ocid1.sourceresource.oc1..xxxxxxEXAMPLExxxxxx"
    association_type: association_type_example
    destination_resource_id: "ocid1.destinationresource.oc1..xxxxxxEXAMPLExxxxxx"

- name: Perform action search_monitored_resource_associations on monitored_resource
  oci_stack_monitoring_monitored_resource_actions:
    # required
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    action: search_monitored_resource_associations

    # optional
    source_resource_id: "ocid1.sourceresource.oc1..xxxxxxEXAMPLExxxxxx"
    source_resource_name: source_resource_name_example
    source_resource_type: source_resource_type_example
    destination_resource_name: destination_resource_name_example
    destination_resource_type: destination_resource_type_example
    association_type: association_type_example
    destination_resource_id: "ocid1.destinationresource.oc1..xxxxxxEXAMPLExxxxxx"
    sort_order: ASC
    sort_by: TIME_CREATED

- name: Perform action search_monitored_resource_members on monitored_resource
  oci_stack_monitoring_monitored_resource_actions:
    # required
    monitored_resource_id: "ocid1.monitoredresource.oc1..xxxxxxEXAMPLExxxxxx"
    action: search_monitored_resource_members

    # optional
    destination_resource_id: "ocid1.destinationresource.oc1..xxxxxxEXAMPLExxxxxx"
    limit_level: 56
    sort_order: ASC
    sort_by: TIME_CREATED

- name: Perform action search on monitored_resource
  oci_stack_monitoring_monitored_resource_actions:
    # required
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    action: search

    # optional
    name: name_example
    name_contains: name_contains_example
    type: type_example
    host_name: host_name_example
    external_id: "ocid1.external.oc1..xxxxxxEXAMPLExxxxxx"
    host_name_contains: host_name_contains_example
    management_agent_id: "ocid1.managementagent.oc1..xxxxxxEXAMPLExxxxxx"
    lifecycle_state: CREATING
    time_created_greater_than_or_equal_to: time_created_greater_than_or_equal_to_example
    time_created_less_than: time_created_less_than_example
    time_updated_greater_than_or_equal_to: time_updated_greater_than_or_equal_to_example
    time_updated_less_than: time_updated_less_than_example
    resource_time_zone: resource_time_zone_example
    sort_order: ASC
    sort_by: TIME_CREATED
    property_equals: null
    fields: [ "fields_example" ]
    exclude_fields: [ "exclude_fields_example" ]

Return Values

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

Key Returned Description
monitored_resource
complex
on success
Details of the MonitoredResource resource acted upon by the current operation

Sample:
{'aliases': {'credential': {'name': 'name_example', 'service': 'service_example', 'source': 'source_example'}, 'name': 'name_example', 'source': 'source_example'}, 'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'credentials': {'credential_type': 'EXISTING', 'description': 'description_example', 'key_id': 'ocid1.key.oc1..xxxxxxEXAMPLExxxxxx', 'name': 'name_example', 'properties': [{'name': 'name_example', 'value': 'value_example'}], 'source': 'source_example', 'type': 'type_example'}, 'database_connection_details': {'connector_id': 'ocid1.connector.oc1..xxxxxxEXAMPLExxxxxx', 'db_id': 'ocid1.db.oc1..xxxxxxEXAMPLExxxxxx', 'db_unique_name': 'db_unique_name_example', 'port': 56, 'protocol': 'TCP', 'service_name': 'service_name_example', 'ssl_secret_id': 'ocid1.sslsecret.oc1..xxxxxxEXAMPLExxxxxx'}, 'defined_tags': {'Operations': {'CostCenter': 'US'}}, 'display_name': 'display_name_example', 'external_id': 'ocid1.external.oc1..xxxxxxEXAMPLExxxxxx', 'freeform_tags': {'Department': 'Finance'}, 'host_name': 'host_name_example', 'id': 'ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx', 'lifecycle_state': 'CREATING', 'management_agent_id': 'ocid1.managementagent.oc1..xxxxxxEXAMPLExxxxxx', 'name': 'name_example', 'properties': [{'name': 'name_example', 'value': 'value_example'}], 'resource_time_zone': 'resource_time_zone_example', 'system_tags': {}, 'tenant_id': 'ocid1.tenant.oc1..xxxxxxEXAMPLExxxxxx', 'time_created': '2013-10-20T19:20:30+01:00', 'time_updated': '2013-10-20T19:20:30+01:00', 'type': 'type_example'}
 
aliases
complex
on success

   
credential
complex
on success

     
name
string
on success
The name of the pre-existing source credential which alias cred should point to. This should refer to the pre-existing source attribute binded credential name.

Sample:
name_example
     
service
string
on success
The name of the service owning the credential. Ex stack-monitoring or dbmgmt

Sample:
service_example
     
source
string
on success
The source type and source name combination,delimited with (.) separator. This refers to the pre-existing source which alias cred should point to. Ex. {source type}.{source name} and source type max char limit is 63.

Sample:
source_example
   
name
string
on success
The name of the alias, within the context of the source.

Sample:
name_example
   
source
string
on success
The source type and source name combination,delimited with (.) separator. Ex. {source type}.{source name} and source type max char limit is 63.

Sample:
source_example
 
compartment_id
string
on success
Compartment Identifier OCID

Sample:
ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
 
credentials
complex
on success

   
credential_type
string
on success
Type of credentials specified in the credentials element. Three possible values - EXISTING, PLAINTEXT and ENCRYPTED. * EXISTING - Credential is already stored in agent and only credential name need to be passed for existing credential. * PLAINTEXT - The credential properties will have credentials in plain text format. * ENCRYPTED - The credential properties will have credentials stored in vault in encrypted format using KMS client which uses master key for encryption. The same master key will be used to decrypt the credentials before passing on to the management agent.

Sample:
EXISTING
   
description
string
on success
The user-specified textual description of the credential.

Sample:
description_example
   
key_id
string
on success
The master key OCID and applicable only for property value type ENCRYPTION. Key OCID is passed as input to Key management service decrypt API to retrieve the encrypted property value text.

Sample:
ocid1.key.oc1..xxxxxxEXAMPLExxxxxx
   
name
string
on success
The name of the credential, within the context of the source.

Sample:
name_example
   
properties
complex
on success
The credential properties list. Credential property values will be encrypted format.

     
name
string
on success
The name of the credential property, should confirm with names of properties of this credential's type. Ex. For JMXCreds type , credential property name for weblogic user is 'Username'.

Sample:
name_example
     
value
string
on success
The value of the credential property name. Ex. For JMXCreds type, credential property value for 'Username' property is 'weblogic'.

Sample:
value_example
   
source
string
on success
The source type and source name combination,delimited with (.) separator. {source type}.{source name} and source type max char limit is 63.

Sample:
source_example
   
type
string
on success
The type of the credential ( ex. JMXCreds,DBCreds).

Sample:
type_example
 
database_connection_details
complex
on success

   
connector_id
string
on success
Database connector Identifier

Sample:
ocid1.connector.oc1..xxxxxxEXAMPLExxxxxx
   
db_id
string
on success
dbId of the database

Sample:
ocid1.db.oc1..xxxxxxEXAMPLExxxxxx
   
db_unique_name
string
on success
UniqueName used for database connection requests.

Sample:
db_unique_name_example
   
port
integer
on success
Listener Port number used for connection requests.

Sample:
56
   
protocol
string
on success
Protocol used in DB connection string when connecting to external database service.

Sample:
TCP
   
service_name
string
on success
Service name used for connection requests.

Sample:
service_name_example
   
ssl_secret_id
string
on success
SSL Secret Identifier for TCPS connector in OCI VaultL(OCID,https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm)

Sample:
ocid1.sslsecret.oc1..xxxxxxEXAMPLExxxxxx
 
defined_tags
dictionary
on success
Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: `{"foo-namespace": {"bar-key": "value"}}`

Sample:
{'Operations': {'CostCenter': 'US'}}
 
display_name
string
on success
Monitored resource display name.

Sample:
display_name_example
 
external_id
string
on success
External resource is any OCI resource identifier OCID which is not a Stack Monitoring service resource. Currently supports only following resource type identifiers - externalcontainerdatabase, externalnoncontainerdatabase, externalpluggabledatabase and OCI compute instance.

Sample:
ocid1.external.oc1..xxxxxxEXAMPLExxxxxx
 
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: `{"bar-key": "value"}`

Sample:
{'Department': 'Finance'}
 
host_name
string
on success
Monitored resource host name.

Sample:
host_name_example
 
id
string
on success
The OCID of monitored resource.

Sample:
ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
 
lifecycle_state
string
on success
Lifecycle state of the monitored resource.

Sample:
CREATING
 
management_agent_id
string
on success
Management Agent Identifier OCID.

Sample:
ocid1.managementagent.oc1..xxxxxxEXAMPLExxxxxx
 
name
string
on success
Monitored resource name.

Sample:
name_example
 
properties
complex
on success
List of monitored resource properties

   
name
string
on success
property name

Sample:
name_example
   
value
string
on success
property value

Sample:
value_example
 
resource_time_zone
string
on success
Time zone in the form of tz database canonical zone ID.

Sample:
resource_time_zone_example
 
system_tags
dictionary
on success
Usage of system tag keys. These predefined keys are scoped to namespaces. Example: `{"orcl-cloud": {"free-tier-retained": "true"}}`

 
tenant_id
string
on success
Tenancy Identifier OCID

Sample:
ocid1.tenant.oc1..xxxxxxEXAMPLExxxxxx
 
time_created
string
on success
The time the the resource was created. An RFC3339 formatted datetime string

Sample:
2013-10-20T19:20:30+01:00
 
time_updated
string
on success
The time the the resource was updated. An RFC3339 formatted datetime string

Sample:
2013-10-20T19:20:30+01:00
 
type
string
on success
Monitored resource type

Sample:
type_example


Authors

  • Oracle (@oracle)