DX OI - Using REST API to query/export OI data - an example

book

Article ID: 206461

calendar_today

Updated On:

Products

DX Operational Intelligence

Issue/Introduction

How can I export metrics or alarms from DX OI? 

Environment

DIGITAL OPERATIONAL INTELLIGENCE - 1.3.2, 20.2

Resolution

 

Prerequisite

Download POSTMAN from https://www.postman.com/

 

 

Step 1: Generate a token

 

a) Request a token : ess/security/v1/token

 

POST

EndPoint = http://adminui.lvntest010772.abc.com/ess/security/v1/token

 

Click “Params” tab:

Add grant_type= Password (this is static value as per documentation)

Add an existing username and password = your tenant admin credentials

 

 

Click “Headers” tab

Add Authorization =  Basic + <space> + <the encoded value of your tenant name>

 

in this example my tenant name = doi132

 

You can encode a text using https://www.base64encode.org/

 

Click “Send” in Postman to generate the authorization token

{

    "userCohort": "DOI132-USERSTORE",

    "tkn": "6ccef6dd-f26f-40c9-94b4-5f35a3f8bf8f",

    "tt": "Bearer",

    "v": 1800,

    "rtkn": "d376f544-cf5b-4fe1-8a90-1aae89ea2356",

    "lc": "en_US",

    "rt": 0,

    "userRefID": 21

}

 

b) Generate Authorization token for queries

 

Syntax:

{"tkn":"<token you generated in previou step>","<tenant_scope_argument>":"<value>"}

 

Tenant_scope_argument, can be “t”, “all” and “global”

For more information, see https://techdocs.broadcom.com/us/en/ca-enterprise-software/it-operations-management/digital-operational-intelligence/20-2/reference/authentication-and-authorization-of-apis.html#concept.dita_751d69ef83b42918d5634ffc5b35ca57bb2c826b_PasstheAuthorizationDetails

 

In this example, I use the “all”tenants scope, here is the resulting scring:

 

{"tkn":"6ccef6dd-f26f-40c9-94b4-5f35a3f8bf8f","all":"true"}

 

Next steps is to encode this value to generate a token to use for our queries

https://www.base64encode.org/

You you can start query for data, just make sure to add the above token as “Bearer Token”

 

Step 2: Understand possible values you can use to retrieve information

 

As per documentation, the query syntax is

 

https://<ao_analytics_hostname>/mdo/v2/aoanalytics/<data type category>/<data type name>/_search?

 

Notes:

 

data type category Valid values = logs, metrics, events, alarms, and inventory

 

 

To list all available data types  for a data type category you use below syntax:

 

GET

Endpoint: <DOI>/mdo/v2/aoanalytics/<data type category>/datatypes/

 

a) To list all available data types for alarms:

http://adminui.lvntest010772.abc.com/mdo/v2/aoanalytics/alarms/datatypes/

 

NOTE: Authorization tab includes our Bearer token.

 

 

b) To list all available data types for metrics:

 

In this example:

http://adminui.lvntest010772.abc.com/mdo/v2/aoanalytics/metrics/datatypes/

 

Result:

 

TEST#1: List all UIM alarms from Jan 2021

 

GET

http://adminui.<endpoint>/mdo/v2/aoanalytics/alarms/alarms_uim/_search?timefrom=2021-01-01T07:16:23Z

 

Example:

http://adminui.lvntest010772.abc.com/mdo/v2/aoanalytics/alarms/alarms_uim/_search?timefrom=2021-01-01T07:16:23Z

 

TEST#2: List only cpu UIM alarms from Jan 2021

 

GET

http://adminui.<endpoint>/mdo/v2/aoanalytics/alarms/alarms_uim/_search?timefrom=2021-01-01T07:16:23Z&q=disk

 

 

Example:

http://adminui.lvntest010772.abc.com/mdo/v2/aoanalytics/alarms/alarms_uim/_search?timefrom=2021-01-01T07:16:23Z&q=disk

 

 

TEST#3: List all metrics from today only

 

List  the metrics for today only

 

GET

http://adminui.<endpoint>/mdo/v2/aoanalytics/metrics/metrics_uim/_search?timefrom=2021-01-07T07:16:23Z

 

Example:

http://adminui.lvntest010772.abc.com/mdo/v2/aoanalytics/metrics/metrics_uim/_search?timefrom=2021-01-07T07:16:23Z

 

Additional Information

 

DX OI - Troubleshooting, Common Issues and Best Practices
https://knowledge.broadcom.com/external/article/190815/dx-oi-troubleshooting-common-issues-and.html

Attachments