alerthook

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package alerthook implements reception of alertmanager webhooks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(listenAddr string, alertHandler AlertHandler, registerer prometheus.Registerer)

Serve provides an alertmanager webhook server. It registers a handler on '/alert' to receive alerts. It also registers handlers for '/metrics' (Prometheus metrics) and '/-/healthy' (health checking).

Alerts are forwarded to the provided AlertHandler.

Types

type AlertHandler

type AlertHandler interface {
	HandleAlert(context.Context, *alertmanager.Alert) error
	Healthy() bool
}

AlertHandler should be implemented by clients wishing to receive the alerts from the hook.

type AlertHook

type AlertHook struct {
	// contains filtered or unexported fields
}

func New

func New(handler AlertHandler, registerer prometheus.Registerer) *AlertHook

func (*AlertHook) Healthy

func (ah *AlertHook) Healthy() bool

func (*AlertHook) ServeHTTP

func (ah *AlertHook) ServeHTTP(w http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL