diff --git a/doc/12-icinga2-api.md b/doc/12-icinga2-api.md index de12880ba..61697ee54 100644 --- a/doc/12-icinga2-api.md +++ b/doc/12-icinga2-api.md @@ -1585,25 +1585,29 @@ Example for all downtime events: #### 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. #### 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. #### Event Stream Type: Notification diff --git a/lib/icinga/apievents.cpp b/lib/icinga/apievents.cpp index 375ffe2fd..203c2b5b5 100644 --- a/lib/icinga/apievents.cpp +++ b/lib/icinga/apievents.cpp @@ -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); }