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

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

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": " 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:id1>"
        },
        {
            "name": "Automation_Boston_All",
            "health": 89.97,
            "nameLowerCase": "automation_boston_all",
            "id": "SSA:id2>"
        },
        {
            "name": "Automation_CAPM",
            "health": 99.96,
            "nameLowerCase": "automation_capm",
            "id": "<SA:id3>"
        },
        {
            "name": "Service11",
            "health": 99.96,
            "nameLowerCase": "service11",
            "id": "<SA:id4>"
        },
        {
            "name": "Service4",
            "health": 99.96,
            "nameLowerCase": "service4",
            "id": "<SA:id5>"
        }
    ],
    "groupedCnt": 0,
    "filteredCnt": 20,
    "totalCnt": 20,
    "isAvailabilityConfigured": false
}