ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

DX OI APIs, How do I get ‘Worst 5 by Health’ & ‘Worst 5 by Risk’

book

Article ID: 236912

calendar_today

Updated On:

Products

DX Operational Intelligence

Issue/Introduction

How to get ‘Worst 5 by Health’ & ‘Worst 5 by Risk’? Please provide the details to get this information.

Environment

Release : 21.3

Component : Dashboards

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": " PVHTest",

      "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, see in the admin UI as below. Can add filters as per requiremnet.

Mark the sortOrder in the payload to correctly give the worst 5 in terms of health and risk. Other 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": "Automation_Boston_Wireless",
            "health": 70.0,
            "nameLowerCase": "automation_boston_wireless",
            "id": "SA:06940389-2DD4-4EA4-8163-76AB0E608DBA:5d5b6cab-b163-47ed-b71a-8ebdaf8727b2"
        },
        {
            "name": "Automation_Boston_All",
            "health": 89.97,
            "nameLowerCase": "automation_boston_all",
            "id": "SA:06940389-2DD4-4EA4-8163-76AB0E608DBA:0aded4b1-364a-4843-b90b-d68e333976aa"
        },
        {
            "name": "Automation_CAPM",
            "health": 99.96,
            "nameLowerCase": "automation_capm",
            "id": "SA:06940389-2DD4-4EA4-8163-76AB0E608DBA:39b29db2-a782-40e6-a456-25ce3a002d3c"
        },
        {
            "name": "Service11",
            "health": 99.96,
            "nameLowerCase": "service11",
            "id": "SA:06940389-2DD4-4EA4-8163-76AB0E608DBA:22868087-fa36-4522-979e-48d4c362764c"
        },
        {
            "name": "Service4",
            "health": 99.96,
            "nameLowerCase": "service4",
            "id": "SA:06940389-2DD4-4EA4-8163-76AB0E608DBA:78be2417-9675-4b35-a932-07fd9ed1a1d3"
        }
    ],
    "groupedCnt": 0,
    "filteredCnt": 20,
    "totalCnt": 20,
    "isAvailabilityConfigured": false
}