Skip to main content

Alarms

2.3.1 Query real-time alarms by conditions​

API endpoint

GET /NSphere/api/alarm-resource/real-time-alarms

API description

Query real-time alarms by conditions. New API added in E0930.

Request Content-Type

application/x-www-form-urlencoded

Response Content-Type

application/json

Request parameters

Parameter name

Description

Location

Required

Type

schema

offset

Offset. Specifies the record from which to start returning results.

query

false

integer(int32)

limit

Maximum number of records to return per page.

query

false

integer(int32)

sortDir

Sort type: 0 = no sort, 1 = ascending, 2 = descending. Defaults to no sort when sortField is not empty.

query

false

integer(int32)

sortField

Sort field. Supported fields: state (acknowledgment state), eventLevel (level), category (category), eventSrc (alarm source), eventDesc (alarm message), eventTime (latest alarm time), firstEventTime (first alarm time), eventCount (repeat count).

query

false

string

state

Acknowledgment state: 1 acknowledged, 2 unacknowledged.

query

false

integer(int32)

eventLevel

Alarm level: 1 critical, 2 major, 3 minor, 4 info.

query

false

array

integer

category

Category: 1 host resource alarm, 2 VM resource alarm, 3 cluster resource alarm, 4 fault alarm, 6 other exception alarm, 7 security alarm, 10 network subhealth alarm, 20 distributed storage resource alarm, 80 container engine alarm, 90 Qi-Anxin alarm.

query

false

integer(int32)

targetType

Alarm source object type. Currently supported types: 1 cluster, 2 host, 3 VM, 7 host storage, 9 cluster shared storage. targetType must be used together with targetId or targetName. When targetType=7, both targetId and targetName must be specified: targetId is the host ID and targetName is the storage pool name. When targetType=9, targetId has no effect and targetName must be specified.

query

false

integer(int32)

targetId

Alarm source object ID. Takes effect when targetType is not empty.

query

false

integer(int64)

targetOnly

Whether to skip querying child objects of the alarm source: true = do not query child objects, false = query child objects. Defaults to false. Takes effect when targetType is not empty.

query

false

boolean

targetName

Alarm source object name. Currently only meaningful when targetType is 7 or 9, representing the storage pool name (not the display name).

query

false

string

Response status

Response code

Description

schema

200

OK

ApiResponseApiPagingListResultApiRealTimeAlarmVO

Response parameters

Parameter name

Description

Type

schema

state

Status code. 0: success, 1: failure, 2: partial success.

integer(int32)

integer(int32)

errorCode

Error code. A non-zero value indicates a business error.

integer(int32)

integer(int32)

successMessage

Success message.

string

failureMessage

Error message. Valid when the result is failure or partial success.

string

data

Response data. When the status code is 0 this contains the normal returned data; when non-zero and non-empty it contains the data required to describe the exception.

ApiPagingListResultApiRealTimeAlarmVO

ApiPagingListResultApiRealTimeAlarmVO

data

Alarm records.

array

ApiRealTimeAlarmVO

id

Alarm ID.

integer(int64)

catalogId

Alarm category ID.

integer(int64)

category

Alarm category.

integer(int32)

state

Acknowledgment state: 1 acknowledged, 2 unacknowledged.

integer(int32)

eventLevel

Alarm level: 1 critical, 2 major, 3 minor, 4 info.

integer(int32)

eventType

Alarm type. Below 10: unstructured; 20: host; 30: VM; 40: cluster; 50: other; 60: security; 70: onestor; 80: cloud container engine; 90: Qi-Anxin.

integer(int32)

eventName

Alarm name.

string

eventSrc

Alarm source.

string

eventTime

Latest alarm time. Millisecond timestamp, e.g. 1776755870801.

string(date-time)

firstEventTime

First alarm time. Millisecond timestamp, e.g. 1776755870801.

string(date-time)

eventDesc

Alarm message.

string

targetId

Alarm source object ID (VM ID, host ID, etc.). Meaning depends on the alarm type.

integer(int64)

uuid

UUID added for VM-type alarms.

string

childTarget

Child object of a specific alarm.

string

eventCount

Repeat count.

integer(int32)

confirmTime

Alarm acknowledgment time. Timestamp in seconds.

integer(int64)

objectNameMd

Alarm object name. Records the MD5 of the object name for alarms produced by kaas.

string

onestorAlarmKey

Unique identifier for each new-version onestor alarm. Null for NSphere alarms.

string

cdpAlarmId

CDP alarm ID.

string

offset

Offset. Specifies the record from which to start returning results.

integer(int32)

size

Number of records returned in this response.

integer(int32)

total

Total number of records.

integer(int64)

Response example

{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": {
"data": [
{
"id": null,
"catalogId": null,
"category": null,
"state": null,
"eventLevel": null,
"eventType": null,
"eventName": null,
"eventSrc": null,
"eventTime": null,
"firstEventTime": null,
"eventDesc": null,
"targetId": null,
"uuid": null,
"childTarget": null,
"eventCount": null,
"confirmTime": null,
"objectNameMd": null,
"onestorAlarmKey": null,
"cdpAlarmId": null
}
],
"offset": null,
"size": null,
"total": null
}
}