|
1 | | -# Oracle Cloud Infrastructure Data Source for Grafana |
| 1 | +# Oracle Cloud Infrastructure Metrics Data Source |
2 | 2 |
|
3 | 3 | ## Introduction |
4 | 4 |
|
5 | | -This plugin makes queries to the Oracle Cloud Infrastructure Monitoring Service and displays them on Grafana. |
| 5 | +Grafana is a popular technology that makes it easy to visualize metrics and logs. |
| 6 | +The Oracle Cloud Infrastructure Monitoring Grafana Plugin can be used to extend Grafana by adding [Oracle Cloud Infrastructure Monitoring](https://docs.cloud.oracle.com/en-us/iaas/Content/Monitoring/Concepts/monitoringoverview.htm) as a data source in Grafana. |
| 7 | +The plugin allows you to retrieve metrics related to a number of resources on Oracle Cloud: Compute, Networking, Storage, and custom metrics from your business applications. |
| 8 | +Once these metrics are in Grafana, they can be analysed along with metrics from other sources, giving you a single pane of glass for your application monitoring needs. |
6 | 9 |
|
7 | | -If you are running Grafana on a machine instance in Oracle Cloud, use the Service Principal with a configured Dynamic Group and policy to allow you to read metrics and compartments. |
| 10 | +For custom metrics from your application, see [Custom Metrics on OCI](https://docs.cloud.oracle.com/en-us/iaas/Content/Monitoring/Tasks/publishingcustommetrics.htm). |
| 11 | +## Prerequisites |
8 | 12 |
|
9 | | -If you are running Grafana anywhere else, make sure you have `~/.oci` configured properly. You can do this by installing the Oracle Cloud CLI and running the setup |
| 13 | +We will discuss two different Grafana IAM configurations that needs to be in place, for Grafana to fetch the metrics from Oracle Cloud Infrastructure Monitoring Service. |
10 | 14 |
|
11 | | -## Note |
| 15 | +### For local/dev box environment |
| 16 | +#### Install the Oracle Cloud Infrastructure CLI |
12 | 17 |
|
13 | | -If you're using a version of Grafana that's older than 6.0, you will need to download the zip file and install this plugin manually, or chmod the binary that is downloaded to make it executable. |
| 18 | +The [Oracle Cloud Infrastructure CLI](https://docs.cloud.oracle.com/iaas/Content/API/Concepts/cliconcepts.htm) provides you with a way to perform tasks in OCI from your command line rather than the OCI Console. It does so by making REST calls to the [OCI APIs](https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm). We will be using the CLI to authenticate between our local environment hosting Grafana and OCI in order to pull in metrics. The CLI is built on Python (version 2.7.5 or 3.5 or later), running on Mac, Windows, or Linux. |
14 | 19 |
|
15 | | -## Installation Documentation |
| 20 | +Begin by [installing the Oracle Cloud Infrastructure CLI](https://docs.cloud.oracle.com/iaas/Content/API/SDKDocs/cliinstall.htm). Follow the installation prompts to install the CLI on your local environment. After the installation is complete, use the `oci setup config` command to have the CLI walk you through the first-time setup process. If you haven't already uploaded your public API signing key through the console, follow the instructions [here](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm#How2) to do so. |
16 | 21 |
|
17 | | -In order to simplify the installation process, we created detailed guides for you to follow: |
| 22 | +#### Configure OCI Identity Policies |
18 | 23 |
|
19 | | -* Install Grafana and the Oracle Cloud Infrastructure Data Source for Grafana on a Linux host using [this document](https://github.com/oracle/oci-grafana-plugin/blob/master/docs/linux.md). |
20 | | -* Install Grafana and the Oracle Cloud Infrastructure Data Source for Grafana on a MacOS host using [this document](https://github.com/oracle/oci-grafana-plugin/blob/master/docs/macos.md). |
21 | | -* Install Grafana and the Oracle Cloud Infrastructure Data Source for Grafana on a virtual machine in Oracle Cloud Infrastructure using [this document](https://github.com/oracle/oci-grafana-plugin/blob/master/docs/linuxoci.md). |
22 | | -* Install Grafana and the Oracle Cloud Infrastructure Data Source for Grafana on a virtual machine in Oracle Cloud Infrastructure using Terraform using [this document](https://github.com/oracle/oci-grafana-plugin/blob/master/docs/terraform.md). |
23 | | -* Install Grafana and the Oracle Cloud Infrastructure Data Source for Grafana on Kubernetes in Oracle Cloud Infrastructure using [this document](https://github.com/oracle/oci-grafana-plugin/blob/master/docs/kubernetes.md) |
| 24 | +In the OCI console under **Identity > Groups** click **Create Group** and create a new group called **GrafanaLoggingUserGroup**. Add the user configured in the OCI CLI to the newly-created group. |
24 | 25 |
|
25 | | -Once you have the data source installed, configure your datasource with your tenancy OCID, default region, and where you're running the plugin (Oracle Cloud or elsewhere). |
| 26 | + |
26 | 27 |
|
27 | | -We also have documentation for how to use the newly installed and configured plugin in our [Using Grafana with Oracle Cloud Infrastructure Data Source](https://github.com/oracle/oci-grafana-plugin/blob/master/docs/using.md) walkthrough. |
| 28 | +Under the **Policy** tab switch to the root compartment and click **Create Policy**. Create a policy allowing the group to read tenancy metrics. Add the following policy statements: |
28 | 29 |
|
29 | | -## Development |
| 30 | +- `allow group GrafanaLoggingUserGroup to read log-groups in tenancy` |
| 31 | +- `allow group GrafanaLoggingUserGroup to read log-content in tenancy` |
30 | 32 |
|
31 | | -### Debugging |
| 33 | + |
| 34 | + |
| 35 | +### For compute-instance/VM on Oracle Cloud Infrastructure |
| 36 | +#### Create Dynamic Group for your instance |
| 37 | +Provision an Oracle Linux [virtual machine](https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm) in OCI connected to a [Virtual Cloud Network](https://docs.cloud.oracle.com/iaas/Content/Network/Tasks/managingVCNs.htm) with access to the public internet. If you do not already have access to a Virtual Cloud Network with access to the public internet you can navigate to **Virtual Cloud Networks** under **Networking** and click **Create Virtual Cloud Network**. Choosing the `CREATE VIRTUAL CLOUD NETWORK PLUS RELATED RESOURCES` option will result in a VCN with an Internet Routing Gateway and Route Tables configured for access to the public internet. Three subnets will be created: one in each availability domain in the region. |
| 38 | + |
| 39 | +After creating your VM, the next step is to create a [dynamic group](https://docs.cloud.oracle.com/iaas/Content/Identity/Tasks/managingdynamicgroups.htm) used to group virtual machine or bare metal compute instances as “principals” (similar to user groups). |
| 40 | +You can define the dynamic group similar to below, where your instance is part of the compartment given in the definition of the dynamic group. |
| 41 | + |
| 42 | +#### Create IAM policy for Dynamic Group for your instance |
| 43 | + |
| 44 | +Next, create a [policy](https://docs.cloud.oracle.com/iaas/Content/Identity/Concepts/policygetstarted.htm) named “grafana_policy” in the root compartment of your tenancy to permit instances in the dynamic group to make API calls against Oracle Cloud Infrastructure services. Add the following policy statements: |
| 45 | + |
| 46 | +* `allow dynamicgroup DynamicGroupForGrafanaInstances to read log-groups in tenancy` |
| 47 | +* `allow dynamicgroup DynamicGroupForGrafanaInstances to read log-content in tenancy` |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | +## For more information |
| 52 | +[Github repository](https://github.com/oracle/oci-grafana-plugin) |
32 | 53 |
|
33 | | -If you want to debug golang backend plugin code, follow the steps below: |
34 | | -* Install [gops](https://github.com/google/gops) to list running go processes on your machine |
35 | | -* Run `gops` and find processId for `oci-plugin_darwin_amd64` process |
36 | | -* Copy this processId to the `.vscode/launch.json` |
37 | | -* In your VSCode from 'Debug' menu call 'Start Debugging' |
|
0 commit comments