Skip to content

Latest commit

 

History

History
92 lines (51 loc) · 6.79 KB

linuxoci.md

File metadata and controls

92 lines (51 loc) · 6.79 KB

OCI Virtual Machine Installation - Oracle Cloud Infrastructure Data Source for Grafana

Background

Grafana is a popular technology that makes it easy to visualize metrics. The Oracle Cloud Infrastructure Data Source for Grafana is used to extend Grafana by adding OCI as a data source. The plugin enables you to visualize metrics related to a number of OCI resources: Compute, Networking, Storage, and custom metrics.

This walkthrough is intended for use by people who would like to deploy Grafana and the OCI Data Source for Grafana on a virtual machine in OCI.

Make sure you have access to the Monitoring Service and that metrics have been enabled for the resources you are trying to monitor.

Create the Grafana Environment in OCI

Provision an Oracle Linux virtual machine in OCI connected to a Virtual Cloud Network 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.

After creating your VM, the next step is to create a dynamic group used to group virtual machine or bare metal compute instances as “principals” (similar to user groups).

Screen Shot 2018-12-17 at 4.01.34 PM

Next, create a policy 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:

  • allow dynamicgroup grafana to read metrics in tenancy

  • allow dynamicgroup grafana to read compartments in tenancy

    Screen Shot 2018-12-17 at 4.01.47 PM

Install Grafana and the OCI Metrics Plugin for Grafana 8 and above

To install OCI Metrics Plugin make sure you are running Grafana 8** or above. The latest version of the plugin 5.x.x is available on Grafana Catalogue. Go to Administration on main Grafana menu, and choose plugin. Then you can search for oracle and you will find the plugin:

Search plugin

Click on the metrics plugin to install. The plugin will be installed into your Grafana plugins directory, which by default is located at /var/lib/grafana/plugins. Here is more information on the CLI tool.

Manual installation for previous Grafana Server versions(<8)

Alternatively, you can manually download the .tar file and unpack it into your /grafana/plugins directory. To do so, change to the Grafana plugins directory: cd /usr/local/var/lib/grafana/plugins. Download the OCI Grafana Plugin: wget https://github.com/oracle/oci-grafana-plugin/releases/download/<v.version#>/plugin.tar. Create a directory and install the plugin: mkdir oci && tar -C oci -xvf plugin.tar and then remove the tarball: rm plugin.tar.

Additional step for Grafana 7. Make sure plugin version is <= 2.2.4 . Open the grafana configuration grafana.ini file and add the allow_loading_unsigned_plugins = "oci-datasource"in the plugins section.

Example

    [plugins]
    ;enable_alpha = false
    ;app_tls_skip_verify_insecure = false
    allow_loading_unsigned_plugins = "oci-datasource"

To start the Grafana server, run: sudo systemctl start grafana-server.

Navigate to the Grafana homepage at http://localhost:3000.

Configure Grafana

The next step is to configure the plugin.

You can use a manual configuration or a programatic configuration. In case you want to use the datasource.yaml based plugin configuration you can refers to this document: Data source configuration using yaml file

To find the IP address of the newly-created instance, navigate to Compute > Instances > [Your Instance]. The Public IP address is listed under the Primary VNIC Information section. Connect to Grafana via port forward by running ssh opc@[Instance Public IP] -L 3000:localhost:3000.

Navigate to the Grafana homepage at http://localhost:3000.

Screen Shot 2018-12-17 at 3.23.46 PM

Log in with the default username admin and the password admin. You will be prompted to change your password. Click Skip or Save to continue. Screen Shot 2018-12-17 at 3.23.54 PM

On the Home Dashboard click the gear icon on the left side of the page.

Screen Shot 2018-12-17 at 3.24.02 PM

Click Add data source.

Screen Shot 2018-12-17 at 3.24.13 PM

Choose Oracle Cloud Infrastructure Metrics as your data source type.

Plugin

For Authentication Provider choose OCI Instance (please note that multitenancy mode is not yet supported with OCI Instance as Authentication Provider).

Instance Principals

You do not need to configure the Cross Tenancy OCID, unless you want to use the Cross Tenancy queries using instance principals and AssumeRole capability of OCI, in case you want to redirect metrics queries to another different Tenancy which is allowed to receive queries from an endorsed tenancy. When the user provides a custom tenancy OCID, the plugin will use this value instead of the default tenancy taken from the instance to direct metric queries across all plugin functions (dashboard, alert, explore, and test). More information on AssumeRole in OCI is available here: https://blogs.oracle.com/cloud-infrastructure/post/cross-tenancy-access-assumerole-in-oci

Click Save & Test to return to the home dashboard.

Next Steps

Check out how to use the newly installed and configured plugin in our Using Grafana with Oracle Cloud Infrastructure Data Source walkthrough.