Oracle Enterprise Manager App for Grafana

Oracle Enterprise Manager 13c provides out-of-box dashboard functionality, so you can see the status of all your targets on a single screen. You also have information about target’s fatal, critical, warning and escalated incidents along with detailed information about them.

But what about additional data that EM is already collecting? What if you create Metric Extensions and you want to display them in the dashboard?

Oracle Enterprise Manager App for Grafana was just released last month. This Grafana plug-in allows you directly connect from Grafana to Oracle Enterprise Manager and make use of the already collected data in order to create custom dashboards.



In this post I want to guide you through the process of installing a test Grafana server and connect that to Oracle Enterprise Manager.

First things first, you need to make sure you install Grafana 6.6.2 or higher and you have Oracle Enterprise Manager 13.4 RU 3 or higher. Let’s now jump into the installation process.

I have a small VM running OL7. I assinged 2 CPUs and 8 GB of RAM. The next step is to install Grafana in the VM.

$ wget https://dl.grafana.com/oss/release/grafana-7.0.5-1.x86                                                                                                                                                                                                                                             _64.rpm
--2020-06-30 19:36:01--  https://dl.grafana.com/oss/release/grafana-7.0.5-1.x86_                                                                                                                                                                                                                                             64.rpm
Resolving dl.grafana.com (dl.grafana.com)... 151.101.138.217, 2a04:4e42:46::729
Connecting to dl.grafana.com (dl.grafana.com)|151.101.138.217|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 49118311 (47M) [application/x-redhat-package-manager]
Saving to: ‘grafana-7.0.5-1.x86_64.rpm’

100%[======================================>] 49,118,311   232MB/s   in 0.2s

2020-06-30 19:36:02 (232 MB/s) - ‘grafana-7.0.5-1.x86_64.rpm’ saved [49118311/49                                                                                                                                                                                                                                             118311]
$ sudo yum install grafana-7.0.5-1.x86_64.rpm
Loaded plugins: langpacks, ulninfo
Examining grafana-7.0.5-1.x86_64.rpm: grafana-7.0.5-1.x86_64
Marking grafana-7.0.5-1.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package grafana.x86_64 0:7.0.5-1 will be installed
--> Processing Dependency: fontconfig for package: grafana-7.0.5-1.x86_64
--> Processing Dependency: urw-fonts for package: grafana-7.0.5-1.x86_64
...
--> Running transaction check
---> Package libXau.x86_64 0:1.0.8-2.1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                              Arch   Version         Repository    Size
================================================================================
Installing:
 grafana                              x86_64 7.0.5-1         /grafana-7.0.5-1.x8                                                                                                                                                                                                                                             6_64
                                                                          143 M
Installing for dependencies:
 ...
Installed:
  grafana.x86_64 0:7.0.5-1

Complete!

Now is time to start Grafana server in the VM.

$ sudo systemctl daemon-reload
$ sudo systemctl start grafana-server
$ sudo systemctl status grafana-server
● grafana-server.service - Grafana instance
   Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; disabled; vendor preset: disabled)
   Active: active (running) since Tue 2020-06-30 19:40:40 GMT; 1s ago
 ...
lvl=info msg="External plugins directory created" logger=plugins directory=/var/lib/grafana/plugins
Jun 30 19:40:40 grafana-s02 systemd[1]: Started Grafana instance.
Jun 30 19:40:40 grafana-s02 grafana-server[11614]: t=2020-06-30T19:40:40+0000 lvl=info msg="HTTP Server Listen" logger=http.server address=[::]:3000 protocol=http subUrl= socket=

Let’s now login to our Grafana server installation. By default the port assigned is 3000, so the URL will be similar to http://<grafana_server>:3000

Grafana Welcome Page

The default credentials are admin/admin. Grafana will ask you to change the admin password right after the first login.

The next step is to download and install the Oracle Enterprise Manager App for Grafana. You can find the download link and documentation below.



There are 2 methods for installing the EM App for Grafana:

  • Using CLI (grafana-cli)
  • Without CLI

For my test, I’m going to install the EM App for Grafana without using the CLI.

