Scenario: Sending Metrics to Object Storage
Learn how to send metrics to a bucket in Object Storage using Connector Hub.
Required IAM Policy
If you're a member of the Administrators group, you already have the required access to complete this scenario. Otherwise, you need read access to metrics in the specified compartments.
The workflow for creating a connector with a Monitoring source includes a default policy for reading from Monitoring in the selected compartments. If you're new to policies, see IAM Policies Overview.
Goal
The goal of this scenario is to archive metrics data for compute instances and block volumes to an Object Storage bucket. In this scenario, the resources are in two compartments, so you'll select metrics in both compartments.
Setting Up This Scenario
Setting up this scenario involves creating a connector to move compute instance and block volume metrics (oci_computeagent and oci_blockstore metric namespaces) to a bucket. All metrics of these namespaces are included.
You can complete these tasks in the Oracle Cloud Infrastructure Console, CLI, or API.
For help with troubleshooting, see Troubleshooting Connectors and Troubleshooting Notifications.
On the Connectors list page, select Create connector. If you need help finding the list page, see Listing Connectors.
1. Basic Connector Information
Enter identifying information.
- Connector name: Enter a user-friendly name for the new connector and an optional description. Avoid entering confidential information.
- Select a compartment: Select the compartment to store the new connector in.
Select Next.
2. Configure Connector Source
Specify the source metric for the connector to transfer data from.
- Select source: Select Monitoring.
- Configure source: Select the compute instance and block volume metrics in each compartment.
- Metric compartment: The first compartment containing the compute instances and block volumes you want metrics for.
- Namespaces: Select
oci_computeagentandoci_blockstore. - Select + Another compartment to add the second compartment.
- Metric compartment: The second compartment containing the compute instances and block volumes you want metrics for.
- Namespaces: Select
oci_computeagentandoci_blockstore.
- Create policy: Select to accept the default policy provided for the entered source configuration.
Select Next.
3. Configure Connector Task
Select Next (skip this section).
4. Configure Connector Target
Specify the bucket to send the data to.
- Target: Select Object Storage.
- Configure target: Select the compartment and bucket that you want to send the data to.
- Create policy: Select to accept the default policy provided for the entered target configuration.
Select Next.
Connector Preview
Review the connector configuration and then select Create.
The creation process begins, and its progress is displayed. On completion, the connector's details page opens.
-
Define the Monitoring source for the connector: Save a file named
source.json.Example source.json file{ "kind": "monitoring", "monitoringSources": [ { "compartmentId": "<first_compartment_OCID>", "namespaceDetails": { "kind": "selected", "namespaces": [ { "namespace": "oci_computeagent", "metrics": { "kind": "all" } }, { "namespace": "oci_blockstore", "metrics": { "kind": "all" } } ] } }, { "compartmentId": "<second_compartment_OCID>", "namespaceDetails": { "kind": "selected", "namespaces": [ { "namespace": "oci_computeagent", "metrics": { "kind": "all" } }, { "namespace": "oci_blockstore", "metrics": { "kind": "all" } } ] } } ] } -
Define the Object Storage target for the connector: Save a file named
target.json.Example target.json file{ "kind": "objectStorage", "bucketName": "<bucket_name>", "objectNamePrefix": "<prefix>" } -
Create the connector using the oci sch service-connector create command:
Example command for creating a connectoroci sch service-connector create --compartment-id <compartment_OCID> --display-name "Metrics to Bucket" --source file://source.json --target file://target.jsonFor a complete list of parameters and values for CLI commands, see the CLI Command Reference.
For help with troubleshooting, see Troubleshooting Connectors and Troubleshooting Notifications.
For a complete list of flags and variable options for CLI commands, see the Command Line Reference.
-
Use the CreateServiceConnector operation to create the connector.
Example CreateServiceConnector requestPOST /20200909/serviceConnectors Host: service-connector-hub.us-phoenix-1.oraclecloud.com <authorization and other headers> { "compartmentId": "<compartment_OCID>", "displayName": "Metrics to Bucket", "source": { "kind": "monitoring", "monitoringSources": [ { "compartmentId": "<first_compartment_OCID>", "namespaceDetails": { "kind": "selected", "namespaces": [ { "namespace": "oci_computeagent", "metrics": { "kind": "all" } }, { "namespace": "oci_blockstore", "metrics": { "kind": "all" } } ] } }, { "compartmentId": "<second_compartment_OCID>", "namespaceDetails": { "kind": "selected", "namespaces": [ { "namespace": "oci_computeagent", "metrics": { "kind": "all" } }, { "namespace": "oci_blockstore", "metrics": { "kind": "all" } } ] } } ] }, "target": { "kind": "objectStorage", "bucketName": "<bucket_name>", "objectNamePrefix": "<prefix>" } }
What to Do Next
To view objects in the Console, select the name of the bucket shown on the connector's details page. (You might need to scroll down to see the bucket name.)
For information about downloading objects, see Downloading an Object Storage Object.
If no metrics exist in the bucket, then see troubleshooting information at No Data is Being Moved. For general help with troubleshooting, see Troubleshooting Connectors.