Rest API query for fetching Clear Alarms details
search cancel

Rest API query for fetching Clear Alarms details

book

Article ID: 243081

calendar_today

Updated On:

Products

DX Unified Infrastructure Management (Nimsoft / UIM)

Issue/Introduction

We want to fetch the details of all the Alarms closed/cleared automatically when the threshold condition is back to normal and closed by UIM. UIMAPI is enabled in OC, and when we run Rest API query on Alarms. We are receiving all the Alarms details like Critical, Major, minor etc.

However we are not receiving any Clear Alarm details. How to retrieve clear Alarms using UIMAPI?

Environment

Release : 20.4

Component : UIM - API

Resolution

Technically it is not possible to pull just a list of "clear" severity alarms, but it is possible to pull a list of all alarms and include closed alarms in that list (along with open alarms).  

The UIMAPI "alarms" call can accept a list of filter criteria which can be used to retrieve a filtered list of alarms.

The parameter "includeClosed" can be set to "true" to retrieve a list of alarms that also includes closed alarms.

This API call is used with a POST request and the body of the request will contain the filter criteria.

Valid criteria are as follows:

{
  "assigned_to": "string",
  "custom1": "string",
  "custom2": "string",
  "custom3": "string",
  "custom4": "string",
  "custom5": "string",
  "deviceIds": "string",
  "domain": "string",
  "hostname": "string",
  "hub": "string",
  "id": "string",
  "includeClosed": "string",
  "level": "string",
  "message": "string",
  "message_count": "string",
  "origin": "string",
  "probe": "string",
  "robot": "string",
  "source": "string",
  "subsystem": "string",
  "subsystem_id": "string",
  "timeArrival": "2024-03-06T19:53:40.829Z",
  "timeLast": "2024-03-06T19:53:40.829Z",
  "userTag1": "string",
  "userTag2": "string",
  "visible": true
}

Example

If you want to pull all the open and closed alarms for the server called "MyServer" you would send a POST request to the /uimapi/alarms/ endpoint with the body as follows:

 

{
 "hostname":  "MyServer",
 "includeClosed": true
}

 

 

Additional Information

UIMAPI Documentation

 

You can also obtain this via query which will allow you to obtain just the clear alarms only:

 

All:
select * from NAS_TRANSACTION_LOG where severity = 'clear'

All within the last day:
select * from NAS_TRANSACTION_LOG where severity = 'clear' and time > (select dateadd(day, -1, getdate()))

All within the last week:
select * from NAS_TRANSACTION_LOG where severity = 'clear' and time > (select dateadd(week, -1, getdate()))