DX OI APIs: Get ‘Worst 5 by Health’ & ‘Worst 5 by Risk’
search cancel

DX OI APIs: Get ‘Worst 5 by Health’ & ‘Worst 5 by Risk’

book

Article ID: 236912

calendar_today

Updated On:

Products

DX Operational Intelligence

Issue/Introduction

How do you get ‘Worst 5 by Health’ & ‘Worst 5 by Risk’? Can you provide the details to get this information?

Environment

DX Dashboards 2.x

Resolution

Use the below API which gives the both health, risk, and other service KPI depend upon the projectionFilter.

Attribute Name

Description

time

An optional attribute with current Epoch time

filters

It can use if the specific filter like on service like name, risk and health etc, empty filter means for all.

Example:

"filters": [

    {

      "fieldDescription": "Name",

      "field": "name",

      "value": " ExampleTest",

      "condition": "equals",

      "isCustom": false

    }

  ]

sortField

Service attribute name for sort

sortOrder

asc/desc

groupServices

False/true, if true, it will return only parent services

pageNum

Page number to get the result

pageSize

Size of service on per page

projectionFilter

ProjectionFIlter to control the response of the service. Below are the attribute we can pass.

·         "rollupFilteredAlarmCount",

·         "situationCount",

·         "availability",

·         "filteredParent",

·         "availability_lastday",

·         "immediateFilteredChildren",

·         "immediateFilterChildrenCount",

·         "health",

·         "extId",

·         "location",

·         "maintenance",

·         "name",

·         "risk",

·         "status",

·         "tags",

·         "isAvailabilityConfigured"

showAlarms

It will show the alarm count on the service

Request :
curl --request POST \
  --url <oi-adminui endpoint>/oi/v2/servicerepo/services \
  --header 'Authorization: Bearer <authorization token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "time": 1639647628189,
  "filters": [],
  "sortField": "health",
  "sortOrder": "asc",  // asc/desc
  "groupServices": false,
  "pageNum": 1,
  "pageSize": 25,
  "projectionFilter": [
    "availability",
    "health",
    "name",
    "risk"
  ],

  "showAlarms": false
}

Response:

{
"services": [
{
"name": "UIM",
"risk": 0.0,
"health": 100.0,
"nameLowerCase": "uim"
},
{
"name": "Third Level Top 1",
"risk": 0.0,
"health": 100.0,
"nameLowerCase": "third level top 1"
},
{
"name": "Banking Servic",
"risk": 0.0,
"health": 100.0,
"nameLowerCase": "banking servic"
},
{
"name": "P1",
"risk": 0.0,
"health": 100.0,
"nameLowerCase": "p1"
},
{
"name": "EMEA_Retail",
"risk": 0.0,
"health": 100.0,
"nameLowerCase": "emea_retail"
}
],
"groupedCnt": 0,
"filteredCnt": 9,
"totalCnt": 9,
"isAvailabilityConfigured": false
}

 

The exact API parameters for top 5 risk and top 5 health, are seen in the admin UI as below. You can add filters as per requirements.

  • Mark the sortOrder in the payload to correctly give the worst 5 in terms of health and risk.
  • Oher parameters in the payload, if given the way mentioned, will give the optimal results.

"time" is the epoch millis for the current time for query.

 

Endpoint: POST <adminUI>/oi/v2/servicerepo/group

Header: Authorization: Bearer <user token fromUI>

Input payload (for "risk"):

 

for Risk

for Health

{
    "time": 1645803516197,
    "filters": [],
    "sortField": "risk",
    "sortOrder": "desc",
    "groupServices": false,
    "pageNum": 1,
    "pageSize": 5,

    "projectionFilter": [
         "risk",
        "extId",
        "name"
       
    ],
    "showAlarms": false
}

{
    "time": 1645803516197,
    "filters": [],
    "sortField": "health",
    "sortOrder": "asc",
    "groupServices": false,
    "pageNum": 1,
    "pageSize": 5,

    "projectionFilter": [
        "health",
        "extId",
        "name"
       
    ],
    "showAlarms": false
}

Response having "health". Similarly you'll get "risk" for the "risk" payload.

{
    "services": [
        {
            "name": "Example_Company",
            "health": 70.0,
            "nameLowerCase": "example_company",
            "id": "<SA:id1>"
        },
        {
            "name": "Example_All",
            "health": 89.97,
            "nameLowerCase": "example_all",
            "id": "SSA:id2>"
        },
        {
            "name": "example",
            "health": 99.96,
            "nameLowerCase": "example",
            "id": "<SA:id3>"
        },
        {
            "name": "example11",
            "health": 99.96,
            "nameLowerCase": "example11",
            "id": "<SA:id4>"
        },
        {
            "name": "example4",
            "health": 99.96,
            "nameLowerCase": "example4",
            "id": "<SA:id5>"
        }
    ],
    "groupedCnt": 0,
    "filteredCnt": 20,
    "totalCnt": 20,
    "isAvailabilityConfigured": false
}