@@ -230,6 +230,11 @@ func (l *Listener) manageIcingaService(ctx context.Context, payload WebhookPaylo
230230 // Get the Plugin Output from the first Annotation we find that has some data
231231 pluginOutput := l .generatePluginOutput (alert , exitCode )
232232
233+ // heartbeat alerts will use exit code OK since they always fire and the active check will set it to not OK
234+ if _ , ok := alert .Labels ["heartbeat" ]; ok {
235+ exitCode = 0
236+ }
237+
233238 action := icinga2.Action {
234239 ExitStatus : exitCode ,
235240 PluginOutput : pluginOutput ,
@@ -247,8 +252,9 @@ func (l *Listener) manageIcingaService(ctx context.Context, payload WebhookPaylo
247252 return nil
248253}
249254
255+ // updateOrCreateService either updates an existing service or creates a new service
250256func (l * Listener ) updateOrCreateService (ctx context.Context , serviceName , displayName string , exitCode int , alert Alert ) (icinga2.Service , error ) {
251- heartbeatInterval := time .Duration (0 )
257+ heartbeatInterval := time .Duration (- 1 )
252258
253259 if val , ok := alert .Labels ["heartbeat" ]; ok {
254260 if alert .Status == alertStatusResolved {
@@ -355,7 +361,7 @@ func (l *Listener) prepareService(serviceName string, displayName string, alert
355361 }
356362
357363 // Check if this is a heartbeat service and adjust serviceData accordingly
358- if heartbeatInterval .Seconds () > 0.0 {
364+ if heartbeatInterval .Seconds () > 0 {
359365 // Set dummy text to message annotation on alert
360366 svc .Vars ["dummy_text" ] = alert .Annotations ["message" ]
361367 // Set exitStatus for missed heartbeat to Alert's severity
0 commit comments