@@ -141,7 +141,7 @@ func sendNotification(_ *cobra.Command, _ []string) {
141
141
switch notificationType {
142
142
case icingadsl .Custom :
143
143
// If ticket exists, adds article to existing ticket
144
- notificationErr = handleCustomNotification (ctx , c , ticket )
144
+ notificationErr = handleCustomNotification (ctx , c , ticket , "Custom" )
145
145
case icingadsl .Acknowledgement :
146
146
// If ticket exists, adds article to existing ticket
147
147
notificationErr = handleAcknowledgeNotification (ctx , c , ticket )
@@ -155,15 +155,20 @@ func sendNotification(_ *cobra.Command, _ []string) {
155
155
// If ticket is closed, reopens the ticket with the article
156
156
notificationErr = handleRecoveryNotification (ctx , c , ticket )
157
157
case icingadsl .DowntimeStart :
158
- // Currently no implemented
158
+ // If ticket exists, adds article to existing ticket
159
+ notificationErr = handleCustomNotification (ctx , c , ticket , "DowntimeStart" )
159
160
case icingadsl .DowntimeEnd :
160
- // Currently no implemented
161
+ // If ticket exists, adds article to existing ticket
162
+ notificationErr = handleCustomNotification (ctx , c , ticket , "DowntimeEnd" )
161
163
case icingadsl .DowntimeRemoved :
162
- // Currently no implemented
164
+ // If ticket exists, adds article to existing ticket
165
+ notificationErr = handleCustomNotification (ctx , c , ticket , "DowntimeRemoved" )
163
166
case icingadsl .FlappingStart :
164
- // Currently no implemented
167
+ // If ticket exists, adds article to existing ticket
168
+ notificationErr = handleCustomNotification (ctx , c , ticket , "FlappingStart" )
165
169
case icingadsl .FlappingEnd :
166
- // Currently no implemented
170
+ // If ticket exists, adds article to existing ticket
171
+ notificationErr = handleCustomNotification (ctx , c , ticket , "FlappingEnd" )
167
172
default :
168
173
check .ExitError (fmt .Errorf ("unsupported notification type. Currently supported: Problem/Recovery/Acknowledgement" ))
169
174
}
@@ -284,15 +289,15 @@ func handleRecoveryNotification(ctx context.Context, c *client.Client, ticket za
284
289
285
290
// handleCustomNotification adds an article to an existing ticket
286
291
// If no ticket exists nothing happens and the function returns
287
- func handleCustomNotification (ctx context.Context , c * client.Client , ticket zammad.Ticket ) error {
292
+ func handleCustomNotification (ctx context.Context , c * client.Client , ticket zammad.Ticket , notificationType string ) error {
288
293
if ticket .ID == 0 {
289
294
return nil
290
295
}
291
296
292
297
a := zammad.Article {
293
298
TicketID : ticket .ID ,
294
- Subject : "Custom" ,
295
- Body : fmt .Sprintf ("Custom for: %s %s" , cliConfig .IcingaCheckState , cliConfig .IcingaCheckOutput ),
299
+ Subject : notificationType ,
300
+ Body : fmt .Sprintf ("%s for: %s %s" , notificationType , cliConfig .IcingaCheckState , cliConfig .IcingaCheckOutput ),
296
301
ContentType : "text/html" ,
297
302
Type : "web" ,
298
303
Internal : true ,
0 commit comments