Merge pull request #181 from prometheus/hook2

Update webhook for new alertmanager.
This commit is contained in:
Brian Brazil 2015-12-07 18:13:40 +00:00
commit dd43885ea6
1 changed files with 9 additions and 1 deletions

View File

@ -96,8 +96,16 @@ type WebhookMessage struct {
func (w *Webhook) Notify(ctx context.Context, alerts ...*types.Alert) error {
as := types.Alerts(alerts...)
// If there are no annotations, instantiate so
// {} is sent rather than null.
for _, a := range as {
if a.Annotations == nil {
a.Annotations = model.LabelSet{}
}
}
msg := &WebhookMessage{
Version: "1",
Version: "2",
Status: as.Status(),
Alerts: as,
}