OCI Metrics in Grafana

Use this page when the Oracle Cloud Infrastructure Metrics datasource is available in your Sauron Grafana and you need to read OCI metrics. If it is not listed, ask the Sauron team whether it is supported for your instance before changing your setup.

This setup uses an OCI identity with permission to read the metrics you need. Your OCI IAM owner decides the group and policy scope. The example screenshots show one possible setup; do not create a tenancy-wide policy by default.

Before you start

Confirm these items before creating the datasource:

  1. You can open Grafana for this Sauron.
  2. The OCI CLI is installed in your local environment.
  3. oci setup config has created $HOME/.oci/config.
  4. Your OCI public key has been uploaded through OCI Console.
  5. Your OCI IAM owner has granted the user access to the specific metrics and compartments you need.
  6. You can read the private key file referenced by your OCI config, such as $HOME/.oci/oci_api_key.pem.

Do not paste OCI private keys, tokens, passwords, or full credentials into support channels, tickets, screenshots, or shared documents.

Create your first OCI metrics datasource

Configure OCI CLI

Install the Oracle Cloud Infrastructure CLI, then run:

oci setup config

If you have not uploaded your public key through OCI Console, follow the OCI API signing key instructions before continuing.

The setup prompts let you choose the config and key paths. Read key_file in your OCI config to find the actual private key; the paths below are examples:

  • $HOME/.oci/config
  • $HOME/.oci/oci_api_key.pem

Grafana needs values from the OCI config file and the private key file to configure the OCI Metrics datasource.

Configure OCI Identity group and policy

Ask your OCI IAM owner which existing group and policy to use. If a new group is required, its name and scope are your team's decision. The screenshot below uses grafana only as an example.

OCI Identity group for Grafana

For illustration, a tenancy-wide read policy could use these statements. Have your IAM owner choose the narrowest suitable compartment and approve the actual policy before creating it:

allow group grafana to read metrics in tenancy
allow group grafana to read compartments in tenancy

OCI policy for Grafana metrics access

Create the Grafana datasource

Open Grafana data sources.

Select Add data source, search for Oracle, and choose Oracle Cloud Infrastructure Metrics.

Grafana datasource search for Oracle

Configure the datasource with values from $HOME/.oci/config and $HOME/.oci/oci_api_key.pem:

  • Set Authentication Provider to OCI User.
  • Set Tenancy Mode to Single Tenancy.
  • Choose the same region as the one in your OCI config file.
  • Fill in User OCID, Tenancy OCID, and Fingerprint from $HOME/.oci/config.
  • Fill in Private Key from your private key file.
  • Click Save & Test.

Grafana Oracle Cloud Infrastructure Metrics datasource

For more options, see the OCI Metrics plugin guide.

Check the installed plugin version and its current setup instructions before using a migration guide for a different version.

Prove it works before production

Before relying on the datasource for dashboards:

  1. Confirm Save & Test succeeds in Grafana.
  2. Create or open a Grafana panel that uses the OCI Metrics datasource.
  3. Select the tenancy, compartment, namespace, and metric you expect to query.
  4. Confirm the panel returns data for the selected time range.
  5. If the datasource test or query fails, check the OCI region, User OCID, Tenancy OCID, fingerprint, private key, and OCI IAM policy.

Check Grafana logs

You can use the Sauron API Server to check Grafana pod logs when datasource setup fails:

  1. Open the Sauron API reference.
  2. Search for Logs.
  3. Open GET /v1/log.
  4. Select grafana as podNamePrefix.
  5. Click Execute.

Remove private keys, tokens, passwords, and full credentials before sharing any log output.

Tips and checks

  • Tips: Select the intended OCI region and compartment. Keep private keys out of dashboard files and screenshots.
  • Check: Use Save & Test, then query a known metric in the correct namespace and time range. If it fails, check the datasource error and approved IAM group and read policies.