Back to

Package alertmanager

Latest Go to latest

The highest tagged major version is .

Published: Jul 23, 2016 | License: Apache-2.0 | Module:



const (
	// The different API error types.
	ErrBadData     ErrorType = "bad_data"
	ErrTimeout               = "timeout"
	ErrCanceled              = "canceled"
	ErrExec                  = "execution"
	ErrBadResponse           = "bad_response"

type AlertAPI

type AlertAPI interface {
	// List all the active alerts.
	List(ctx context.Context) ([]*model.Alert, error)
	// Push a list of alerts into the Alertmanager.
	Push(ctx context.Context, alerts ...*model.Alert) error

func NewAlertAPI

func NewAlertAPI(c Client) AlertAPI

NewAlertAPI returns a new AlertAPI for the client.

type CancelableTransport

type CancelableTransport interface {
	CancelRequest(req *http.Request)

CancelableTransport is like net.Transport but provides per-request cancelation functionality.

var DefaultTransport CancelableTransport = &http.Transport{
	Proxy: http.ProxyFromEnvironment,
	Dial: (&net.Dialer{
		Timeout:   30 * time.Second,
		KeepAlive: 30 * time.Second,
	TLSHandshakeTimeout: 10 * time.Second,

type Client

type Client interface {
	// contains filtered or unexported methods

func New

func New(cfg Config) (Client, error)

New returns a new Client.

type Config

type Config struct {
	// The address of the Prometheus to connect to.
	Address string

	// Transport is used by the Client to drive HTTP requests. If not
	// provided, DefaultTransport will be used.
	Transport CancelableTransport

Config defines configuration parameters for a new client.

type Error

type Error struct {
	Type ErrorType
	Msg  string

Error is an error returned by the API.

func (*Error) Error

func (e *Error) Error() string

type ErrorType

type ErrorType string

type SilenceAPI

type SilenceAPI interface {
	// Get returns the silence associated with the given ID.
	Get(ctx context.Context, id uint64) (*model.Silence, error)
	// Set updates or creates the given silence and returns its ID.
	Set(ctx context.Context, sil *model.Silence) (uint64, error)
	// Del deletes the silence with the given ID.
	Del(ctx context.Context, id uint64) error
	// List all silences of the server.
	List(ctx context.Context) ([]*model.Silence, error)

SilenceAPI provides bindings the Alertmanager's silence API.

func NewSilenceAPI

func NewSilenceAPI(c Client) SilenceAPI

NewSilenceAPI returns a new SilenceAPI for the client.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier