This topic provides instructions for installing, configuring, and using the Oracle Cloud Infrastructure Data Source for Grafana, otherwise referenced as the Grafana Plug-in.
Grafana Plug-in Overview
Grafana is an open-source visualization and alerting tool that you can use for analytics and monitoring of time-series data (metrics). While metrics from Oracle Cloud Infrastructure Monitoring are visible in metrics charts through the Console, you can use Oracle Cloud Infrastructure Data Source for Grafana ("the Grafana Plug-in") to view metrics from resources across providers on a single Grafana dashboard.
Prerequisites for Using the Grafana Plug-in
- An Oracle Cloud Infrastructure account.
- A user in that account, in a security group with an IAM policy that grants necessary permissions for working with resources in the account compartments. The policy must give you access to the metric namespaces emitting metrics (such as Compute) as well as the related resources (such as a set of Compute instances). If you try to perform an action and get a message that you don’t have permission or are unauthorized, confirm with your administrator the type of access you've been granted and which compartment you should work in. Administrators: For common policies that give groups access to metrics, see Let users access monitoring metrics in a compartment and Restrict user access to a specific metric namespace. To authorize resources, such as instances, to make API calls, add the resources to a dynamic group through its matching rules, and then create a policy that allows that dynamic group access to metrics. To allow access across compartments, create the policy in the tenancy. Because of the concept of policy inheritance, instances in the indicated dynamic group can then access metrics in any compartment. To reduce the scope of access to a particular compartment, specify that compartment instead of the tenancy. See Let instances make API calls to access monitoring metrics in the tenancy.
- Compute instances: To emit metrics, Compute instances must be monitoring-enabled. Oracle Cloud Agent software installation may also be required. For more information, see Enabling Monitoring for Compute Instances.
- Required keys and Oracle Cloud Infrastructure IDs (OCIDs). For guidance, see Required Keys and OCIDs.
Download and Install the Grafana Plug-in
Grafana must be installed before you can install the Grafana Plug-in. Version 3.0 or later required.
Authentication for metric access depends on where Grafana is running. If you are running Grafana on a local machine outside Oracle Cloud Infrastructure, you must call the Monitoring API using the Command Line Interface (CLI). If you are running Grafana on an Oracle Cloud Infrastructure Compute instance that you created, then you can add the instance to a dynamic group by configuring a matching rule. In all scenarios, you have the option of calling the API using the CLI.
For instructions on installing the Grafana Plug-in (Oracle Cloud Infrastructure Data Source for Grafana), see https://github.com/oracle/oci-grafana-plugin.
Configure the Grafana Plug-in
This section describes how to add the Grafana Plug-in and set up a dashboard.
When installed locally, the Grafana plug-in accesses metrics using calls to the Monitoring API.
Set up the CLI for accessing Oracle Cloud Infrastructure APIs.
You'll need to access the Monitoring API for authentication.
Navigate to the Grafana homepage at the following URL.
Add the Grafana Plug-In (Oracle Cloud Infrastructure Data Source for Grafana).
In addition to the steps below, see the Grafana instructions for adding data sources at http://docs.grafana.org/guides/getting_started/.
- In Grafana, on the Home Dashboard, click the gear icon on the left.
- Click Add data source.
- In the Filter text box, type: oracle-oci-datasource
- In the filtered list, select oracle-oci-datasource.
In the Settings page, fill in your Tenancy OCID, Default Region, and Environment. For Environment choose local.
- Set up a dashboard of the type "Graph."
(Optional) To confirm access to metrics from Oracle Cloud Infrastructure, update your dashboard query ("Metrics") with a specific region, compartment, namespace, metric. You can also add one or more dimensions.
Congratulations. You can now view your Oracle Cloud Infrastructure metrics in Grafana!
local is for Grafana deployments outside Oracle Cloud Infrastructure.
OCI Instance is for Grafana deployments on Oracle Cloud Infrastructure resources.
The data source is now added, enabling you to set up a dashboard showing metrics from Oracle Cloud Infrastructure.
Troubleshoot the Plug-In
If the dashboard query ("Metrics") fails to populate with options, or if you have other issues accessing metrics, then the IAM policy used to access metrics may be malformed, or it may not include all required matching rules for your dynamic group (for running Grafana on an Oracle Cloud Infrastructure Compute instance that you created).
To resolve this issue, do the following.
- Review your IAM policy to ensure that it matches prerequisites.
- If you updated your IAM policy, then restart the Grafana server and refresh the Grafana homepage.