@@ -85,13 +85,16 @@ type CheckResult struct {
85
85
//
86
86
// NOTE:
87
87
// - An empty Service field indicates a host downtime.
88
+ // - If a downtime was added by a ScheduledDowntime object, ConfigOwner is set to the name of that object and can
89
+ // only be cancelled by its owner. Otherwise, it is empty and indicates user-created downtimes (via API or/and UI).
88
90
//
89
91
// https://icinga.com/docs/icinga-2/latest/doc/09-object-types/#objecttype-downtime
90
92
type Downtime struct {
91
- Host string `json:"host_name"`
92
- Service string `json:"service_name"`
93
- Author string `json:"author"`
94
- Comment string `json:"comment"`
93
+ Host string `json:"host_name"`
94
+ Service string `json:"service_name"`
95
+ Author string `json:"author"`
96
+ Comment string `json:"comment"`
97
+ ConfigOwner string `json:"config_owner"`
95
98
96
99
// RemoveTime is used to indicate whether a downtime was ended automatically or cancelled prematurely by a user.
97
100
// It is set to zero time for the former case, otherwise to the timestamp at which time has been cancelled.
@@ -133,6 +136,7 @@ type HostServiceRuntimeAttributes struct {
133
136
LastStateChange UnixFloat `json:"last_state_change"`
134
137
DowntimeDepth int `json:"downtime_depth"`
135
138
Acknowledgement int `json:"acknowledgement"`
139
+ IsFlapping bool `json:"flapping"`
136
140
AcknowledgementLastChange UnixFloat `json:"acknowledgement_last_change"`
137
141
}
138
142
@@ -179,40 +183,29 @@ type StateChange struct {
179
183
CheckResult CheckResult `json:"check_result"`
180
184
DowntimeDepth int `json:"downtime_depth"`
181
185
Acknowledgement bool `json:"acknowledgement"`
186
+ IsFlapping bool `json:"-"`
182
187
}
183
188
184
- // AcknowledgementSet represents the Icinga 2 API Event Stream AcknowledgementSet response for acknowledgements set on hosts/services.
189
+ // Acknowledgement represents the Icinga 2 API Event Stream AcknowledgementSet or AcknowledgementCleared
190
+ // response for acknowledgements set/cleared on/from hosts/services.
185
191
//
186
192
// NOTE:
187
193
// - An empty Service field indicates a host acknowledgement.
188
194
// - State might be StateHost{Up,Down} for hosts or StateService{Ok,Warning,Critical,Unknown} for services.
189
195
// - StateType might be StateTypeSoft or StateTypeHard.
196
+ // - EventType is either set to typeAcknowledgementSet or typeAcknowledgementCleared
190
197
//
191
198
// https://icinga.com/docs/icinga-2/latest/doc/12-icinga2-api/#event-stream-type-acknowledgementset
192
- type AcknowledgementSet struct {
199
+ // https://icinga.com/docs/icinga-2/latest/doc/12-icinga2-api/#event-stream-type-acknowledgementcleared
200
+ type Acknowledgement struct {
193
201
Timestamp UnixFloat `json:"timestamp"`
194
202
Host string `json:"host"`
195
203
Service string `json:"service"`
196
204
State int `json:"state"`
197
205
StateType int `json:"state_type"`
198
206
Author string `json:"author"`
199
207
Comment string `json:"comment"`
200
- }
201
-
202
- // AcknowledgementCleared represents the Icinga 2 API Event Stream AcknowledgementCleared response for acknowledgements cleared on hosts/services.
203
- //
204
- // NOTE:
205
- // - An empty Service field indicates a host acknowledgement.
206
- // - State might be StateHost{Up,Down} for hosts or StateService{Ok,Warning,Critical,Unknown} for services.
207
- // - StateType might be StateTypeSoft or StateTypeHard.
208
- //
209
- // https://icinga.com/docs/icinga-2/latest/doc/12-icinga2-api/#event-stream-type-acknowledgementcleared
210
- type AcknowledgementCleared struct {
211
- Timestamp UnixFloat `json:"timestamp"`
212
- Host string `json:"host"`
213
- Service string `json:"service"`
214
- State int `json:"state"`
215
- StateType int `json:"state_type"`
208
+ EventType string `json:"type"`
216
209
}
217
210
218
211
// CommentAdded represents the Icinga 2 API Event Stream CommentAdded response for added host/service comments.
@@ -267,13 +260,21 @@ type DowntimeTriggered struct {
267
260
//
268
261
// NOTE:
269
262
// - An empty Service field indicates a host being in flapping state.
263
+ // - State includes the current state of the Checkable at the point in time at which it enters or exits the flapping state.
264
+ // - CurrentFlapping indicates the current flapping value of a Checkable in percent.
265
+ // - ThresholdLow is the low/min flapping threshold value set by the user (CurrentFlapping < ThresholdLow = flapping end).
266
+ // - ThresholdHigh is the high/max flapping threshold value set by the user (CurrentFlapping > ThresholdHigh = flapping start).
270
267
//
271
268
// https://icinga.com/docs/icinga-2/latest/doc/12-icinga2-api/#event-stream-type-flapping
272
269
type Flapping struct {
273
- Timestamp UnixFloat `json:"timestamp"`
274
- Host string `json:"host"`
275
- Service string `json:"service"`
276
- IsFlapping bool `json:"is_flapping"`
270
+ Timestamp UnixFloat `json:"timestamp"`
271
+ Host string `json:"host"`
272
+ Service string `json:"service"`
273
+ IsFlapping bool `json:"is_flapping"`
274
+ State int `json:"state"`
275
+ CurrentFlapping int `json:"current_flapping"`
276
+ ThresholdLow int `json:"threshold_low"`
277
+ ThresholdHigh int `json:"threshold_high"`
277
278
}
278
279
279
280
// CheckableCreatedDeleted represents the Icinga 2 API stream Checkable created/deleted response.
@@ -328,10 +329,8 @@ func UnmarshalEventStreamResponse(bytes []byte) (any, error) {
328
329
switch responseType {
329
330
case typeStateChange :
330
331
resp = new (StateChange )
331
- case typeAcknowledgementSet :
332
- resp = new (AcknowledgementSet )
333
- case typeAcknowledgementCleared :
334
- resp = new (AcknowledgementCleared )
332
+ case typeAcknowledgementSet , typeAcknowledgementCleared :
333
+ resp = new (Acknowledgement )
335
334
case typeCommentAdded :
336
335
resp = new (CommentAdded )
337
336
case typeCommentRemoved :
0 commit comments