Merge pull request #7736 from froehl/7735

API-Event StateChange & CheckResult: Added acknowledgement and downtime_depth…
This commit is contained in:
Alexander Aleksandrovič Klimov 2020-10-29 13:41:52 +01:00 committed by GitHub
commit 3fa1eab344
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 16 deletions

View File

@ -1585,25 +1585,29 @@ Example for all downtime events:
#### <a id="icinga2-api-event-streams-type-checkresult"></a> Event Stream Type: CheckResult
Name | Type | Description
--------------|---------------|--------------------------
type | String | Event type `CheckResult`.
timestamp | Timestamp | Unix timestamp when the event happened.
host | String | [Host](09-object-types.md#objecttype-host) name.
service | String | [Service](09-object-types.md#objecttype-service) name. Optional if this is a host check result.
check\_result | CheckResult | Serialized [CheckResult](08-advanced-topics.md#advanced-value-types-checkresult) value type.
Name | Type | Description
-----------------|---------------|--------------------------
type | String | Event type `CheckResult`.
timestamp | Timestamp | Unix timestamp when the event happened.
host | String | [Host](09-object-types.md#objecttype-host) name.
service | String | [Service](09-object-types.md#objecttype-service) name. Optional if this is a host check result.
check\_result | CheckResult | Serialized [CheckResult](08-advanced-topics.md#advanced-value-types-checkresult) value type.
downtime\_depth | Number | Amount of active downtimes on the checkable.
acknowledgement | Boolean | Whether the object is acknowledged.
#### <a id="icinga2-api-event-streams-type-statechange"></a> Event Stream Type: StateChange
Name | Type | Description
--------------|---------------|--------------------------
type | String | Event type `StateChange`.
timestamp | Timestamp | Unix timestamp when the event happened.
host | String | [Host](09-object-types.md#objecttype-host) name.
service | String | [Service](09-object-types.md#objecttype-service) name. Optional if this is a host state change.
state | Number | [Host](09-object-types.md#objecttype-host) or [service](09-object-types.md#objecttype-service) state.
state\_type | Number | [Host](09-object-types.md#objecttype-host) or [service](09-object-types.md#objecttype-service) state type.
check\_result | CheckResult | Serialized [CheckResult](08-advanced-topics.md#advanced-value-types-checkresult) value type.
Name | Type | Description
-----------------|---------------|--------------------------
type | String | Event type `StateChange`.
timestamp | Timestamp | Unix timestamp when the event happened.
host | String | [Host](09-object-types.md#objecttype-host) name.
service | String | [Service](09-object-types.md#objecttype-service) name. Optional if this is a host state change.
state | Number | [Host](09-object-types.md#objecttype-host) or [service](09-object-types.md#objecttype-service) state.
state\_type | Number | [Host](09-object-types.md#objecttype-host) or [service](09-object-types.md#objecttype-service) state type.
check\_result | CheckResult | Serialized [CheckResult](08-advanced-topics.md#advanced-value-types-checkresult) value type.
downtime\_depth | Number | Amount of active downtimes on the checkable.
acknowledgement | Boolean | Whether the object is acknowledged.
#### <a id="icinga2-api-event-streams-type-notification"></a> Event Stream Type: Notification

View File

@ -56,6 +56,9 @@ void ApiEvents::CheckResultHandler(const Checkable::Ptr& checkable, const CheckR
result->Set("check_result", Serialize(cr));
result->Set("downtime_depth", checkable->GetDowntimeDepth());
result->Set("acknowledgement", checkable->IsAcknowledged());
for (const EventQueue::Ptr& queue : queues) {
queue->ProcessEvent(result);
}
@ -89,6 +92,9 @@ void ApiEvents::StateChangeHandler(const Checkable::Ptr& checkable, const CheckR
result->Set("state_type", checkable->GetStateType());
result->Set("check_result", Serialize(cr));
result->Set("downtime_depth", checkable->GetDowntimeDepth());
result->Set("acknowledgement", checkable->IsAcknowledged());
for (const EventQueue::Ptr& queue : queues) {
queue->ProcessEvent(result);
}