From 7fb9e63f89b436970df13b87213446d3526ff1b7 Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Thu, 1 Oct 2015 15:59:35 +0200 Subject: [PATCH] Remove temporary Slack integration --- notify/impl.go | 99 -------------------------------------------------- 1 file changed, 99 deletions(-) diff --git a/notify/impl.go b/notify/impl.go index 6f323e48..2ad69d48 100644 --- a/notify/impl.go +++ b/notify/impl.go @@ -80,102 +80,3 @@ func (w *Webhook) Notify(ctx context.Context, alerts ...*types.Alert) error { return nil } - -// type SlackMessage struct { -// Channel string `json:"channel,omitempty"` -// Attachments []SlackAttachment `json:"attachments"` -// } - -// type SlackAttachment struct { -// Title string `json:"title,omitempty"` -// TitleLink string `json:"title_link,omitempty"` -// Pretext string `json:"pretext,omitempty"` -// Text string `json:"text"` -// Fallback string `json:"fallback"` -// Color string `json:"color,omitempty"` -// MarkdownIn []string `json:"mrkdwn_in,omitempty"` -// Fields []SlackAttachmentField `json:"fields,omitempty"` -// } - -// type SlackAttachmentField struct { -// Title string `json:"title"` -// Value string `json:"value"` -// Short bool `json:"short,omitempty"` -// } - -// type Slack struct{} - -// func (s *Slack) Notify(ctx context.Context, alerts ...*types.Alert) error { -// group, ok := ctx.Value(NotifyGroup).(string) -// if !ok { -// return fmt.Errorf("group identifier missing") -// } -// // https://api.slack.com/incoming-webhooks -// var ( -// incidentKey = a.Fingerprint() -// color = "" -// status = "" -// ) -// switch op { -// case notificationOpTrigger: -// color = config.GetColor() -// status = "firing" -// case notificationOpResolve: -// color = config.GetColorResolved() -// status = "resolved" -// } - -// statusField := &slackAttachmentField{ -// Title: "Status", -// Value: status, -// Short: true, -// } - -// attachment := &slackAttachment{ -// Fallback: fmt.Sprintf("*%s %s*: %s (<%s|view>)", html.EscapeString(a.Labels["alertname"]), status, html.EscapeString(a.Summary), a.Payload["generatorURL"]), -// Pretext: fmt.Sprintf("*%s*", html.EscapeString(a.Labels["alertname"])), -// Title: html.EscapeString(a.Summary), -// TitleLink: a.Payload["generatorURL"], -// Text: html.EscapeString(a.Description), -// Color: color, -// MrkdwnIn: []string{"fallback", "pretext"}, -// Fields: []slackAttachmentField{ -// *statusField, -// }, -// } - -// req := &slackReq{ -// Channel: config.GetChannel(), -// Attachments: []slackAttachment{ -// *attachment, -// }, -// } - -// buf, err := json.Marshal(req) -// if err != nil { -// return err -// } - -// timeout := time.Duration(*slackConnectTimeout) * time.Second -// client := http.Client{ -// Timeout: timeout, -// } -// resp, err := client.Post( -// config.GetWebhookUrl(), -// contentTypeJSON, -// bytes.NewBuffer(buf), -// ) -// if err != nil { -// return err -// } -// defer resp.Body.Close() - -// respBuf, err := ioutil.ReadAll(resp.Body) -// if err != nil { -// return err -// } - -// log.Infof("Sent Slack notification (channel %s): %v: HTTP %d: %s", config.GetChannel(), incidentKey, resp.StatusCode, respBuf) -// // BUG: Check response for result of operation. -// return nil -// }