SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
โคข Open full site

Access SAP HANA Cloud Alerts and Metrics using a REST API

Learn how to access details of triggered alerts, view database metrics, and view metering details using REST APIs.

Overview

🎓 beginner 15 min. SAP HANA CloudBeginnerSAP HANA Cloud SAP HANA Database

You will learn

  • โœ”How to use the REST API to access alerts, metrics, and metering
  • โœ”How to use the SAP HANA Cloud REST APIs with one instance or multiple instances

Prerequisites

Prerequisites

  • Access to an SAP HANA Cloud free tier, trial, or production instance
  • A tool such as the REST Client extension for Visual Studio Code enabling the calling of a REST API

Steps

Intro

Alerts can inform you of potential issues that should be addressed or investigated. Metrics provide measurements for a given time or interval that can aid in troubleshooting or root-cause analysis of issues. As an example, after receiving an alert of type HDBLongRunningStatement, a follow up step may be to investigate metric values such as HDBCPU and HDBMemoryUsed in the period around the time that the alert occurred. Metering provides details into the consumption in cost units or CU for instances.

REST APIs provide a simple and easy to consume method to enable access to alerts, metrics, and metering details.

Accessing alerts, metrics, and metering for a data lake Relational Engine is covered in step 6.


Step 1 Get started with the REST Client extension for Visual Studio Code
โ€”

There are multiple tools that enable making calls to a REST API such as Postman, browser extensions, libraries in programming languages such as requests in Python or https in Node.js. Feel free to use the tool of your choice. This tutorial will be using the REST Client extension for Visual Studio Code.

  1. If required, download Visual Studio Code.

  2. Create a folder and a text file that will contain REST API calls and open the file with Visual Studio Code.

    Shell
    mkdir %HOMEPATH%\AlertsMetricsMeteringTutorial
    cd %HOMEPATH%\AlertsMetricsMeteringTutorial
    code AlertsMetricsMetering.http
  3. Paste the following into the opened file and save it.

    HTTP
    #Example REST API call
    #From https://stackoverflow.com/questions/5725430/http-test-server-accepting-get-post-requests and
    GET https://httpbin.org/get?firstname=Bob&lastname=Smith
    
    ###
    
    #Example REST API call
    #From https://www.twilio.com/blog/2017/08/http-requests-in-node-js.html
    GET https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY
    
    ###
    
    #Pet Store
    #From https://petstore.swagger.io/#/pet/findPetsByStatus
    GET https://petstore.swagger.io/v2/pet/findByStatus?status=available
    
    ###

    The # is used as a single line comment character and ### is used to separate REST API calls.

  4. Add the REST Client extension from Marketplace after opening the extensions view.

    Install Rest client
    Install Rest client

  5. Try calling the sample REST APIs by clicking on the blue text Send Request.

    send request
    send request

    The results should appear in another pane. An example result is shown below.

    sample RESP API Call
    sample RESP API Call

    Notice that the URL includes the URL parameters firstname and lastname. The first parameter is indicated with a ?, while the subsequent parameters are indicated by an &.

Step 2 Request a bearer token to enable access to the REST APIs
+
Step 3 Retrieve triggered alerts
+
Step 4 Access database metrics
+
Step 5 Access database metering metrics
+
Step 6 Access alerts, metrics, and metering for multiple instances
+
Step 7 Knowledge check
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 7
1. Get started with the REST Client extension for Visual Studio Code 2. Request a bearer token to enable access to the REST APIs 3. Retrieve triggered alerts 4. Access database metrics 5. Access database metering metrics 6. Access alerts, metrics, and metering for multiple instances 7. Knowledge check

Learn more →