oracle.oci.oci_stack_monitoring_monitored_resource – Manage 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.

New in version 2.9.0: of oracle.oci

Synopsis

  • This module allows the user to create, update and delete a MonitoredResource resource in Oracle Cloud Infrastructure

  • For state=present, creates a new monitored resource for the given resource type

  • This resource has the following action operations in the oracle.oci.oci_stack_monitoring_monitored_resource_actions module: associate, change_compartment, disable_external_database, disassociate, search_monitored_resource_associations, search_monitored_resource_members, search.

Requirements

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

Parameters

Parameter Choices/Defaults Comments
aliases
dictionary
This parameter is updatable.
credential
dictionary / required
name
string / required
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.
service
string / required
The name of the service owning the credential. Ex stack-monitoring or dbmgmt
source
string / required
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.
name
string / required
The name of the alias, within the context of the source.
source
string / required
The source type and source name combination,delimited with (.) separator. Ex. {source type}.{source name} and source type max char limit is 63.
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
Compartment Identifier OCID
Required for create using state=present.
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.
credentials
dictionary
This parameter is updatable.
credential_type
string / required
    Choices:
  • EXISTING
  • ENCRYPTED
  • PLAINTEXT
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.
description
string
The user-specified textual description of the credential.
key_id
string
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.
Required when credential_type is 'ENCRYPTED'
name
string
The name of the credential, within the context of the source.
properties
list / elements=dictionary
The credential properties list. Credential property values will be encrypted format.
Required when credential_type is one of ['PLAINTEXT', 'ENCRYPTED']
name
string / required
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'.
Required when credential_type is 'ENCRYPTED'
value
string / required
The value of the credential property name. Ex. For JMXCreds type, credential property value for 'Username' property is 'weblogic'.
Required when credential_type is 'ENCRYPTED'
source
string
The source type and source name combination,delimited with (.) separator. {source type}.{source name} and source type max char limit is 63.
type
string
The type of the credential ( ex. JMXCreds,DBCreds).
database_connection_details
dictionary
This parameter is updatable.
connector_id
string
Database connector Identifier
db_id
string
dbId of the database
db_unique_name
string
UniqueName used for database connection requests.
port
integer / required
Listener Port number used for connection requests.
protocol
string / required
    Choices:
  • TCP
  • TCPS
Protocol used in DB connection string when connecting to external database service.
service_name
string / required
Service name used for connection requests.
ssl_secret_id
string
SSL Secret Identifier for TCPS connector in OCI VaultL(OCID,https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm)
display_name
string
Monitored resource display name.
This parameter is updatable.
external_id
string
External resource is any OCI resource identifier OCID which is not a Stack Monitoring service resource. Currently supports only OCI compute instance.
external_resource_id
string
Generally used by DBaaS to send the Database OCID stored on the DBaaS. The same will be passed to resource service to enable Stack Monitoring Service on DBM. This will be stored in Stack Monitoring Resource Service data store as identifier for monitored resource. If this header is not set as part of the request, then an id will be generated and stored for the resource.
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.
host_name
string
Host name of the monitored resource
This parameter is updatable.
is_delete_members
boolean
    Choices:
  • no
  • yes
A filter to delete the associated children or not for given resource.
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.
management_agent_id
string
Management Agent Identifier OCID.
monitored_resource_id
string
The OCID of monitored resource.
Required for update using state=present.
Required for delete using state=absent.

aliases: id
name
string
Monitored resource name
Required for create using state=present.
properties
list / elements=dictionary
List of monitored resource properties
This parameter is updatable.
name
string
property name
value
string
property value
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.
This parameter is updatable.
state
string
    Choices:
  • present ←
  • absent
The state of the MonitoredResource.
Use state=present to create or update a MonitoredResource.
Use state=absent to delete a MonitoredResource.
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
type
string
Monitored resource type
Required for create using state=present.
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: Create monitored_resource
  oci_stack_monitoring_monitored_resource:
    # required
    name: name_example
    type: type_example
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"

    # optional
    external_id: "ocid1.external.oc1..xxxxxxEXAMPLExxxxxx"
    management_agent_id: "ocid1.managementagent.oc1..xxxxxxEXAMPLExxxxxx"
    external_resource_id: "ocid1.externalresource.oc1..xxxxxxEXAMPLExxxxxx"
    display_name: display_name_example
    host_name: host_name_example
    resource_time_zone: resource_time_zone_example
    properties:
    - # optional
      name: name_example
      value: value_example
    database_connection_details:
      # required
      protocol: TCP
      port: 56
      service_name: service_name_example

      # optional
      connector_id: "ocid1.connector.oc1..xxxxxxEXAMPLExxxxxx"
      db_unique_name: db_unique_name_example
      db_id: "ocid1.db.oc1..xxxxxxEXAMPLExxxxxx"
      ssl_secret_id: "ocid1.sslsecret.oc1..xxxxxxEXAMPLExxxxxx"
    credentials:
      # required
      credential_type: EXISTING

      # optional
      source: source_example
      name: name_example
      type: type_example
      description: description_example
    aliases:
      # required
      source: source_example
      name: name_example
      credential:
        # required
        source: source_example
        name: name_example
        service: service_example

- name: Update monitored_resource
  oci_stack_monitoring_monitored_resource:
    # required
    monitored_resource_id: "ocid1.monitoredresource.oc1..xxxxxxEXAMPLExxxxxx"

    # optional
    display_name: display_name_example
    host_name: host_name_example
    resource_time_zone: resource_time_zone_example
    properties:
    - # optional
      name: name_example
      value: value_example
    database_connection_details:
      # required
      protocol: TCP
      port: 56
      service_name: service_name_example

      # optional
      connector_id: "ocid1.connector.oc1..xxxxxxEXAMPLExxxxxx"
      db_unique_name: db_unique_name_example
      db_id: "ocid1.db.oc1..xxxxxxEXAMPLExxxxxx"
      ssl_secret_id: "ocid1.sslsecret.oc1..xxxxxxEXAMPLExxxxxx"
    credentials:
      # required
      credential_type: EXISTING

      # optional
      source: source_example
      name: name_example
      type: type_example
      description: description_example
    aliases:
      # required
      source: source_example
      name: name_example
      credential:
        # required
        source: source_example
        name: name_example
        service: service_example

- name: Delete monitored_resource
  oci_stack_monitoring_monitored_resource:
    # required
    monitored_resource_id: "ocid1.monitoredresource.oc1..xxxxxxEXAMPLExxxxxx"
    state: absent

    # optional
    is_delete_members: true

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)