2013-07-16 15:03:56 +00:00
|
|
|
// Copyright 2013 Prometheus Team
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2013-07-17 15:45:01 +00:00
|
|
|
package manager
|
2013-07-16 15:03:56 +00:00
|
|
|
|
|
|
|
import (
|
2015-06-29 15:21:36 +00:00
|
|
|
"github.com/prometheus/common/model"
|
|
|
|
)
|
2013-07-23 08:40:23 +00:00
|
|
|
|
2013-08-27 13:32:08 +00:00
|
|
|
// Alert models an action triggered by Prometheus.
|
|
|
|
type Alert struct {
|
|
|
|
// Short summary of alert.
|
2015-05-20 22:01:17 +00:00
|
|
|
Summary string `json:"summary"`
|
2015-06-30 06:43:38 +00:00
|
|
|
|
2013-08-27 13:32:08 +00:00
|
|
|
// Long description of alert.
|
2015-05-20 22:01:17 +00:00
|
|
|
Description string `json:"description"`
|
2015-06-30 06:43:38 +00:00
|
|
|
|
2015-06-25 15:59:00 +00:00
|
|
|
// Runbook link or reference for the alert.
|
|
|
|
Runbook string `json:"runbook"`
|
2015-06-30 06:43:38 +00:00
|
|
|
|
2013-07-16 15:03:56 +00:00
|
|
|
// Label value pairs for purpose of aggregation, matching, and disposition
|
2013-07-30 11:18:11 +00:00
|
|
|
// dispatching. This must minimally include an "alertname" label.
|
2015-06-30 06:43:38 +00:00
|
|
|
Labels model.LabelSet `json:"labels"`
|
|
|
|
|
2013-07-18 12:49:37 +00:00
|
|
|
// Extra key/value information which is not used for aggregation.
|
2015-06-30 06:43:38 +00:00
|
|
|
Payload map[string]string `json:"payload"`
|
2013-07-23 08:40:23 +00:00
|
|
|
}
|
|
|
|
|
2013-08-27 13:32:08 +00:00
|
|
|
func (a *Alert) Name() string {
|
2015-06-30 06:43:38 +00:00
|
|
|
return string(a.Labels[model.AlertNameLabel])
|
2013-07-16 15:03:56 +00:00
|
|
|
}
|
|
|
|
|
2015-06-30 06:43:38 +00:00
|
|
|
func (a *Alert) Fingerprint() model.Fingerprint {
|
2013-08-27 13:32:08 +00:00
|
|
|
return a.Labels.Fingerprint()
|
|
|
|
}
|