mirror of
https://github.com/prometheus/alertmanager
synced 2025-02-27 16:20:24 +00:00
Remove temporary Slack integration
This commit is contained in:
parent
ba4f5684bb
commit
7fb9e63f89
@ -80,102 +80,3 @@ func (w *Webhook) Notify(ctx context.Context, alerts ...*types.Alert) error {
|
|||||||
|
|
||||||
return nil
|
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
|
|
||||||
// }
|
|
||||||
|
Loading…
Reference in New Issue
Block a user