alertmanager

package
v0.0.0-...-6bc686f Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2016 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

This section is empty.

Types

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 {
	http.RoundTripper
	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,
	}).Dial,
	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.

Jump to

Keyboard shortcuts

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