$ sudo mv oracle-emcc-app-1.0.2.zip /var/lib/grafana/plugins/
$ sudo unzip /var/lib/grafana/plugins/oracle-emcc-app-1.0.2.zip
Archive:  oracle-emcc-app-1.0.2.zip
   creating: oracle-emcc-app-1.0.2/
   creating: oracle-emcc-app-1.0.2/datasource/
  inflating: oracle-emcc-app-1.0.2/datasource/query_ctrl.js
  inflating: oracle-emcc-app-1.0.2/datasource/Response.js
  inflating: oracle-emcc-app-1.0.2/datasource/EMCCConstants.js
  inflating: oracle-emcc-app-1.0.2/datasource/plugin.json
  inflating: oracle-emcc-app-1.0.2/datasource/QueryResource.js
   creating: oracle-emcc-app-1.0.2/datasource/img/
  inflating: oracle-emcc-app-1.0.2/datasource/img/em_logo.png
  inflating: oracle-emcc-app-1.0.2/datasource/module.js
  inflating: oracle-emcc-app-1.0.2/datasource/BaseQueryResource.js
  inflating: oracle-emcc-app-1.0.2/datasource/MetricQueryResource.js
  inflating: oracle-emcc-app-1.0.2/datasource/Utils.js
  inflating: oracle-emcc-app-1.0.2/datasource/config_ctrl.js
  inflating: oracle-emcc-app-1.0.2/datasource/datasource.js
   creating: oracle-emcc-app-1.0.2/datasource/partials/
  inflating: oracle-emcc-app-1.0.2/datasource/partials/query.editor.html
  inflating: oracle-emcc-app-1.0.2/datasource/partials/config.html
  inflating: oracle-emcc-app-1.0.2/datasource/partials/annotation.editor.html
  inflating: oracle-emcc-app-1.0.2/plugin.json
  inflating: oracle-emcc-app-1.0.2/README.md
   creating: oracle-emcc-app-1.0.2/img/
  inflating: oracle-emcc-app-1.0.2/img/em_logo.png
   creating: oracle-emcc-app-1.0.2/components/
  inflating: oracle-emcc-app-1.0.2/components/config.js
   creating: oracle-emcc-app-1.0.2/components/partials/
  inflating: oracle-emcc-app-1.0.2/components/partials/config.html
  inflating: oracle-emcc-app-1.0.2/module.js
   creating: oracle-emcc-app-1.0.2/dashboards/
  inflating: oracle-emcc-app-1.0.2/dashboards/template_single_em_single_target_type_single_target_name_single_named_credential.json
  inflating: oracle-emcc-app-1.0.2/dashboards/template_single_em_single_target_type_single_target_name.json
  inflating: oracle-emcc-app-1.0.2/dashboards/template_single_em_single_target_type.json
  inflating: oracle-emcc-app-1.0.2/dashboards/template_multi_em.json
  inflating: oracle-emcc-app-1.0.2/dashboards/database_performance_report.json
  inflating: oracle-emcc-app-1.0.2/dashboards/template_single_em_single_target_type_multi_target_name.json
  inflating: oracle-emcc-app-1.0.2/dashboards/database_configuration_report.json
  inflating: oracle-emcc-app-1.0.2/dashboards/template_single_em.json

We now have to restart Grafana server.

$ sudo systemctl restart grafana-server
$ sudo systemctl status grafana-server
● grafana-server.service - Grafana instance
   Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; disabled; vendor preset: disabled)
  ...
Jul 01 16:21:11 grafana-s02 systemd[1]: Started Grafana instance.
Jul 01 16:21:11 grafana-s02 grafana-server[5675]: t=2020-07-01T16:21:11+0000 lvl=info msg="HTTP Server Listen" logger=http.server address=[::]:3000 protocol=http subUrl= socket=

The EM App for Grafana has been installed, now we need to enable it and start using it. Before we do that we need to also enable it in our EM installation first. There 3 emctl command that we need to execute:

$ emctl set property -name oracle.sysman.db.restfulapi.grafana.enable -value true -sysman_pwd ********
Oracle Enterprise Manager Cloud Control 13c Release 4
Copyright (c) 1996, 2020 Oracle Corporation.  All rights reserved.
Property oracle.sysman.db.restfulapi.grafana.enable has been set to value true for all Management Servers
OMS restart is not required to reflect the new property value

$ emctl set property -name oracle.sysman.db.restfulapi.grafana.executesql.repository.query.enable -value true -sysman_pwd ********
Oracle Enterprise Manager Cloud Control 13c Release 4
Copyright (c) 1996, 2020 Oracle Corporation.  All rights reserved.
Property oracle.sysman.db.restfulapi.grafana.executesql.repository.query.enable has been set to value true for all Management Servers
OMS restart is not required to reflect the new property value

$ emctl set property -name oracle.sysman.db.restfulapi.grafana.executesql.target.query.enable -value true -sysman_pwd ********
Oracle Enterprise Manager Cloud Control 13c Release 4
Copyright (c) 1996, 2020 Oracle Corporation.  All rights reserved.
Property oracle.sysman.db.restfulapi.grafana.executesql.target.query.enable has been set to value true for all Management Servers
OMS restart is not required to reflect the new property value

Login back to the Grafana server and navigate to Configuration -> Plugins. Scroll down and look for Oracle Enterprise Manager App and click on the Plugin. You will see a button to “Enable” the plugin.

Enable Oracle Enterprise Manager App Plugin

Now is time to configure our Grafana datasource to connect to our Oracle Enterprise Manager installation. Navigate to Configuration -> Data Sources. Click on “Add data source” button. Scroll down and look for Oracle Enterprise Manager. Click on that and fill the required parameters:

  • Name
  • URL
  • User (do not use SYSMAN)
  • Password

Now click on “Save & Test” and look for a confirmation.

In order to verify that our Oracle Enterprise Manager App for Grafana is working properly we can open one of the sample dashboards. Let’s navigate to Dashboards -> Manage and click on the “Sample – Database Performance Report” dashboard. You should see something similar as below.

Sample Grafana – EM Dashboard

You can copy these sample dashboards and adjust them for your needs. You may also develop your own dashboards by querying all the Repository Views that EM exposes as part of the extensibility framework.

Hope this provides some guidance on how to deploy the Oracle Enterprise Manager App for Grafana.

Thanks,
Alfredo