Get Event Data

GET/zstack/v1/zwatch/events

Headers

Authorization: OAuth the-session-uuid

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/zwatch/events?startTime=1.596444516295E12&limit=10.0&conditions=HostUuid=99ca12b945a8489c93a3412cbc744193&count=false&start=0.0

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
startTime (Optional)LongqueryThe start time. 2.3
endTime (Optional)LongqueryThe end time. 2.3
limit (Optional)IntegerqueryThe maximum number of returned results. 2.3
offsetAheadOfCurrentTime (Optional)LongqueryThe number of milliseconds before the current time. For example, to query messages from the last hour, pass in 3600000. 3.3.0
conditions (Optional)ListqueryThe query conditions. 3.3.0
count (Optional)booleanqueryWhether to query the event count. 3.3.0
endpointUuid (Optional)StringqueryThe endpoint UUID. 3.10.0
systemTags (Optional)ListquerySystem tags. 2.3
userTags (Optional)ListqueryUser tags. 2.3

API Response

Response Example

{
  "events": [
    {
      "namespace": "ZStack/VM",
      "name": "org.zstack.zwatch.datatype.EventFamily@2c24d960",
      "labels": {},
      "emergencyLevel": "Normal",
      "resourceId": "b7bbe5fb9ab049c5a36bf8a646471cff",
      "resourceName": "VmInstanceVO",
      "time": 1596444516324.0
    }
  ]
}
NameTypeDescriptionStarting Version
totalLongThe number of events.3.3.0
successboolean 3.3.0
errorErrorCodeThe error code. If not null, the operation failed. This field is null when the operation succeeds. See error for details.2.3
eventsListSee events for details.2.3

error

NameTypeDescriptionStarting Version
codeStringThe error code number. A globally unique identifier for the error, e.g., SYS.1000, HOST.1001.2.3
descriptionStringA brief description of the error.2.3
detailsStringThe detailed error information.2.3
elaborationStringA reserved field. Default is null.2.3
opaqueLinkedHashMapA reserved field. Default is null.2.3
causeErrorCodeThe root error. The source error that caused the current error. This field is null if there is no root cause.2.3

events

NameTypeDescriptionStarting Version
namespaceStringThe namespace.2.3
nameStringThe event name.2.3
labelsMapThe labels.2.3
resourceIdStringThe ID of the resource that generated the event. If it is a ZSvirt resource, this is the resource UUID.2.3
resourceNameStringThe resource name.2.3
errorStringIf the event represents an error, this field contains the error details.2.3
timelongThe time when the event occurred.2.3
dataUuidStringThe message UUID.3.3
accountUuidStringThe account UUID.3.3
emergencyLevelEmergencyLevelSee emergencyLevel for details.2.3

emergencyLevel

NameTypeDescriptionStarting Version
nameStringThe resource name.2.3
ordinalint 2.3

SDK Examples

Java SDK

GetEventDataAction action = new GetEventDataAction();
action.startTime = 1.596444516404E12;
action.limit = 10.0;
action.conditions = asList("HostUuid=00d80d7c47124d6d8e2c7736e9af1c34");
action.count = false;
action.start = 0.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetEventDataAction.Result res = action.call();

Python SDK

GetEventDataAction action = GetEventDataAction()
action.startTime = 1.596444516405E12
action.limit = 10.0
action.conditions = [HostUuid=7581302347d0439fbdde32b914e2449a]
action.count = false
action.start = 0.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetEventDataAction.Result res = action.call()