Documentation
¶
Overview ¶
Package alertmanager provides types for working with alert manager webhooks.
Index ¶
Constants ¶
View Source
const ( StatusFiring = "firing" StatusResolved = "resolved" )
Constants for alert statuses.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Alert struct { Annotations map[string]string `json:"annotations"` EndsAt time.Time `json:"endsAt"` GeneratorURL string `json:"generatorURL"` Labels map[string]string `json:"labels"` StartsAt time.Time `json:"startsAt"` Status string `json:"status"` }
The Alert type represents a single alert within a webhook payload.
type Dispatcher ¶
The Dispatcher interface describes types that can handle alert manager webhooks and forward them somewhere.
type Webhook ¶
type Webhook struct { Alerts []Alert `json:"alerts"` CommonAnnotations map[string]string `json:"commonAnnotations"` CommonLabels map[string]string `json:"commonLabels"` ExternalURL string `json:"externalURL"` GroupKey string `json:"groupKey"` GroupLabels map[string]string `json:"groupLabels"` Receiver string `json:"receiver"` Status string `json:"status"` }
The Webhook type represents the structure of an alert manager webhook.
type WebhookHandler ¶
The WebhookHandler type is used to handle inbound alert manager webhooks via HTTP.
func NewWebhookHandler ¶
func NewWebhookHandler(dispatcher Dispatcher) *WebhookHandler
NewWebhookHandler returns a new WebhookHandler instance that will forward webhooks to the given Dispatcher implementation.
func (*WebhookHandler) Handle ¶
func (wh *WebhookHandler) Handle(w http.ResponseWriter, r *http.Request)
Handle an inbound HTTP request.
func (*WebhookHandler) Register ¶
func (wh *WebhookHandler) Register(r *mux.Router)
Register endpoints on the provided router.
Click to show internal directories.
Click to hide internal directories.