EDUCAÇÃO E TECNOLOGIA

SAP Cloud ALM – Looking into the Grafana integration

This blog describes the process of setting up the Cloud ALM Grafana plugin as well as some findings. It may also help customers wondering what Grafana is and how it can help them monitoring SAP and non-SAP solutions on a broader scale.

First things first, what is Grafana? It’s an open solution that makes building operational dashboards a lot easier. The engine is powerful and comes with 100+ standard integrations for your databases, applications and infrastructure. The product also feels very 2021, as you can see for yourself here. In other words, you get metrics, logs and traces from the get-go – no matter where it’s hosted. Grafana itself works both on the Cloud and on-premise, although you need the latter for the CloudALM plugin.

Oh, and its free tiers is really nice (up to 50GB logs and traces).

How does it work? You create an account (or authenticate through Google, AWS, Azure), add the plugins (integrations) you need and setup your data sources. The data source is basically the connection to your external solutions, such as Sputnik or Cloud ALM. Build a few queries, add them to your dashboard. That’s it, you are good to go.

Before we begin, here are two important links:

This blog is simply to clarify a few steps and show you a different end result. It takes about 30 minutes to setup if you’ve got your coffee ready. The product is not so different from any other BI product out there or even SAP Analytics Cloud, but it has a lot of following in the open-source community.

Install Grafana

If this is the first time, know that Grafana works with plugins. Each plugin establishes the connection between the tool and your external product, such as Cloud ALM. However, you can only install custom plugins (not available on the marketplace) on the self-hosted version. This means you will need to either install the Grafana server locally for testing purpose or deploy it on a cloud hosting platform such as GCP or AWS. You can download the server here.

Build the Cloud ALM plugin

Download the plugin from Github and follow the SAP procedure. This is a simple yarn install and yarn build process that generates a “dist” folder. Navigate to that folder and edit the “plugin.json” file. Unfortunately, there is no way to maintain the Cloud ALM credentials directly from Grafana so you have to do it manually. Look for the “routes”: [ ] section and add a new entry where the params are generated following those steps:

{ "path": "calm", "url": "https://YOURDOMAIN.eu10.alm.cloud.sap/api/calm-analytics/v1", "tokenAuth": { "url": "https://YOURDOMAIN.authentication.eu10.hana.ondemand.com/oauth/token", "params": { "grant_type": "client_credentials", "client_id": "YOUR CLIENT_ID", "client_secret": "YOUR CLIENT_SECRET" } }
}

Enable the plugin in Grafana

For Windows users, navigate to path\GrafanaLabs\grafana\data\plugins and create a new folder (e.g., sap-alm-dp-api-datasource) then paste the previous “dist” folder into it. Done? No. Since the plugin is custom and not signed by Grafana, you need to modify your server settings as well. Create a “custom.ini” file as explained in the Grafana guide and adjust the [plugins] section:

allow_loading_unsigned_plugins = sap-alm-dp-api-datasource

And… finally start the server! (default Grafana credentials are admin/admin)

Setup the Cloud ALM datasource

We’re almost there. Logon to the server and navigate to Settings/plugins. Click “sap-alm-dp-api-datasource” to setup the plugin then click the button “Create a SAP ALM DP API data source”. Make sure the SAP Cloud ALM toggle is ON and enter “calm” (or your own route name) in the Alias. Finally, click “Save & Test”. You should now have all the different Provider settings listed.

If you get an error and the list is empty, check the browser console log. You probably have an issue with your Cloud ALM service keys (either a typo or you missed some of the authorization scope while generating the BTP instance). Whenever you make a change, restart the Grafana server.

Build your first metric

Click the Create/Dashboard icon in the side menu, then click the “Add a new panel” to create a metric. You will be welcomed with a lot of options. At the bottom, the Query section is actually where you will build the query. Choose a Data Provider (from the list above) and the filters/dimensions/measures will update automatically as a result.

For example, setting up a metric for Integration Monitoring this way:

(bottom section)

(side section)

…will result in this!

One of the most powerful features offered by Grafana is transformation, similarly to how you can customize database queries. Filters, field lookups, group by, reduce, merge are a few examples of what you can do. Another great feature are the suggestions for visualizations. If you don’t know how to present your data, the solution will make a few recommendations for you to choose from.

Again, the goal here is not necessarily to focus on SAP Cloud ALM (you already have plenty of possibilities within the solution itself), but offer more alternatives to customers to leverage the tools they may be using!